1 ;;; flymake.el -- a universal on-the-fly syntax checker
3 ;; Copyright (C) 2003-2013 Free Software Foundation, Inc.
5 ;; Author: Pavel Kobyakov <pk_at_work@yahoo.com>
6 ;; Maintainer: Pavel Kobyakov <pk_at_work@yahoo.com>
8 ;; Keywords: c languages tools
10 ;; This file is part of GNU Emacs.
12 ;; GNU Emacs is free software: you can redistribute it and/or modify
13 ;; it under the terms of the GNU General Public License as published by
14 ;; the Free Software Foundation, either version 3 of the License, or
15 ;; (at your option) any later version.
17 ;; GNU Emacs is distributed in the hope that it will be useful,
18 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 ;; GNU General Public License for more details.
22 ;; You should have received a copy of the GNU General Public License
23 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
27 ;; Flymake is a minor Emacs mode performing on-the-fly syntax
28 ;; checks using the external syntax check tool (for C/C++ this
29 ;; is usually the compiler)
33 ;; - Only uses "Makefile", not "makefile" or "GNUmakefile"
34 ;; (from http://bugs.debian.org/337339).
38 (eval-when-compile (require 'cl-lib))
39 (if (featurep 'xemacs) (require 'overlay))
41 (defvar flymake-is-running nil
42 "If t, flymake syntax check process is running for the current buffer.")
43 (make-variable-buffer-local 'flymake-is-running)
45 (defvar flymake-timer nil
46 "Timer for starting syntax check.")
47 (make-variable-buffer-local 'flymake-timer)
49 (defvar flymake-last-change-time nil
50 "Time of last buffer change.")
51 (make-variable-buffer-local 'flymake-last-change-time)
53 (defvar flymake-check-start-time nil
54 "Time at which syntax check was started.")
55 (make-variable-buffer-local 'flymake-check-start-time)
57 (defvar flymake-check-was-interrupted nil
58 "Non-nil if syntax check was killed by `flymake-compile'.")
59 (make-variable-buffer-local 'flymake-check-was-interrupted)
61 (defvar flymake-err-info nil
62 "Sorted list of line numbers and lists of err info in the form (file, err-text).")
63 (make-variable-buffer-local 'flymake-err-info)
65 (defvar flymake-new-err-info nil
66 "Same as `flymake-err-info', effective when a syntax check is in progress.")
67 (make-variable-buffer-local 'flymake-new-err-info)
69 ;;;; [[ cross-emacs compatibility routines
70 (defsubst flymake-makehash (&optional test)
71 (if (fboundp 'make-hash-table)
72 (if test (make-hash-table :test test) (make-hash-table))
76 (defalias 'flymake-float-time
77 (if (fboundp 'float-time)
79 (if (featurep 'xemacs)
81 (multiple-value-bind (s0 s1 s2) (values-list (current-time))
82 (+ (* (float (ash 1 16)) s0) (float s1) (* 0.0000001 s2)))))))
84 (defalias 'flymake-replace-regexp-in-string
85 (if (eval-when-compile (fboundp 'replace-regexp-in-string))
86 'replace-regexp-in-string
87 (lambda (regexp rep str)
88 (replace-in-string str regexp rep))))
90 (defalias 'flymake-split-string
91 (if (condition-case nil (equal (split-string " bc " " " t) '("bc"))
93 (lambda (str pattern) (split-string str pattern t))
95 "Split STR into a list of substrings bounded by PATTERN.
96 Zero-length substrings at the beginning and end of the list are omitted."
97 (let ((split (split-string str pattern)))
98 (while (equal (car split) "") (setq split (cdr split)))
99 (setq split (nreverse split))
100 (while (equal (car split) "") (setq split (cdr split)))
103 (defalias 'flymake-get-temp-dir
104 (if (fboundp 'temp-directory)
106 (lambda () temporary-file-directory)))
108 (defun flymake-posn-at-point-as-event (&optional position window dx dy)
109 "Return pixel position of top left corner of glyph at POSITION,
110 relative to top left corner of WINDOW, as a mouse-1 click
111 event (identical to the event that would be triggered by clicking
112 mouse button 1 at the top left corner of the glyph).
114 POSITION and WINDOW default to the position of point in the
117 DX and DY specify optional offsets from the top left of the glyph."
118 (unless window (setq window (selected-window)))
119 (unless position (setq position (window-point window)))
120 (unless dx (setq dx 0))
121 (unless dy (setq dy 0))
123 (let* ((pos (posn-at-point position window))
125 (edges (window-inside-pixel-edges window))
126 (win-x-y (window-pixel-edges window)))
127 ;; adjust for window edges
128 (setcar (nthcdr 2 pos)
129 (cons (+ (car x-y) (car edges) (- (car win-x-y)) dx)
130 (+ (cdr x-y) (cadr edges) (- (cadr win-x-y)) dy)))
131 (list 'mouse-1 pos)))
133 (defun flymake-popup-menu (menu-data)
134 "Pop up the flymake menu at point, using the data MENU-DATA.
135 POS is a list of the form ((X Y) WINDOW), where X and Y are
136 pixels positions from the top left corner of WINDOW's frame.
137 MENU-DATA is a list of error and warning messages returned by
138 `flymake-make-err-menu-data'."
139 (if (featurep 'xemacs)
140 (let* ((pos (flymake-get-point-pixel-pos))
143 (fake-event-props '(button 1 x 1 y 1)))
144 (setq fake-event-props (plist-put fake-event-props 'x x-pos))
145 (setq fake-event-props (plist-put fake-event-props 'y y-pos))
146 (popup-menu (flymake-make-xemacs-menu menu-data)
147 (make-event 'button-press fake-event-props)))
148 (x-popup-menu (if (eval-when-compile (fboundp 'posn-at-point))
149 (flymake-posn-at-point-as-event)
150 (list (flymake-get-point-pixel-pos) (selected-window)))
151 (flymake-make-emacs-menu menu-data))))
153 (defun flymake-make-emacs-menu (menu-data)
154 "Return a menu specifier using MENU-DATA.
155 MENU-DATA is a list of error and warning messages returned by
156 `flymake-make-err-menu-data'.
157 See `x-popup-menu' for the menu specifier format."
158 (let* ((menu-title (nth 0 menu-data))
159 (menu-items (nth 1 menu-data))
160 (menu-commands (mapcar (lambda (foo)
161 (cons (nth 0 foo) (nth 1 foo)))
163 (list menu-title (cons "" menu-commands))))
165 (if (featurep 'xemacs) (progn
167 (defun flymake-nop ())
169 (defun flymake-make-xemacs-menu (menu-data)
170 "Return a menu specifier using MENU-DATA."
171 (let* ((menu-title (nth 0 menu-data))
172 (menu-items (nth 1 menu-data))
174 (setq menu-commands (mapcar (lambda (foo)
175 (vector (nth 0 foo) (or (nth 1 foo) '(flymake-nop)) t))
177 (cons menu-title menu-commands)))
181 (unless (eval-when-compile (fboundp 'posn-at-point))
183 (defun flymake-current-row ()
184 "Return current row number in current frame."
185 (if (fboundp 'window-edges)
186 (+ (car (cdr (window-edges))) (count-lines (window-start) (point)))
187 (count-lines (window-start) (point))))
189 (defun flymake-selected-frame ()
190 (if (fboundp 'window-edges)
194 (defun flymake-get-point-pixel-pos ()
195 "Return point position in pixels: (x, y)."
196 (let ((mouse-pos (mouse-position))
199 (if (car (cdr mouse-pos))
201 (set-mouse-position (flymake-selected-frame) (current-column) (flymake-current-row))
202 (setq pixel-pos (mouse-pixel-position))
203 (set-mouse-position (car mouse-pos) (car (cdr mouse-pos)) (cdr (cdr mouse-pos)))
204 (setq ret (list (car (cdr pixel-pos)) (cdr (cdr pixel-pos)))))
207 (flymake-log 3 "mouse pos is %s" ret)
210 ) ;; End of (unless (fboundp 'posn-at-point)
214 (defcustom flymake-log-level -1
215 "Logging level, only messages with level lower or equal will be logged.
216 -1 = NONE, 0 = ERROR, 1 = WARNING, 2 = INFO, 3 = DEBUG"
220 (defun flymake-log (level text &rest args)
221 "Log a message at level LEVEL.
222 If LEVEL is higher than `flymake-log-level', the message is
223 ignored. Otherwise, it is printed using `message'.
224 TEXT is a format control string, and the remaining arguments ARGS
225 are the string substitutions (see `format')."
226 (if (<= level flymake-log-level)
227 (let* ((msg (apply 'format text args)))
232 ;; (flymake-save-buffer-in-file "d:/flymake.log" t) ; make log file name customizable
236 (defun flymake-ins-after (list pos val)
237 "Insert VAL into LIST after position POS."
238 (let ((tmp (copy-sequence list))) ; (???)
239 (setcdr (nthcdr pos tmp) (cons val (nthcdr (1+ pos) tmp)))
242 (defun flymake-set-at (list pos val)
243 "Set VAL at position POS in LIST."
244 (let ((tmp (copy-sequence list))) ; (???)
245 (setcar (nthcdr pos tmp) val)
248 (defvar flymake-processes nil
249 "List of currently active flymake processes.")
251 (defvar flymake-output-residual nil)
253 (make-variable-buffer-local 'flymake-output-residual)
255 (defgroup flymake nil
256 "Universal on-the-fly syntax checker."
260 (defcustom flymake-allowed-file-name-masks
261 '(("\\.\\(?:c\\(?:pp\\|xx\\|\\+\\+\\)?\\|CC\\)\\'" flymake-simple-make-init)
262 ("\\.xml\\'" flymake-xml-init)
263 ("\\.html?\\'" flymake-xml-init)
264 ("\\.cs\\'" flymake-simple-make-init)
265 ("\\.p[ml]\\'" flymake-perl-init)
266 ("\\.php[345]?\\'" flymake-php-init)
267 ("\\.h\\'" flymake-master-make-header-init flymake-master-cleanup)
268 ("\\.java\\'" flymake-simple-make-java-init flymake-simple-java-cleanup)
269 ("[0-9]+\\.tex\\'" flymake-master-tex-init flymake-master-cleanup)
270 ("\\.tex\\'" flymake-simple-tex-init)
271 ("\\.idl\\'" flymake-simple-make-init)
274 ;; ("\\.h\\'" 2 ("\\.cpp\\'" "\\.c\\'")
275 ;; ("[ \t]*#[ \t]*include[ \t]*\"\\([\w0-9/\\_\.]*[/\\]*\\)\\(%s\\)\"" 1 2))
278 ;; ("[0-9]+\\.tex\\'" 2 ("\\.tex\\'")
279 ;; ("[ \t]*\\input[ \t]*{\\(.*\\)\\(%s\\)}" 1 2 ))
282 "Files syntax checking is allowed for.
283 This is an alist with elements of the form:
284 REGEXP INIT [CLEANUP [NAME]]
285 REGEXP is a regular expression that matches a file name.
286 INIT is the init function to use.
287 CLEANUP is the cleanup function to use, default `flymake-simple-cleanup'.
288 NAME is the file name function to use, default `flymake-get-real-file-name'."
290 :type '(alist :key-type (regexp :tag "File regexp")
292 (list :tag "Handler functions"
293 (function :tag "Init function")
294 (choice :tag "Cleanup function"
295 (const :tag "flymake-simple-cleanup" nil)
297 (choice :tag "Name function"
298 (const :tag "flymake-get-real-file-name" nil)
301 (defun flymake-get-file-name-mode-and-masks (file-name)
302 "Return the corresponding entry from `flymake-allowed-file-name-masks'."
303 (unless (stringp file-name)
304 (error "Invalid file-name"))
305 (let ((fnm flymake-allowed-file-name-masks)
306 (mode-and-masks nil))
307 (while (and (not mode-and-masks) fnm)
308 (if (string-match (car (car fnm)) file-name)
309 (setq mode-and-masks (cdr (car fnm))))
310 (setq fnm (cdr fnm)))
311 (flymake-log 3 "file %s, init=%s" file-name (car mode-and-masks))
314 (defun flymake-can-syntax-check-file (file-name)
315 "Determine whether we can syntax check FILE-NAME.
316 Return nil if we cannot, non-nil if we can."
317 (if (flymake-get-init-function file-name) t nil))
319 (defun flymake-get-init-function (file-name)
320 "Return init function to be used for the file."
321 (let* ((init-f (nth 0 (flymake-get-file-name-mode-and-masks file-name))))
322 ;;(flymake-log 0 "calling %s" init-f)
323 ;;(funcall init-f (current-buffer))
326 (defun flymake-get-cleanup-function (file-name)
327 "Return cleanup function to be used for the file."
328 (or (nth 1 (flymake-get-file-name-mode-and-masks file-name))
329 'flymake-simple-cleanup))
331 (defun flymake-get-real-file-name-function (file-name)
332 (or (nth 2 (flymake-get-file-name-mode-and-masks file-name))
333 'flymake-get-real-file-name))
335 (defvar flymake-find-buildfile-cache (flymake-makehash 'equal))
337 (defun flymake-get-buildfile-from-cache (dir-name)
338 (gethash dir-name flymake-find-buildfile-cache))
340 (defun flymake-add-buildfile-to-cache (dir-name buildfile)
341 (puthash dir-name buildfile flymake-find-buildfile-cache))
343 (defun flymake-clear-buildfile-cache ()
344 (clrhash flymake-find-buildfile-cache))
346 (defun flymake-find-buildfile (buildfile-name source-dir-name)
347 "Find buildfile starting from current directory.
348 Buildfile includes Makefile, build.xml etc.
349 Return its file name if found, or nil if not found."
350 (or (flymake-get-buildfile-from-cache source-dir-name)
351 (let* ((file (locate-dominating-file source-dir-name buildfile-name)))
354 (flymake-log 3 "found buildfile at %s" file)
355 (flymake-add-buildfile-to-cache source-dir-name file)
358 (flymake-log 3 "buildfile for %s not found" source-dir-name)
361 (defun flymake-fix-file-name (name)
362 "Replace all occurrences of '\' with '/'."
364 (setq name (expand-file-name name))
365 (setq name (abbreviate-file-name name))
366 (setq name (directory-file-name name))
369 (defun flymake-same-files (file-name-one file-name-two)
370 "Check if FILE-NAME-ONE and FILE-NAME-TWO point to same file.
371 Return t if so, nil if not."
372 (equal (flymake-fix-file-name file-name-one)
373 (flymake-fix-file-name file-name-two)))
375 (defcustom flymake-master-file-dirs '("." "./src" "./UnitTest")
376 "Dirs where to look for master files."
378 :type '(repeat (string)))
380 (defcustom flymake-master-file-count-limit 32
381 "Max number of master files to check."
385 ;; This is bound dynamically to pass a parameter to a sort predicate below
386 (defvar flymake-included-file-name)
388 (defun flymake-find-possible-master-files (file-name master-file-dirs masks)
389 "Find (by name and location) all possible master files.
390 Master files include .cpp and .c for .h. Files are searched for
391 starting from the .h directory and max max-level parent dirs.
392 File contents are not checked."
393 (let* ((dirs master-file-dirs)
397 (while (and (not done) dirs)
398 (let* ((dir (expand-file-name (car dirs) (file-name-directory file-name)))
400 (while (and (file-exists-p dir) (not done) masks)
401 (let* ((mask (car masks))
402 (dir-files (directory-files dir t mask)))
404 (flymake-log 3 "dir %s, %d file(s) for mask %s"
405 dir (length dir-files) mask)
406 (while (and (not done) dir-files)
407 (when (not (file-directory-p (car dir-files)))
408 (setq files (cons (car dir-files) files))
409 (when (>= (length files) flymake-master-file-count-limit)
410 (flymake-log 3 "master file count limit (%d) reached" flymake-master-file-count-limit)
412 (setq dir-files (cdr dir-files))))
413 (setq masks (cdr masks))))
414 (setq dirs (cdr dirs)))
416 (let ((flymake-included-file-name (file-name-nondirectory file-name)))
417 (setq files (sort files 'flymake-master-file-compare))))
418 (flymake-log 3 "found %d possible master file(s)" (length files))
421 (defun flymake-master-file-compare (file-one file-two)
422 "Compare two files specified by FILE-ONE and FILE-TWO.
423 This function is used in sort to move most possible file names
424 to the beginning of the list (File.h -> File.cpp moved to top)."
425 (and (equal (file-name-sans-extension flymake-included-file-name)
426 (file-name-base file-one))
427 (not (equal file-one file-two))))
429 (defcustom flymake-check-file-limit 8192
430 "Maximum number of chars to look at when checking possible master file.
431 Nil means search the entire file."
433 :type '(choice (const :tag "No limit" nil)
434 (integer :tag "Characters")))
436 (defun flymake-check-patch-master-file-buffer
437 (master-file-temp-buffer
438 master-file-name patched-master-file-name
439 source-file-name patched-source-file-name
441 "Check if MASTER-FILE-NAME is a master file for SOURCE-FILE-NAME.
442 If yes, patch a copy of MASTER-FILE-NAME to include PATCHED-SOURCE-FILE-NAME
443 instead of SOURCE-FILE-NAME.
445 For example, foo.cpp is a master file if it includes foo.h.
447 Whether a buffer for MATER-FILE-NAME exists, use it as a source
448 instead of reading master file from disk."
449 (let* ((source-file-nondir (file-name-nondirectory source-file-name))
450 (source-file-extension (file-name-extension source-file-nondir))
451 (source-file-nonext (file-name-sans-extension source-file-nondir))
454 (search-limit flymake-check-file-limit))
456 (format regexp ; "[ \t]*#[ \t]*include[ \t]*\"\\(.*%s\\)\""
457 ;; Hack for tex files, where \include often excludes .tex.
458 ;; Maybe this is safe generally.
459 (if (and (> (length source-file-extension) 1)
460 (string-equal source-file-extension "tex"))
461 (format "%s\\(?:\\.%s\\)?"
462 (regexp-quote source-file-nonext)
463 (regexp-quote source-file-extension))
464 (regexp-quote source-file-nondir))))
466 (with-current-buffer master-file-temp-buffer
467 (if (or (not search-limit)
468 (> search-limit (point-max)))
469 (setq search-limit (point-max)))
470 (flymake-log 3 "checking %s against regexp %s"
471 master-file-name regexp)
472 (goto-char (point-min))
473 (while (and (< (point) search-limit)
474 (re-search-forward regexp search-limit t))
475 (let ((match-beg (match-beginning 1))
476 (match-end (match-end 1)))
478 (flymake-log 3 "found possible match for %s" source-file-nondir)
479 (setq inc-name (match-string 1))
480 (and (> (length source-file-extension) 1)
481 (string-equal source-file-extension "tex")
482 (not (string-match (format "\\.%s\\'" source-file-extension)
484 (setq inc-name (concat inc-name "." source-file-extension)))
485 (when (eq t (compare-strings
486 source-file-nondir nil nil
487 inc-name (- (length inc-name)
488 (length source-file-nondir)) nil))
489 (flymake-log 3 "inc-name=%s" inc-name)
490 (when (flymake-check-include source-file-name inc-name
493 ;; replace-match is not used here as it fails in
494 ;; XEmacs with 'last match not a buffer' error as
495 ;; check-includes calls replace-in-string
496 (flymake-replace-region
498 (file-name-nondirectory patched-source-file-name))))
501 (flymake-save-buffer-in-file patched-master-file-name)))
502 ;;+(flymake-log 3 "killing buffer %s"
503 ;; (buffer-name master-file-temp-buffer))
504 (kill-buffer master-file-temp-buffer))
505 ;;+(flymake-log 3 "check-patch master file %s: %s" master-file-name found)
507 (flymake-log 2 "found master file %s" master-file-name))
510 (defun flymake-replace-region (beg end rep)
511 "Replace text in BUFFER in region (BEG END) with REP."
514 ;; Insert before deleting, so as to better preserve markers's positions.
516 (delete-region beg end)))
518 (defun flymake-read-file-to-temp-buffer (file-name)
519 "Insert contents of FILE-NAME into newly created temp buffer."
520 (let* ((temp-buffer (get-buffer-create (generate-new-buffer-name (concat "flymake:" (file-name-nondirectory file-name))))))
521 (with-current-buffer temp-buffer
522 (insert-file-contents file-name))
525 (defun flymake-copy-buffer-to-temp-buffer (buffer)
526 "Copy contents of BUFFER into newly created temp buffer."
528 (get-buffer-create (generate-new-buffer-name
529 (concat "flymake:" (buffer-name buffer))))
530 (insert-buffer-substring buffer)
533 (defun flymake-check-include (source-file-name inc-name include-dirs)
534 "Check if SOURCE-FILE-NAME can be found in include path.
535 Return t if it can be found via include path using INC-NAME."
536 (if (file-name-absolute-p inc-name)
537 (flymake-same-files source-file-name inc-name)
538 (while (and include-dirs
539 (not (flymake-same-files
541 (concat (file-name-directory source-file-name)
542 "/" (car include-dirs)
544 (setq include-dirs (cdr include-dirs)))
547 (defun flymake-find-buffer-for-file (file-name)
548 "Check if there exists a buffer visiting FILE-NAME.
549 Return t if so, nil if not."
550 (let ((buffer-name (get-file-buffer file-name)))
552 (get-buffer buffer-name))))
554 (defun flymake-create-master-file (source-file-name patched-source-file-name get-incl-dirs-f create-temp-f masks include-regexp)
555 "Save SOURCE-FILE-NAME with a different name.
556 Find master file, patch and save it."
557 (let* ((possible-master-files (flymake-find-possible-master-files source-file-name flymake-master-file-dirs masks))
558 (master-file-count (length possible-master-files))
561 (master-file-name nil)
562 (patched-master-file-name nil)
565 (while (and (not found) (< idx master-file-count))
566 (setq master-file-name (nth idx possible-master-files))
567 (setq patched-master-file-name (funcall create-temp-f master-file-name "flymake_master"))
568 (if (flymake-find-buffer-for-file master-file-name)
569 (setq temp-buffer (flymake-copy-buffer-to-temp-buffer (flymake-find-buffer-for-file master-file-name)))
570 (setq temp-buffer (flymake-read-file-to-temp-buffer master-file-name)))
572 (flymake-check-patch-master-file-buffer
575 patched-master-file-name
577 patched-source-file-name
578 (funcall get-incl-dirs-f (file-name-directory master-file-name))
582 (list master-file-name patched-master-file-name)
584 (flymake-log 3 "none of %d master file(s) checked includes %s" master-file-count
585 (file-name-nondirectory source-file-name))
588 (defun flymake-save-buffer-in-file (file-name)
589 (make-directory (file-name-directory file-name) 1)
590 (write-region nil nil file-name nil 566)
591 (flymake-log 3 "saved buffer %s in file %s" (buffer-name) file-name))
593 (defun flymake-save-string-to-file (file-name data)
594 "Save string DATA to file FILE-NAME."
595 (write-region data nil file-name nil 566))
597 (defun flymake-read-file-to-string (file-name)
598 "Read contents of file FILE-NAME and return as a string."
600 (insert-file-contents file-name)
601 (buffer-substring (point-min) (point-max))))
603 (defun flymake-process-filter (process output)
604 "Parse OUTPUT and highlight error lines.
605 It's flymake process filter."
606 (let ((source-buffer (process-buffer process)))
608 (flymake-log 3 "received %d byte(s) of output from process %d"
609 (length output) (process-id process))
610 (when (buffer-live-p source-buffer)
611 (with-current-buffer source-buffer
612 (flymake-parse-output-and-residual output)))))
614 (defun flymake-process-sentinel (process _event)
615 "Sentinel for syntax check buffers."
616 (when (memq (process-status process) '(signal exit))
617 (let* ((exit-status (process-exit-status process))
618 (command (process-command process))
619 (source-buffer (process-buffer process))
620 (cleanup-f (flymake-get-cleanup-function (buffer-file-name source-buffer))))
622 (flymake-log 2 "process %d exited with code %d"
623 (process-id process) exit-status)
626 (flymake-log 3 "cleaning up using %s" cleanup-f)
627 (when (buffer-live-p source-buffer)
628 (with-current-buffer source-buffer
629 (funcall cleanup-f)))
631 (delete-process process)
632 (setq flymake-processes (delq process flymake-processes))
634 (when (buffer-live-p source-buffer)
635 (with-current-buffer source-buffer
637 (flymake-parse-residual)
638 (flymake-post-syntax-check exit-status command)
639 (setq flymake-is-running nil))))
641 (let ((err-str (format "Error in process sentinel for buffer %s: %s"
642 source-buffer (error-message-string err))))
643 (flymake-log 0 err-str)
644 (with-current-buffer source-buffer
645 (setq flymake-is-running nil))))))))
647 (defun flymake-post-syntax-check (exit-status command)
648 (setq flymake-err-info flymake-new-err-info)
649 (setq flymake-new-err-info nil)
650 (setq flymake-err-info
651 (flymake-fix-line-numbers
652 flymake-err-info 1 (flymake-count-lines)))
653 (flymake-delete-own-overlays)
654 (flymake-highlight-err-lines flymake-err-info)
655 (let (err-count warn-count)
656 (setq err-count (flymake-get-err-count flymake-err-info "e"))
657 (setq warn-count (flymake-get-err-count flymake-err-info "w"))
658 (flymake-log 2 "%s: %d error(s), %d warning(s) in %.2f second(s)"
659 (buffer-name) err-count warn-count
660 (- (flymake-float-time) flymake-check-start-time))
661 (setq flymake-check-start-time nil)
663 (if (and (equal 0 err-count) (equal 0 warn-count))
664 (if (equal 0 exit-status)
665 (flymake-report-status "" "") ; PASSED
666 (if (not flymake-check-was-interrupted)
667 (flymake-report-fatal-status "CFGERR"
668 (format "Configuration error has occurred while running %s" command))
669 (flymake-report-status nil ""))) ; "STOPPED"
670 (flymake-report-status (format "%d/%d" err-count warn-count) ""))))
672 (defun flymake-parse-output-and-residual (output)
673 "Split OUTPUT into lines, merge in residual if necessary."
674 (let* ((buffer-residual flymake-output-residual)
675 (total-output (if buffer-residual (concat buffer-residual output) output))
676 (lines-and-residual (flymake-split-output total-output))
677 (lines (nth 0 lines-and-residual))
678 (new-residual (nth 1 lines-and-residual)))
679 (setq flymake-output-residual new-residual)
680 (setq flymake-new-err-info
681 (flymake-parse-err-lines
682 flymake-new-err-info lines))))
684 (defun flymake-parse-residual ()
685 "Parse residual if it's non empty."
686 (when flymake-output-residual
687 (setq flymake-new-err-info
688 (flymake-parse-err-lines
690 (list flymake-output-residual)))
691 (setq flymake-output-residual nil)))
693 (defun flymake-er-make-er (line-no line-err-info-list)
694 (list line-no line-err-info-list))
696 (defun flymake-er-get-line (err-info)
699 (defun flymake-er-get-line-err-info-list (err-info)
702 (cl-defstruct (flymake-ler
704 (:constructor flymake-ler-make-ler (file line type text &optional full-file)))
705 file line type text full-file)
707 (defun flymake-ler-set-file (line-err-info file)
708 (flymake-ler-make-ler file
709 (flymake-ler-line line-err-info)
710 (flymake-ler-type line-err-info)
711 (flymake-ler-text line-err-info)
712 (flymake-ler-full-file line-err-info)))
714 (defun flymake-ler-set-full-file (line-err-info full-file)
715 (flymake-ler-make-ler (flymake-ler-file line-err-info)
716 (flymake-ler-line line-err-info)
717 (flymake-ler-type line-err-info)
718 (flymake-ler-text line-err-info)
721 (defun flymake-ler-set-line (line-err-info line)
722 (flymake-ler-make-ler (flymake-ler-file line-err-info)
724 (flymake-ler-type line-err-info)
725 (flymake-ler-text line-err-info)
726 (flymake-ler-full-file line-err-info)))
728 (defun flymake-get-line-err-count (line-err-info-list type)
729 "Return number of errors of specified TYPE.
730 Value of TYPE is either \"e\" or \"w\"."
732 (count (length line-err-info-list))
736 (when (equal type (flymake-ler-type (nth idx line-err-info-list)))
737 (setq err-count (1+ err-count)))
741 (defun flymake-get-err-count (err-info-list type)
742 "Return number of errors of specified TYPE for ERR-INFO-LIST."
744 (count (length err-info-list))
747 (setq err-count (+ err-count (flymake-get-line-err-count (nth 1 (nth idx err-info-list)) type)))
751 (defun flymake-fix-line-numbers (err-info-list min-line max-line)
752 "Replace line numbers with fixed value.
753 If line-numbers is less than MIN-LINE, set line numbers to MIN-LINE.
754 If line numbers is greater than MAX-LINE, set line numbers to MAX-LINE.
755 The reason for this fix is because some compilers might report
756 line number outside the file being compiled."
757 (let* ((count (length err-info-list))
761 (setq err-info (nth (1- count) err-info-list))
762 (setq line (flymake-er-get-line err-info))
763 (when (or (< line min-line) (> line max-line))
764 (setq line (if (< line min-line) min-line max-line))
765 (setq err-info-list (flymake-set-at err-info-list (1- count)
766 (flymake-er-make-er line
767 (flymake-er-get-line-err-info-list err-info)))))
768 (setq count (1- count))))
771 (defun flymake-highlight-err-lines (err-info-list)
772 "Highlight error lines in BUFFER using info from ERR-INFO-LIST."
774 (dolist (err err-info-list)
775 (flymake-highlight-line (car err) (nth 1 err)))))
777 (defun flymake-overlay-p (ov)
778 "Determine whether overlay OV was created by flymake."
779 (and (overlayp ov) (overlay-get ov 'flymake-overlay)))
781 (defcustom flymake-error-bitmap '(exclamation-mark error)
782 "Bitmap (a symbol) used in the fringe for indicating errors.
783 The value may also be a list of two elements where the second
784 element specifies the face for the bitmap. For possible bitmap
785 symbols, see `fringe-bitmaps'. See also `flymake-warning-bitmap'.
787 The option `flymake-fringe-indicator-position' controls how and where
791 :type '(choice (symbol :tag "Bitmap")
792 (list :tag "Bitmap and face"
793 (symbol :tag "Bitmap")
794 (face :tag "Face"))))
796 (defcustom flymake-warning-bitmap 'question-mark
797 "Bitmap (a symbol) used in the fringe for indicating warnings.
798 The value may also be a list of two elements where the second
799 element specifies the face for the bitmap. For possible bitmap
800 symbols, see `fringe-bitmaps'. See also `flymake-error-bitmap'.
802 The option `flymake-fringe-indicator-position' controls how and where
806 :type '(choice (symbol :tag "Bitmap")
807 (list :tag "Bitmap and face"
808 (symbol :tag "Bitmap")
809 (face :tag "Face"))))
811 (defcustom flymake-fringe-indicator-position 'left-fringe
812 "The position to put flymake fringe indicator.
813 The value can be nil (do not use indicators), `left-fringe' or `right-fringe'.
814 See `flymake-error-bitmap' and `flymake-warning-bitmap'."
817 :type '(choice (const left-fringe)
819 (const :tag "No fringe indicators" nil)))
821 (defun flymake-make-overlay (beg end tooltip-text face bitmap mouse-face)
822 "Allocate a flymake overlay in range BEG and END."
823 (when (not (flymake-region-has-flymake-overlays beg end))
824 (let ((ov (make-overlay beg end nil t t))
825 (fringe (and flymake-fringe-indicator-position
826 (propertize "!" 'display
827 (cons flymake-fringe-indicator-position
831 (overlay-put ov 'face face)
832 (overlay-put ov 'mouse-face mouse-face)
833 (overlay-put ov 'help-echo tooltip-text)
834 (overlay-put ov 'flymake-overlay t)
835 (overlay-put ov 'priority 100)
836 (overlay-put ov 'evaporate t)
837 (overlay-put ov 'before-string fringe)
838 ;;+(flymake-log 3 "created overlay %s" ov)
840 (flymake-log 3 "created an overlay at (%d-%d)" beg end)))
842 (defun flymake-delete-own-overlays ()
843 "Delete all flymake overlays in BUFFER."
844 (dolist (ol (overlays-in (point-min) (point-max)))
845 (when (flymake-overlay-p ol)
847 ;;+(flymake-log 3 "deleted overlay %s" ol)
850 (defun flymake-region-has-flymake-overlays (beg end)
851 "Check if region specified by BEG and END has overlay.
852 Return t if it has at least one flymake overlay, nil if no overlay."
853 (let ((ov (overlays-in beg end))
854 (has-flymake-overlays nil))
856 (when (flymake-overlay-p (car ov))
857 (setq has-flymake-overlays t))
859 has-flymake-overlays))
861 (defface flymake-errline
862 '((((supports :underline (:style wave)))
863 :underline (:style wave :color "Red1"))
866 "Face used for marking error lines."
870 (defface flymake-warnline
871 '((((supports :underline (:style wave)))
872 :underline (:style wave :color "DarkOrange"))
875 "Face used for marking warning lines."
879 (defun flymake-highlight-line (line-no line-err-info-list)
880 "Highlight line LINE-NO in current buffer.
881 Perhaps use text from LINE-ERR-INFO-LIST to enhance highlighting."
882 (goto-char (point-min))
883 (forward-line (1- line-no))
884 (let* ((line-beg (point-at-bol))
885 (line-end (point-at-eol))
888 (tooltip-text (flymake-ler-text (nth 0 line-err-info-list)))
893 (while (looking-at "[ \t]")
899 (while (and (looking-at "[ \t\r\n]") (> (point) 1))
902 (setq end (1+ (point)))
913 (if (> (flymake-get-line-err-count line-err-info-list "e") 0)
914 (setq face 'flymake-errline
915 bitmap flymake-error-bitmap)
916 (setq face 'flymake-warnline
917 bitmap flymake-warning-bitmap))
919 (flymake-make-overlay beg end tooltip-text face bitmap nil)))
921 (defun flymake-parse-err-lines (err-info-list lines)
922 "Parse err LINES, store info in ERR-INFO-LIST."
923 (let* ((count (length lines))
927 (source-file-name buffer-file-name)
928 (get-real-file-name-f (flymake-get-real-file-name-function source-file-name)))
931 (setq line-err-info (flymake-parse-line (nth idx lines)))
933 (setq real-file-name (funcall get-real-file-name-f
934 (flymake-ler-file line-err-info)))
935 (setq line-err-info (flymake-ler-set-full-file line-err-info real-file-name))
937 (when (flymake-same-files real-file-name source-file-name)
938 (setq line-err-info (flymake-ler-set-file line-err-info nil))
939 (setq err-info-list (flymake-add-err-info err-info-list line-err-info))))
940 (flymake-log 3 "parsed '%s', %s line-err-info" (nth idx lines) (if line-err-info "got" "no"))
944 (defun flymake-split-output (output)
945 "Split OUTPUT into lines.
946 Return last one as residual if it does not end with newline char.
947 Returns ((LINES) RESIDUAL)."
948 (when (and output (> (length output) 0))
949 (let* ((lines (flymake-split-string output "[\n\r]+"))
950 (complete (equal "\n" (char-to-string (aref output (1- (length output))))))
953 (setq residual (car (last lines)))
954 (setq lines (butlast lines)))
955 (list lines residual))))
957 (defun flymake-reformat-err-line-patterns-from-compile-el (original-list)
958 "Grab error line patterns from ORIGINAL-LIST in compile.el format.
959 Convert it to flymake internal format."
960 (let* ((converted-list '()))
961 (dolist (item original-list)
962 (setq item (cdr item))
963 (let ((regexp (nth 0 item))
967 (if (consp file) (setq file (car file)))
968 (if (consp line) (setq line (car line)))
969 (if (consp col) (setq col (car col)))
971 (when (not (functionp line))
972 (setq converted-list (cons (list regexp file line col) converted-list)))))
977 (defvar flymake-err-line-patterns ; regexp file-idx line-idx col-idx (optional) text-idx(optional), match-end to end of string is error text
981 ("\\(\\([a-zA-Z]:\\)?[^:(\t\n]+\\)(\\([0-9]+\\)) \: \\(\\(error\\|warning\\|fatal error\\) \\(C[0-9]+\\):[ \t\n]*\\(.+\\)\\)"
984 ("\\(\\([a-zA-Z]:\\)?[^:(\t\n]+\\)\:\\([0-9]+\\)\:[0-9]+\:[0-9]+\:[0-9]+\: \\(\\(Error\\|Warning\\|Caution\\|Semantic Error\\):[ \t\n]*\\(.+\\)\\)"
987 ("midl[ ]*:[ ]*\\(command line error .*\\)"
990 ("\\(\\([a-zA-Z]:\\)?[^:(\t\n]+\\)(\\([0-9]+\\),[0-9]+)\: \\(\\(error\\|warning\\|fatal error\\) \\(CS[0-9]+\\):[ \t\n]*\\(.+\\)\\)"
993 ("\\(.*\\) at \\([^ \n]+\\) line \\([0-9]+\\)[,.\n]" 2 3 nil 1)
995 ("\\(?:Parse\\|Fatal\\) error: \\(.*\\) in \\(.*\\) on line \\([0-9]+\\)" 2 3 nil 1)
996 ;; LaTeX warnings (fileless) ("\\(LaTeX \\(Warning\\|Error\\): .*\\) on input line \\([0-9]+\\)" 20 3 nil 1)
997 ;; ant/javac. Note this also matches gcc warnings!
998 (" *\\(\\[javac\\] *\\)?\\(\\([a-zA-Z]:\\)?[^:(\t\n]+\\)\:\\([0-9]+\\)\\(?:\:[0-9]+\\)?\:[ \t\n]*\\(.+\\)"
1000 ;; compilation-error-regexp-alist)
1001 (flymake-reformat-err-line-patterns-from-compile-el compilation-error-regexp-alist-alist))
1002 "Patterns for matching error/warning lines. Each pattern has the form
1003 \(REGEXP FILE-IDX LINE-IDX COL-IDX ERR-TEXT-IDX).
1004 Use `flymake-reformat-err-line-patterns-from-compile-el' to add patterns
1007 ;;(defcustom flymake-err-line-patterns
1009 ;; ; MS Visual C++ 6.0
1010 ;; ("\\(\\([a-zA-Z]:\\)?[^:(\t\n]+\\)(\\([0-9]+\\)) \: \\(\\(error\\|warning\\|fatal error\\) \\(C[0-9]+\\):[ \t\n]*\\(.+\\)\\)"
1013 ;; ("\\(\\([a-zA-Z]:\\)?[^:(\t\n]+\\)\:\\([0-9]+\\)\:[0-9]+\:[0-9]+\:[0-9]+\: \\(\\(Error\\|Warning\\|Caution\\):[ \t\n]*\\(.+\\)\\)"
1015 ;; "patterns for matching error/warning lines, (regexp file-idx line-idx err-text-idx)"
1017 ;; :type '(repeat (string number number number))
1020 (defvar flymake-warning-re "^[wW]arning"
1021 "Regexp matching against err-text to detect a warning.")
1023 (defun flymake-parse-line (line)
1024 "Parse LINE to see if it is an error or warning.
1025 Return its components if so, nil otherwise."
1026 (let ((raw-file-name nil)
1030 (patterns flymake-err-line-patterns)
1032 (while (and patterns (not matched))
1033 (when (string-match (car (car patterns)) line)
1034 (let* ((file-idx (nth 1 (car patterns)))
1035 (line-idx (nth 2 (car patterns))))
1037 (setq raw-file-name (if file-idx (match-string file-idx line) nil))
1038 (setq line-no (if line-idx (string-to-number (match-string line-idx line)) 0))
1039 (setq err-text (if (> (length (car patterns)) 4)
1040 (match-string (nth 4 (car patterns)) line)
1041 (flymake-patch-err-text (substring line (match-end 0)))))
1042 (or err-text (setq err-text "<no error text>"))
1043 (if (and err-text (string-match flymake-warning-re err-text))
1046 (flymake-log 3 "parse line: file-idx=%s line-idx=%s file=%s line=%s text=%s" file-idx line-idx
1047 raw-file-name line-no err-text)
1049 (setq patterns (cdr patterns)))
1051 (flymake-ler-make-ler raw-file-name line-no err-type err-text)
1054 (defun flymake-find-err-info (err-info-list line-no)
1055 "Find (line-err-info-list pos) for specified LINE-NO."
1057 (let* ((line-err-info-list nil)
1059 (count (length err-info-list)))
1061 (while (and (< pos count) (< (car (nth pos err-info-list)) line-no))
1062 (setq pos (1+ pos)))
1063 (when (and (< pos count) (equal (car (nth pos err-info-list)) line-no))
1064 (setq line-err-info-list (flymake-er-get-line-err-info-list (nth pos err-info-list))))
1065 (list line-err-info-list pos))
1068 (defun flymake-line-err-info-is-less-or-equal (line-one line-two)
1069 (or (string< (flymake-ler-type line-one) (flymake-ler-type line-two))
1070 (and (string= (flymake-ler-type line-one) (flymake-ler-type line-two))
1071 (not (flymake-ler-file line-one)) (flymake-ler-file line-two))
1072 (and (string= (flymake-ler-type line-one) (flymake-ler-type line-two))
1073 (or (and (flymake-ler-file line-one) (flymake-ler-file line-two))
1074 (and (not (flymake-ler-file line-one)) (not (flymake-ler-file line-two)))))))
1076 (defun flymake-add-line-err-info (line-err-info-list line-err-info)
1077 "Update LINE-ERR-INFO-LIST with the error LINE-ERR-INFO.
1078 For the format of LINE-ERR-INFO, see `flymake-ler-make-ler'.
1079 The new element is inserted in the proper position, according to
1080 the predicate `flymake-line-err-info-is-less-or-equal'.
1081 The updated value of LINE-ERR-INFO-LIST is returned."
1082 (if (not line-err-info-list)
1083 (list line-err-info)
1084 (let* ((count (length line-err-info-list))
1086 (while (and (< idx count) (flymake-line-err-info-is-less-or-equal (nth idx line-err-info-list) line-err-info))
1087 (setq idx (1+ idx)))
1088 (cond ((equal 0 idx) (setq line-err-info-list (cons line-err-info line-err-info-list)))
1089 (t (setq line-err-info-list (flymake-ins-after line-err-info-list (1- idx) line-err-info))))
1090 line-err-info-list)))
1092 (defun flymake-add-err-info (err-info-list line-err-info)
1093 "Update ERR-INFO-LIST with the error LINE-ERR-INFO, preserving sort order.
1094 Returns the updated value of ERR-INFO-LIST.
1095 For the format of ERR-INFO-LIST, see `flymake-err-info'.
1096 For the format of LINE-ERR-INFO, see `flymake-ler-make-ler'."
1097 (let* ((line-no (if (flymake-ler-file line-err-info) 1 (flymake-ler-line line-err-info)))
1098 (info-and-pos (flymake-find-err-info err-info-list line-no))
1099 (exists (car info-and-pos))
1100 (pos (nth 1 info-and-pos))
1101 (line-err-info-list nil)
1105 (setq line-err-info-list (flymake-er-get-line-err-info-list (car (nthcdr pos err-info-list)))))
1106 (setq line-err-info-list (flymake-add-line-err-info line-err-info-list line-err-info))
1108 (setq err-info (flymake-er-make-er line-no line-err-info-list))
1109 (cond (exists (setq err-info-list (flymake-set-at err-info-list pos err-info)))
1110 ((equal 0 pos) (setq err-info-list (cons err-info err-info-list)))
1111 (t (setq err-info-list (flymake-ins-after err-info-list (1- pos) err-info))))
1114 (defun flymake-get-project-include-dirs-imp (basedir)
1115 "Include dirs for the project current file belongs to."
1116 (if (flymake-get-project-include-dirs-from-cache basedir)
1118 (flymake-get-project-include-dirs-from-cache basedir))
1120 (let* ((command-line (concat "make -C "
1121 (shell-quote-argument basedir)
1122 " DUMPVARS=INCLUDE_DIRS dumpvars"))
1123 (output (shell-command-to-string command-line))
1124 (lines (flymake-split-string output "\n"))
1125 (count (length lines))
1128 (while (and (< idx count) (not (string-match "^INCLUDE_DIRS=.*" (nth idx lines))))
1129 (setq idx (1+ idx)))
1131 (let* ((inc-lines (flymake-split-string (nth idx lines) " *-I"))
1132 (inc-count (length inc-lines)))
1133 (while (> inc-count 0)
1134 (when (not (string-match "^INCLUDE_DIRS=.*" (nth (1- inc-count) inc-lines)))
1135 (push (flymake-replace-regexp-in-string "\"" "" (nth (1- inc-count) inc-lines)) inc-dirs))
1136 (setq inc-count (1- inc-count)))))
1137 (flymake-add-project-include-dirs-to-cache basedir inc-dirs)
1140 (defcustom flymake-get-project-include-dirs-function 'flymake-get-project-include-dirs-imp
1141 "Function used to get project include dirs, one parameter: basedir name."
1145 (defun flymake-get-project-include-dirs (basedir)
1146 (funcall flymake-get-project-include-dirs-function basedir))
1148 (defun flymake-get-system-include-dirs ()
1149 "System include dirs - from the 'INCLUDE' env setting."
1150 (let* ((includes (getenv "INCLUDE")))
1151 (if includes (flymake-split-string includes path-separator) nil)))
1153 (defvar flymake-project-include-dirs-cache (flymake-makehash 'equal))
1155 (defun flymake-get-project-include-dirs-from-cache (base-dir)
1156 (gethash base-dir flymake-project-include-dirs-cache))
1158 (defun flymake-add-project-include-dirs-to-cache (base-dir include-dirs)
1159 (puthash base-dir include-dirs flymake-project-include-dirs-cache))
1161 (defun flymake-clear-project-include-dirs-cache ()
1162 (clrhash flymake-project-include-dirs-cache))
1164 (defun flymake-get-include-dirs (base-dir)
1165 "Get dirs to use when resolving local file names."
1166 (let* ((include-dirs (append '(".") (flymake-get-project-include-dirs base-dir) (flymake-get-system-include-dirs))))
1169 ;; (defun flymake-restore-formatting ()
1170 ;; "Remove any formatting made by flymake."
1173 ;; (defun flymake-get-program-dir (buffer)
1174 ;; "Get dir to start program in."
1175 ;; (unless (bufferp buffer)
1176 ;; (error "Invalid buffer"))
1177 ;; (with-current-buffer buffer
1178 ;; default-directory))
1180 (defun flymake-safe-delete-file (file-name)
1181 (when (and file-name (file-exists-p file-name))
1182 (delete-file file-name)
1183 (flymake-log 1 "deleted file %s" file-name)))
1185 (defun flymake-safe-delete-directory (dir-name)
1188 (delete-directory dir-name)
1189 (flymake-log 1 "deleted dir %s" dir-name))
1191 (flymake-log 1 "Failed to delete dir %s, error ignored" dir-name))))
1193 (defcustom flymake-compilation-prevents-syntax-check t
1194 "If non-nil, don't start syntax check if compilation is running."
1198 (defun flymake-start-syntax-check ()
1199 "Start syntax checking for current buffer."
1201 (flymake-log 3 "flymake is running: %s" flymake-is-running)
1202 (when (and (not flymake-is-running)
1203 (flymake-can-syntax-check-file buffer-file-name))
1204 (when (or (not flymake-compilation-prevents-syntax-check)
1205 (not (flymake-compilation-is-running))) ;+ (flymake-rep-ort-status buffer "COMP")
1206 (flymake-clear-buildfile-cache)
1207 (flymake-clear-project-include-dirs-cache)
1209 (setq flymake-check-was-interrupted nil)
1211 (let* ((source-file-name buffer-file-name)
1212 (init-f (flymake-get-init-function source-file-name))
1213 (cleanup-f (flymake-get-cleanup-function source-file-name))
1214 (cmd-and-args (funcall init-f))
1215 (cmd (nth 0 cmd-and-args))
1216 (args (nth 1 cmd-and-args))
1217 (dir (nth 2 cmd-and-args)))
1218 (if (not cmd-and-args)
1220 (flymake-log 0 "init function %s for %s failed, cleaning up" init-f source-file-name)
1221 (funcall cleanup-f))
1223 (setq flymake-last-change-time nil)
1224 (flymake-start-syntax-check-process cmd args dir)))))))
1226 (defun flymake-start-syntax-check-process (cmd args dir)
1227 "Start syntax check process."
1230 (let ((default-directory (or dir default-directory)))
1232 (flymake-log 3 "starting process on dir %s" dir))
1233 (apply 'start-file-process
1234 "flymake-proc" (current-buffer) cmd args))))
1235 (set-process-sentinel process 'flymake-process-sentinel)
1236 (set-process-filter process 'flymake-process-filter)
1237 (push process flymake-processes)
1239 (setq flymake-is-running t)
1240 (setq flymake-last-change-time nil)
1241 (setq flymake-check-start-time (flymake-float-time))
1243 (flymake-report-status nil "*")
1244 (flymake-log 2 "started process %d, command=%s, dir=%s"
1245 (process-id process) (process-command process)
1249 (let* ((err-str (format "Failed to launch syntax check process '%s' with args %s: %s"
1250 cmd args (error-message-string err)))
1251 (source-file-name buffer-file-name)
1252 (cleanup-f (flymake-get-cleanup-function source-file-name)))
1253 (flymake-log 0 err-str)
1255 (flymake-report-fatal-status "PROCERR" err-str)))))
1257 (defun flymake-kill-process (proc)
1258 "Kill process PROC."
1260 (let* ((buf (process-buffer proc)))
1261 (when (buffer-live-p buf)
1262 (with-current-buffer buf
1263 (setq flymake-check-was-interrupted t))))
1264 (flymake-log 1 "killed process %d" (process-id proc)))
1266 (defun flymake-stop-all-syntax-checks ()
1267 "Kill all syntax check processes."
1269 (while flymake-processes
1270 (flymake-kill-process (pop flymake-processes))))
1272 (defun flymake-compilation-is-running ()
1273 (and (boundp 'compilation-in-progress)
1274 compilation-in-progress))
1276 (defun flymake-compile ()
1277 "Kill all flymake syntax checks, start compilation."
1279 (flymake-stop-all-syntax-checks)
1280 (call-interactively 'compile))
1282 (defcustom flymake-no-changes-timeout 0.5
1283 "Time to wait after last change before starting compilation."
1287 (defun flymake-on-timer-event (buffer)
1288 "Start a syntax check for buffer BUFFER if necessary."
1289 (when (buffer-live-p buffer)
1290 (with-current-buffer buffer
1291 (when (and (not flymake-is-running)
1292 flymake-last-change-time
1293 (> (- (flymake-float-time) flymake-last-change-time)
1294 flymake-no-changes-timeout))
1296 (setq flymake-last-change-time nil)
1297 (flymake-log 3 "starting syntax check as more than 1 second passed since last change")
1298 (flymake-start-syntax-check)))))
1300 (defun flymake-current-line-no ()
1301 "Return number of current line in current buffer."
1302 (count-lines (point-min) (if (eobp) (point) (1+ (point)))))
1304 (defun flymake-count-lines ()
1305 "Return number of lines in buffer BUFFER."
1306 (count-lines (point-min) (point-max)))
1308 (defun flymake-display-err-menu-for-current-line ()
1309 "Display a menu with errors/warnings for current line if it has errors and/or warnings."
1311 (let* ((line-no (flymake-current-line-no))
1312 (line-err-info-list (nth 0 (flymake-find-err-info flymake-err-info line-no)))
1313 (menu-data (flymake-make-err-menu-data line-no line-err-info-list))
1317 (setq choice (flymake-popup-menu menu-data))
1318 (flymake-log 3 "choice=%s" choice)
1321 (flymake-log 1 "no errors for line %d" line-no))))
1323 (defun flymake-make-err-menu-data (line-no line-err-info-list)
1324 "Make a (menu-title (item-title item-action)*) list with errors/warnings from LINE-ERR-INFO-LIST."
1325 (let* ((menu-items nil))
1326 (when line-err-info-list
1327 (let* ((count (length line-err-info-list))
1328 (menu-item-text nil))
1330 (setq menu-item-text (flymake-ler-text (nth (1- count) line-err-info-list)))
1331 (let* ((file (flymake-ler-file (nth (1- count) line-err-info-list)))
1332 (full-file (flymake-ler-full-file (nth (1- count) line-err-info-list)))
1333 (line (flymake-ler-line (nth (1- count) line-err-info-list))))
1335 (setq menu-item-text (concat menu-item-text " - " file "(" (format "%d" line) ")")))
1336 (setq menu-items (cons (list menu-item-text
1337 (if file (list 'flymake-goto-file-and-line full-file line) nil))
1339 (setq count (1- count)))
1340 (flymake-log 3 "created menu-items with %d item(s)" (length menu-items))))
1342 (let* ((menu-title (format "Line %d: %d error(s), %d warning(s)" line-no
1343 (flymake-get-line-err-count line-err-info-list "e")
1344 (flymake-get-line-err-count line-err-info-list "w"))))
1345 (list menu-title menu-items))
1348 (defun flymake-goto-file-and-line (file line)
1349 "Try to get buffer for FILE and goto line LINE in it."
1350 (if (not (file-exists-p file))
1351 (flymake-log 1 "File %s does not exist" file)
1353 (goto-char (point-min))
1354 (forward-line (1- line))))
1356 ;; flymake minor mode declarations
1357 (defvar flymake-mode-line nil)
1359 (make-variable-buffer-local 'flymake-mode-line)
1361 (defvar flymake-mode-line-e-w nil)
1363 (make-variable-buffer-local 'flymake-mode-line-e-w)
1365 (defvar flymake-mode-line-status nil)
1367 (make-variable-buffer-local 'flymake-mode-line-status)
1369 (defun flymake-report-status (e-w &optional status)
1370 "Show status in mode line."
1372 (setq flymake-mode-line-e-w e-w))
1374 (setq flymake-mode-line-status status))
1375 (let* ((mode-line " Flymake"))
1376 (when (> (length flymake-mode-line-e-w) 0)
1377 (setq mode-line (concat mode-line ":" flymake-mode-line-e-w)))
1378 (setq mode-line (concat mode-line flymake-mode-line-status))
1379 (setq flymake-mode-line mode-line)
1380 (force-mode-line-update)))
1382 (defun flymake-display-warning (warning)
1383 "Display a warning to user."
1384 (message-box warning))
1386 (defcustom flymake-gui-warnings-enabled t
1387 "Enables/disables GUI warnings."
1391 (defun flymake-report-fatal-status (status warning)
1392 "Display a warning and switch flymake mode off."
1393 (when flymake-gui-warnings-enabled
1394 (flymake-display-warning (format "Flymake: %s. Flymake will be switched OFF" warning))
1397 (flymake-log 0 "switched OFF Flymake mode for buffer %s due to fatal status %s, warning %s"
1398 (buffer-name) status warning))
1400 (defcustom flymake-start-syntax-check-on-find-file t
1401 "Start syntax check on find file."
1406 (define-minor-mode flymake-mode
1407 "Toggle on-the-fly syntax checking.
1408 With a prefix argument ARG, enable the mode if ARG is positive,
1409 and disable it otherwise. If called from Lisp, enable the mode
1410 if ARG is omitted or nil."
1411 :group 'flymake :lighter flymake-mode-line
1414 ;; Turning the mode ON.
1417 ((not buffer-file-name)
1418 (message "Flymake unable to run without a buffer file name"))
1419 ((not (flymake-can-syntax-check-file buffer-file-name))
1420 (flymake-log 2 "flymake cannot check syntax in buffer %s" (buffer-name)))
1422 (add-hook 'after-change-functions 'flymake-after-change-function nil t)
1423 (add-hook 'after-save-hook 'flymake-after-save-hook nil t)
1424 (add-hook 'kill-buffer-hook 'flymake-kill-buffer-hook nil t)
1425 ;;+(add-hook 'find-file-hook 'flymake-find-file-hook)
1427 (flymake-report-status "" "")
1430 (run-at-time nil 1 'flymake-on-timer-event (current-buffer)))
1432 (when (and flymake-start-syntax-check-on-find-file
1433 ;; Since we write temp files in current dir, there's no point
1434 ;; trying if the directory is read-only (bug#8954).
1435 (file-writable-p (file-name-directory buffer-file-name)))
1436 (with-demoted-errors
1437 (flymake-start-syntax-check))))))
1439 ;; Turning the mode OFF.
1441 (remove-hook 'after-change-functions 'flymake-after-change-function t)
1442 (remove-hook 'after-save-hook 'flymake-after-save-hook t)
1443 (remove-hook 'kill-buffer-hook 'flymake-kill-buffer-hook t)
1444 ;;+(remove-hook 'find-file-hook (function flymake-find-file-hook) t)
1446 (flymake-delete-own-overlays)
1449 (cancel-timer flymake-timer)
1450 (setq flymake-timer nil))
1452 (setq flymake-is-running nil))))
1455 (defun flymake-mode-on ()
1456 "Turn flymake mode on."
1458 (flymake-log 1 "flymake mode turned ON for buffer %s" (buffer-name)))
1461 (defun flymake-mode-off ()
1462 "Turn flymake mode off."
1464 (flymake-log 1 "flymake mode turned OFF for buffer %s" (buffer-name)))
1466 (defcustom flymake-start-syntax-check-on-newline t
1467 "Start syntax check if newline char was added/removed from the buffer."
1471 (defun flymake-after-change-function (start stop _len)
1472 "Start syntax check for current buffer if it isn't already running."
1473 ;;+(flymake-log 0 "setting change time to %s" (flymake-float-time))
1474 (let((new-text (buffer-substring start stop)))
1475 (when (and flymake-start-syntax-check-on-newline (equal new-text "\n"))
1476 (flymake-log 3 "starting syntax check as new-line has been seen")
1477 (flymake-start-syntax-check))
1478 (setq flymake-last-change-time (flymake-float-time))))
1480 (defun flymake-after-save-hook ()
1481 (if (local-variable-p 'flymake-mode (current-buffer)) ; (???) other way to determine whether flymake is active in buffer being saved?
1483 (flymake-log 3 "starting syntax check as buffer was saved")
1484 (flymake-start-syntax-check)))) ; no more mode 3. cannot start check if mode 3 (to temp copies) is active - (???)
1486 (defun flymake-kill-buffer-hook ()
1488 (cancel-timer flymake-timer)
1489 (setq flymake-timer nil)))
1492 (defun flymake-find-file-hook ()
1493 ;;+(when flymake-start-syntax-check-on-find-file
1494 ;;+ (flymake-log 3 "starting syntax check on file open")
1495 ;;+ (flymake-start-syntax-check)
1497 (when (and (not (local-variable-p 'flymake-mode (current-buffer)))
1498 (flymake-can-syntax-check-file buffer-file-name))
1500 (flymake-log 3 "automatically turned ON flymake mode")))
1502 (defun flymake-get-first-err-line-no (err-info-list)
1503 "Return first line with error."
1505 (flymake-er-get-line (car err-info-list))))
1507 (defun flymake-get-last-err-line-no (err-info-list)
1508 "Return last line with error."
1510 (flymake-er-get-line (nth (1- (length err-info-list)) err-info-list))))
1512 (defun flymake-get-next-err-line-no (err-info-list line-no)
1513 "Return next line with error."
1515 (let* ((count (length err-info-list))
1517 (while (and (< idx count) (>= line-no (flymake-er-get-line (nth idx err-info-list))))
1518 (setq idx (1+ idx)))
1520 (flymake-er-get-line (nth idx err-info-list))))))
1522 (defun flymake-get-prev-err-line-no (err-info-list line-no)
1523 "Return previous line with error."
1525 (let* ((count (length err-info-list)))
1526 (while (and (> count 0) (<= line-no (flymake-er-get-line (nth (1- count) err-info-list))))
1527 (setq count (1- count)))
1529 (flymake-er-get-line (nth (1- count) err-info-list))))))
1531 (defun flymake-skip-whitespace ()
1532 "Move forward until non-whitespace is reached."
1533 (while (looking-at "[ \t]")
1536 (defun flymake-goto-line (line-no)
1537 "Go to line LINE-NO, then skip whitespace."
1538 (goto-char (point-min))
1539 (forward-line (1- line-no))
1540 (flymake-skip-whitespace))
1542 (defun flymake-goto-next-error ()
1543 "Go to next error in err ring."
1545 (let ((line-no (flymake-get-next-err-line-no flymake-err-info (flymake-current-line-no))))
1547 (setq line-no (flymake-get-first-err-line-no flymake-err-info))
1548 (flymake-log 1 "passed end of file"))
1550 (flymake-goto-line line-no)
1551 (flymake-log 1 "no errors in current buffer"))))
1553 (defun flymake-goto-prev-error ()
1554 "Go to previous error in err ring."
1556 (let ((line-no (flymake-get-prev-err-line-no flymake-err-info (flymake-current-line-no))))
1558 (setq line-no (flymake-get-last-err-line-no flymake-err-info))
1559 (flymake-log 1 "passed beginning of file"))
1561 (flymake-goto-line line-no)
1562 (flymake-log 1 "no errors in current buffer"))))
1564 (defun flymake-patch-err-text (string)
1565 (if (string-match "^[\n\t :0-9]*\\(.*\\)$" string)
1566 (match-string 1 string)
1569 ;;;; general init-cleanup and helper routines
1570 (defun flymake-create-temp-inplace (file-name prefix)
1571 (unless (stringp file-name)
1572 (error "Invalid file-name"))
1574 (setq prefix "flymake"))
1575 (let* ((ext (file-name-extension file-name))
1576 (temp-name (file-truename
1577 (concat (file-name-sans-extension file-name)
1579 (and ext (concat "." ext))))))
1580 (flymake-log 3 "create-temp-inplace: file=%s temp=%s" file-name temp-name)
1583 (defun flymake-create-temp-with-folder-structure (file-name _prefix)
1584 (unless (stringp file-name)
1585 (error "Invalid file-name"))
1587 (let* ((dir (file-name-directory file-name))
1588 ;; Not sure what this slash-pos is all about, but I guess it's just
1589 ;; trying to remove the leading / of absolute file names.
1590 (slash-pos (string-match "/" dir))
1591 (temp-dir (expand-file-name (substring dir (1+ slash-pos))
1592 (flymake-get-temp-dir))))
1594 (file-truename (expand-file-name (file-name-nondirectory file-name)
1597 (defun flymake-delete-temp-directory (dir-name)
1598 "Attempt to delete temp dir created by `flymake-create-temp-with-folder-structure', do not fail on error."
1599 (let* ((temp-dir (flymake-get-temp-dir))
1600 (suffix (substring dir-name (1+ (length temp-dir)))))
1602 (while (> (length suffix) 0)
1603 (setq suffix (directory-file-name suffix))
1604 ;;+(flymake-log 0 "suffix=%s" suffix)
1605 (flymake-safe-delete-directory
1606 (file-truename (expand-file-name suffix temp-dir)))
1607 (setq suffix (file-name-directory suffix)))))
1609 (defvar flymake-temp-source-file-name nil)
1610 (make-variable-buffer-local 'flymake-temp-source-file-name)
1612 (defvar flymake-master-file-name nil)
1613 (make-variable-buffer-local 'flymake-master-file-name)
1615 (defvar flymake-temp-master-file-name nil)
1616 (make-variable-buffer-local 'flymake-temp-master-file-name)
1618 (defvar flymake-base-dir nil)
1619 (make-variable-buffer-local 'flymake-base-dir)
1621 (defun flymake-init-create-temp-buffer-copy (create-temp-f)
1622 "Make a temporary copy of the current buffer, save its name in buffer data and return the name."
1623 (let* ((source-file-name buffer-file-name)
1624 (temp-source-file-name (funcall create-temp-f source-file-name "flymake")))
1626 (flymake-save-buffer-in-file temp-source-file-name)
1627 (setq flymake-temp-source-file-name temp-source-file-name)
1628 temp-source-file-name))
1630 (defun flymake-simple-cleanup ()
1631 "Do cleanup after `flymake-init-create-temp-buffer-copy'.
1633 (flymake-safe-delete-file flymake-temp-source-file-name)
1634 (setq flymake-last-change-time nil))
1636 (defun flymake-get-real-file-name (file-name-from-err-msg)
1637 "Translate file name from error message to \"real\" file name.
1638 Return full-name. Names are real, not patched."
1639 (let* ((real-name nil)
1640 (source-file-name buffer-file-name)
1641 (master-file-name flymake-master-file-name)
1642 (temp-source-file-name flymake-temp-source-file-name)
1643 (temp-master-file-name flymake-temp-master-file-name)
1645 (list flymake-base-dir
1646 (file-name-directory source-file-name)
1647 (if master-file-name (file-name-directory master-file-name))))
1648 (files (list (list source-file-name source-file-name)
1649 (list temp-source-file-name source-file-name)
1650 (list master-file-name master-file-name)
1651 (list temp-master-file-name master-file-name))))
1653 (when (equal 0 (length file-name-from-err-msg))
1654 (setq file-name-from-err-msg source-file-name))
1656 (setq real-name (flymake-get-full-patched-file-name file-name-from-err-msg base-dirs files))
1657 ;; if real-name is nil, than file name from err msg is none of the files we've patched
1659 (setq real-name (flymake-get-full-nonpatched-file-name file-name-from-err-msg base-dirs)))
1661 (setq real-name file-name-from-err-msg))
1662 (setq real-name (flymake-fix-file-name real-name))
1663 (flymake-log 3 "get-real-file-name: file-name=%s real-name=%s" file-name-from-err-msg real-name)
1666 (defun flymake-get-full-patched-file-name (file-name-from-err-msg base-dirs files)
1667 (let* ((base-dirs-count (length base-dirs))
1668 (file-count (length files))
1671 (while (and (not real-name) (> base-dirs-count 0))
1672 (setq file-count (length files))
1673 (while (and (not real-name) (> file-count 0))
1674 (let* ((this-dir (nth (1- base-dirs-count) base-dirs))
1675 (this-file (nth 0 (nth (1- file-count) files)))
1676 (this-real-name (nth 1 (nth (1- file-count) files))))
1677 ;;+(flymake-log 0 "this-dir=%s this-file=%s this-real=%s msg-file=%s" this-dir this-file this-real-name file-name-from-err-msg)
1678 (when (and this-dir this-file (flymake-same-files
1679 (expand-file-name file-name-from-err-msg this-dir)
1681 (setq real-name this-real-name)))
1682 (setq file-count (1- file-count)))
1683 (setq base-dirs-count (1- base-dirs-count)))
1686 (defun flymake-get-full-nonpatched-file-name (file-name-from-err-msg base-dirs)
1687 (let* ((real-name nil))
1688 (if (file-name-absolute-p file-name-from-err-msg)
1689 (setq real-name file-name-from-err-msg)
1690 (let* ((base-dirs-count (length base-dirs)))
1691 (while (and (not real-name) (> base-dirs-count 0))
1692 (let* ((full-name (expand-file-name file-name-from-err-msg
1693 (nth (1- base-dirs-count) base-dirs))))
1694 (if (file-exists-p full-name)
1695 (setq real-name full-name))
1696 (setq base-dirs-count (1- base-dirs-count))))))
1699 (defun flymake-init-find-buildfile-dir (source-file-name buildfile-name)
1700 "Find buildfile, store its dir in buffer data and return its dir, if found."
1701 (let* ((buildfile-dir
1702 (flymake-find-buildfile buildfile-name
1703 (file-name-directory source-file-name))))
1705 (setq flymake-base-dir buildfile-dir)
1706 (flymake-log 1 "no buildfile (%s) for %s" buildfile-name source-file-name)
1707 (flymake-report-fatal-status
1708 "NOMK" (format "No buildfile (%s) found for %s"
1709 buildfile-name source-file-name)))))
1711 (defun flymake-init-create-temp-source-and-master-buffer-copy (get-incl-dirs-f create-temp-f master-file-masks include-regexp)
1712 "Find master file (or buffer), create its copy along with a copy of the source file."
1713 (let* ((source-file-name buffer-file-name)
1714 (temp-source-file-name (flymake-init-create-temp-buffer-copy create-temp-f))
1715 (master-and-temp-master (flymake-create-master-file
1716 source-file-name temp-source-file-name
1717 get-incl-dirs-f create-temp-f
1718 master-file-masks include-regexp)))
1720 (if (not master-and-temp-master)
1722 (flymake-log 1 "cannot find master file for %s" source-file-name)
1723 (flymake-report-status "!" "") ; NOMASTER
1725 (setq flymake-master-file-name (nth 0 master-and-temp-master))
1726 (setq flymake-temp-master-file-name (nth 1 master-and-temp-master)))))
1728 (defun flymake-master-cleanup ()
1729 (flymake-simple-cleanup)
1730 (flymake-safe-delete-file flymake-temp-master-file-name))
1732 ;;;; make-specific init-cleanup routines
1733 (defun flymake-get-syntax-check-program-args (source-file-name base-dir use-relative-base-dir use-relative-source get-cmd-line-f)
1734 "Create a command line for syntax check using GET-CMD-LINE-F."
1735 (funcall get-cmd-line-f
1736 (if use-relative-source
1737 (file-relative-name source-file-name base-dir)
1739 (if use-relative-base-dir
1740 (file-relative-name base-dir
1741 (file-name-directory source-file-name))
1744 (defun flymake-get-make-cmdline (source base-dir)
1749 (concat "CHK_SOURCES=" source)
1750 "SYNTAX_CHECK_MODE=1"
1753 (defun flymake-get-ant-cmdline (source base-dir)
1756 (concat base-dir "/" "build.xml")
1757 (concat "-DCHK_SOURCES=" source)
1760 (defun flymake-simple-make-init-impl (create-temp-f use-relative-base-dir use-relative-source build-file-name get-cmdline-f)
1761 "Create syntax check command line for a directly checked source file.
1762 Use CREATE-TEMP-F for creating temp copy."
1764 (source-file-name buffer-file-name)
1765 (buildfile-dir (flymake-init-find-buildfile-dir source-file-name build-file-name)))
1767 (let* ((temp-source-file-name (flymake-init-create-temp-buffer-copy create-temp-f)))
1768 (setq args (flymake-get-syntax-check-program-args temp-source-file-name buildfile-dir
1769 use-relative-base-dir use-relative-source
1773 (defun flymake-simple-make-init ()
1774 (flymake-simple-make-init-impl 'flymake-create-temp-inplace t t "Makefile" 'flymake-get-make-cmdline))
1776 (defun flymake-master-make-init (get-incl-dirs-f master-file-masks include-regexp)
1777 "Create make command line for a source file checked via master file compilation."
1778 (let* ((make-args nil)
1779 (temp-master-file-name (flymake-init-create-temp-source-and-master-buffer-copy
1780 get-incl-dirs-f 'flymake-create-temp-inplace
1781 master-file-masks include-regexp)))
1782 (when temp-master-file-name
1783 (let* ((buildfile-dir (flymake-init-find-buildfile-dir temp-master-file-name "Makefile")))
1785 (setq make-args (flymake-get-syntax-check-program-args
1786 temp-master-file-name buildfile-dir nil nil 'flymake-get-make-cmdline)))))
1789 (defun flymake-find-make-buildfile (source-dir)
1790 (flymake-find-buildfile "Makefile" source-dir))
1792 ;;;; .h/make specific
1793 (defun flymake-master-make-header-init ()
1794 (flymake-master-make-init
1795 'flymake-get-include-dirs
1796 '("\\.\\(?:c\\(?:pp\\|xx\\|\\+\\+\\)?\\|CC\\)\\'")
1797 "[ \t]*#[ \t]*include[ \t]*\"\\([[:word:]0-9/\\_.]*%s\\)\""))
1799 ;;;; .java/make specific
1800 (defun flymake-simple-make-java-init ()
1801 (flymake-simple-make-init-impl 'flymake-create-temp-with-folder-structure nil nil "Makefile" 'flymake-get-make-cmdline))
1803 (defun flymake-simple-ant-java-init ()
1804 (flymake-simple-make-init-impl 'flymake-create-temp-with-folder-structure nil nil "build.xml" 'flymake-get-ant-cmdline))
1806 (defun flymake-simple-java-cleanup ()
1807 "Cleanup after `flymake-simple-make-java-init' -- delete temp file and dirs."
1808 (flymake-safe-delete-file flymake-temp-source-file-name)
1809 (when flymake-temp-source-file-name
1810 (flymake-delete-temp-directory
1811 (file-name-directory flymake-temp-source-file-name))))
1813 ;;;; perl-specific init-cleanup routines
1814 (defun flymake-perl-init ()
1815 (let* ((temp-file (flymake-init-create-temp-buffer-copy
1816 'flymake-create-temp-inplace))
1817 (local-file (file-relative-name
1819 (file-name-directory buffer-file-name))))
1820 (list "perl" (list "-wc " local-file))))
1822 ;;;; php-specific init-cleanup routines
1823 (defun flymake-php-init ()
1824 (let* ((temp-file (flymake-init-create-temp-buffer-copy
1825 'flymake-create-temp-inplace))
1826 (local-file (file-relative-name
1828 (file-name-directory buffer-file-name))))
1829 (list "php" (list "-f" local-file "-l"))))
1831 ;;;; tex-specific init-cleanup routines
1832 (defun flymake-get-tex-args (file-name)
1833 ;;(list "latex" (list "-c-style-errors" file-name))
1834 (list "texify" (list "--pdf" "--tex-option=-c-style-errors" file-name)))
1836 (defun flymake-simple-tex-init ()
1837 (flymake-get-tex-args (flymake-init-create-temp-buffer-copy 'flymake-create-temp-inplace)))
1839 ;; Perhaps there should be a buffer-local variable flymake-master-file
1840 ;; that people can set to override this stuff. Could inherit from
1841 ;; the similar AUCTeX variable.
1842 (defun flymake-master-tex-init ()
1843 (let* ((temp-master-file-name (flymake-init-create-temp-source-and-master-buffer-copy
1844 'flymake-get-include-dirs-dot 'flymake-create-temp-inplace
1846 "[ \t]*\\in\\(?:put\\|clude\\)[ \t]*{\\(.*%s\\)}")))
1847 (when temp-master-file-name
1848 (flymake-get-tex-args temp-master-file-name))))
1850 (defun flymake-get-include-dirs-dot (_base-dir)
1853 ;;;; xml-specific init-cleanup routines
1854 (defun flymake-xml-init ()
1855 (list "xml" (list "val" (flymake-init-create-temp-buffer-copy 'flymake-create-temp-inplace))))
1859 ;;; flymake.el ends here