Add 2009 to copyright years.
[emacs.git] / doc / misc / flymake.texi
blobe886e7fa0996e38d9d5ae1ad7a4ea3ff7b6169cc
1 \input texinfo   @c -*-texinfo-*-
2 @comment %**start of header
3 @setfilename ../../info/flymake
4 @set VERSION 0.3
5 @set UPDATED April 2004
6 @settitle GNU Flymake @value{VERSION}
7 @syncodeindex pg cp
8 @comment %**end of header
10 @copying
11 This manual is for GNU Flymake (version @value{VERSION}, @value{UPDATED}),
12 which is a universal on-the-fly syntax checker for GNU Emacs.
14 Copyright @copyright{} 2004, 2005, 2006, 2007, 2008, 2009 Free Software
15 Foundation, Inc.
17 @quotation
18 Permission is granted to copy, distribute and/or modify this document
19 under the terms of the GNU Free Documentation License, Version 1.3 or
20 any later version published by the Free Software Foundation; with no
21 Invariant Sections, with the Front-Cover texts being ``A GNU Manual,''
22 and with the Back-Cover Texts as in (a) below.  A copy of the license
23 is included in the section entitled ``GNU Free Documentation License''.
25 (a) The FSF's Back-Cover Text is: ``You have the freedom to copy and
26 modify this GNU manual.  Buying copies from the FSF supports it in
27 developing GNU and promoting software freedom.''
28 @end quotation
29 @end copying
31 @dircategory Emacs
32 @direntry
33 * Flymake: (flymake). A universal on-the-fly syntax checker.
34 @end direntry
36 @titlepage
37 @title GNU Flymake
38 @subtitle for version @value{VERSION}, @value{UPDATED}
39 @author Pavel Kobiakov(@email{pk_at_work@@yahoo.com})
40 @page
41 @vskip 0pt plus 1filll
42 @insertcopying
43 @end titlepage
45 @contents
47 @ifnottex
48 @node Top
49 @top GNU Flymake
50 @end ifnottex
52 @menu
53 * Overview of Flymake::
54 * Installing Flymake::
55 * Using Flymake::
56 * Configuring Flymake::
57 * Flymake Implementation::
58 * GNU Free Documentation License::
59 * Index::
60 @end menu
62 @node Overview of Flymake
63 @chapter Overview
64 @cindex Overview of Flymake
66 Flymake is a universal on-the-fly syntax checker implemented as an
67 Emacs minor mode. Flymake runs the pre-configured syntax check tool
68 (compiler for C++ files, @code{perl} for perl files, etc.) in the
69 background, passing it a temporary copy of the current buffer, and
70 parses the output for known error/warning message patterns. Flymake
71 then highlights erroneous lines (i.e. lines for which at least one
72 error or warning has been reported by the syntax check tool), and
73 displays an overall buffer status in the mode line. Status information
74 displayed by Flymake contains total number of errors and warnings
75 reported for the buffer during the last syntax check.
77 @code{flymake-goto-next-error} and @code{flymake-goto-prev-error}
78 functions allow for easy navigation to the next/previous erroneous
79 line, respectively.
81 Calling @code{flymake-display-err-menu-for-current-line} will popup a
82 menu containing error messages reported by the syntax check tool for
83 the current line. Errors/warnings belonging to another file, such as a
84 @code{.h} header file included by a @code{.c} file, are shown in the
85 current buffer as belonging to the first line. Menu items for such
86 messages also contain a filename and a line number. Selecting such a
87 menu item will automatically open the file and jump to the line with
88 error.
90 Syntax check is done 'on-the-fly'. It is started whenever
92 @itemize @bullet
93 @item buffer is loaded
94 @item a newline character is added to the buffer
95 @item some changes were made to the buffer more than @code{0.5} seconds ago (the
96 delay is configurable).
97 @end itemize
99 Flymake is a universal syntax checker in the sense that it's easily
100 extended to support new syntax check tools and error message
101 patterns. @xref{Configuring Flymake}.
103 @node Installing Flymake
104 @chapter Installing
105 @cindex Installing Flymake
108 Flymake is packaged in a single file, @code{flymake.el}.
110 To install/update Flymake, place @code{flymake.el} to a directory
111 somewhere on Emacs load path. You might also want to byte-compile
112 @code{flymake.el} to improve performance.
114 Also, place the following line in the @code{.emacs} file.
116 @lisp
117 (require 'flymake)
118 @end lisp
120 You might also map the most frequently used Flymake functions, such as
121 @code{flymake-goto-next-error}, to some keyboard shortcuts:
123 @lisp
124 (global-set-key [f3] 'flymake-display-err-menu-for-current-line)
125 (global-set-key [f4] 'flymake-goto-next-error)
126 @end lisp
128 @node Using Flymake
129 @chapter Using Flymake
130 @cindex Using Flymake
132 @menu
133 * Flymake mode::
134 * Running the syntax check::
135 * Navigating to error lines::
136 * Viewing error messages::
137 * Syntax check statuses::
138 * Troubleshooting::
139 @end menu
141 @node Flymake mode
142 @section Flymake mode
143 @cindex flymake-mode
145 Flymake is an Emacs minor mode. To use Flymake, you
146 must first activate @code{flymake-mode} by using the
147 @code{flymake-mode} function.
149 Instead of manually activating @code{flymake-mode}, you can configure
150 Flymake to automatically enable @code{flymake-mode} upon opening any
151 file for which syntax check is possible. To do so, place the following
152 line in @code{.emacs}:
154 @lisp
155 (add-hook 'find-file-hook 'flymake-find-file-hook)
156 @end lisp
158 @node Running the syntax check
159 @section Running the syntax check
160 @cindex Manually starting the syntax check
162 When @code{flymake-mode} is active, syntax check is started
163 automatically on any of the three conditions mentioned above. Syntax
164 check can also be started manually by using the
165 @code{flymake-start-syntax-check-for-current-buffer} function. This
166 can be used, for example, when changes were made to some other buffer
167 affecting the current buffer.
169 @node Navigating to error lines
170 @section Navigating to error lines
171 @cindex Navigating to error lines
173 After syntax check is completed, lines for which at least one error or
174 warning has been reported are highlighted, and total number of errors
175 and warning is shown in the mode line. Use the following functions to
176 navigate the highlighted lines.
178 @multitable @columnfractions 0.25 0.75
180 @item @code{flymake-goto-next-error}
181 @tab Moves point to the next erroneous line, if any.
183 @item @code{flymake-goto-prev-error}
184 @tab Moves point to the previous erroneous line.
186 @end multitable
188 These functions treat erroneous lines as a linked list. Therefore,
189 @code{flymake-goto-next-error} will go to the first erroneous line
190 when invoked in the end of the buffer.
192 @node Viewing error messages
193 @section Viewing error messages
194 @cindex Viewing error messages
196 To view error messages belonging to the current line, use the
197 @code{flymake-display-err-menu-for-current-line} function. If there's
198 at least one error or warning reported for the current line, this
199 function will display a popup menu with error/warning texts.
200 Selecting the menu item whose error belongs to another file brings
201 forward that file with the help of the
202 @code{flymake-goto-file-and-line} function.
204 @node Syntax check statuses
205 @section Syntax check statuses
206 @cindex Syntax check statuses
208 After syntax check is finished, its status is displayed in the mode line.
209 The following statuses are defined.
211 @multitable @columnfractions 0.25 0.75
212 @item Flymake* or Flymake:E/W*
213 @tab  Flymake is currently running. For the second case, E/W contains the
214       error and warning count for the previous run.
216 @item Flymake
217 @tab  Syntax check is not running. Usually this means syntax check was
218       successfully passed (no errors, no warnings). Other possibilities are:
219       syntax check was killed as a result of executing
220       @code{flymake-compile}, or syntax check cannot start as compilation
221       is currently in progress.
223 @item Flymake:E/W
224 @tab  Number of errors/warnings found by the syntax check process.
226 @item Flymake:!
227 @tab  Flymake was unable to find master file for the current buffer.
228 @end multitable
230 The following errors cause a warning message and switch flymake mode
231 OFF for the buffer.
233 @multitable @columnfractions 0.25 0.75
234 @item CFGERR
235 @tab  Syntax check process returned nonzero exit code, but no
236       errors/warnings were reported. This indicates a possible configuration
237       error (for example, no suitable error message patterns for the
238       syntax check tool).
240 @item NOMASTER
241 @tab  Flymake was unable to find master file for the current buffer.
243 @item NOMK
244 @tab  Flymake was unable to find a suitable buildfile for the current buffer.
246 @item PROCERR
247 @tab  Flymake was unable to launch a syntax check process.
248 @end multitable
251 @node Troubleshooting
252 @section Troubleshooting
253 @cindex Logging
254 @cindex Troubleshooting
256 Flymake uses a simple logging facility for indicating important points
257 in the control flow. The logging facility sends logging messages to
258 the @code{*Messages*} buffer. The information logged can be used for
259 resolving various problems related to Flymake.
261 Logging output is controlled by the @code{flymake-log-level}
262 variable. @code{3} is the  most verbose level, and @code{-1} switches
263 logging off.
265 @node Configuring Flymake
266 @chapter Configuring and Extending Flymake
267 @cindex Configuring and Extending Flymake
269 @menu
270 * Customizable variables::
271 * Adding support for a new syntax check tool::
272 @end menu
274 Flymake was designed to be easily extended for supporting new syntax
275 check tools and error message patterns.
277 @node Customizable variables
278 @section Customizable variables
279 @cindex Customizable variables
281 This section summarizes variables used for Flymake
282 configuration.
284 @table @code
285 @item flymake-log-level
286 Controls logging output, see @ref{Troubleshooting}.
288 @item flymake-allowed-file-name-masks
289 A list of @code{(filename-regexp, init-function, cleanup-function
290 getfname-function)} for configuring syntax check tools. @xref{Adding
291 support for a new syntax check tool}.
293 @item flymake-buildfile-dirs
294 A list of directories (relative paths) for searching a
295 buildfile. @xref{Locating the buildfile}.
297 @item flymake-master-file-dirs
298 A list of directories for searching a master file. @xref{Locating a
299 master file}.
301 @item flymake-get-project-include-dirs-function
302 A function used for obtaining a list of project include dirs (C/C++
303 specific). @xref{Getting the include directories}.
305 @item flymake-master-file-count-limit
306 @itemx flymake-check-file-limit
307 Used when looking for a master file. @xref{Locating a master file}.
309 @item flymake-err-line-patterns
310 Patterns for error/warning messages in the form @code{(regexp file-idx
311 line-idx col-idx err-text-idx)}. @xref{Parsing the output}.
313 @item flymake-compilation-prevents-syntax-check
314 A flag indicating whether compilation and syntax check of the same
315 file cannot be run simultaneously.
317 @item flymake-no-changes-timeout
318 If any changes are made to the buffer, syntax check is automatically
319 started after @code{flymake-no-changes-timeout} seconds.
321 @item flymake-gui-warnings-enabled
322 A boolean flag indicating whether Flymake will show message boxes for
323 non-recoverable errors. If @code{flymake-gui-warnings-enabled} is
324 @code{nil}, these errors will only be logged to the @code{*Messages*}
325 buffer.
327 @item flymake-start-syntax-check-on-newline
328 A boolean flag indicating whether to start syntax check after a
329 newline character is added to the buffer.
331 @item flymake-errline
332 A custom face for highlighting lines for which at least one error has
333 been reported.
335 @item flymake-warnline
336 A custom face for highlighting lines for which at least one warning
337 and no errors have been reported.
339 @end table
341 @node Adding support for a new syntax check tool
342 @section Adding support for a new syntax check tool
343 @cindex Adding support for a new syntax check tool
345 @menu
346 * Example -- Configuring a tool called directly::
347 * Example -- Configuring a tool called via make::
348 @end menu
350 Syntax check tools are configured using the
351 @code{flymake-allowed-file-name-masks} list. Each item of this list
352 has the following format:
354 @lisp
355 (filename-regexp, init-function, cleanup-function, getfname-function)
356 @end lisp
358 @table @code
359 @item filename-regexp
360 This field is used as a key for locating init/cleanup/getfname
361 functions for the buffer.  Items in
362 @code{flymake-allowed-file-name-masks} are searched sequentially. The
363 first item with @code{filename-regexp} matching buffer filename is
364 selected. If no match is found, @code{flymake-mode} is switched off.
366 @item init-function
367 @code{init-function} is required to initialize the syntax check,
368 usually by creating a temporary copy of the buffer contents. The
369 function must return @code{(list cmd-name arg-list)}. If
370 @code{init-function} returns null, syntax check is aborted, by
371 @code{flymake-mode} is not switched off.
373 @item cleanup-function
374 @code{cleanup-function} is called after the syntax check process is
375 complete and should take care of proper deinitialization, which is
376 usually deleting a temporary copy created by the @code{init-function}.
378 @item getfname-function
379 This function is used for translating filenames reported by the syntax
380 check tool into ``real'' filenames. Filenames reported by the tool
381 will be different from the real ones, as actually the tool works with
382 the temporary copy.  In most cases, the default implementation
383 provided by Flymake, @code{flymake-get-real-file-name}, can be used as
384 @code{getfname-function}.
386 @end table
388 To add support for a new syntax check tool, write corresponding
389 @code{init-function}, and, optionally @code{cleanup-function} and
390 @code{getfname-function}.  If the format of error messages reported by
391 the new tool is not yet supported by Flymake, add a new entry to
392 the @code{flymake-err-line-patterns} list.
394 The following sections contain some examples of configuring Flymake
395 support for various syntax check tools.
397 @node Example -- Configuring a tool called directly
398 @subsection Example -- Configuring a tool called directly
399 @cindex Adding support for perl
401 In this example, we will add support for @code{perl} as a syntax check
402 tool. @code{perl} supports the @code{-c} option which does syntax
403 checking.
405 First, we write the @code{init-function}:
407 @lisp
408 (defun flymake-perl-init ()
409   (let* ((temp-file (flymake-init-create-temp-buffer-copy
410                      'flymake-create-temp-inplace))
411          (local-file (file-relative-name
412                       temp-file
413                       (file-name-directory buffer-file-name))))
414     (list "perl" (list "-wc " local-file))))
415 @end lisp
417 @code{flymake-perl-init} creates a temporary copy of the buffer
418 contents with the help of
419 @code{flymake-init-create-temp-buffer-copy}, and builds an appropriate
420 command line.
422 Next, we add a new entry to the
423 @code{flymake-allowed-file-name-masks}:
425 @lisp
426 (setq flymake-allowed-file-name-masks
427       (cons '(".+\\.pl$"
428               flymake-perl-init
429               flymake-simple-cleanup
430               flymake-get-real-file-name)
431             flymake-allowed-file-name-masks))
432 @end lisp
434 Note that we use standard @code{cleanup-function} and
435 @code{getfname-function}.
437 Finally, we add an entry to @code{flymake-err-line-patterns}:
439 @lisp
440 (setq flymake-err-line-patterns
441       (cons '("\\(.*\\) at \\([^ \n]+\\) line \\([0-9]+\\)[,.\n]"
442               2 3 nil 1)
443             flymake-err-line-patterns))
444 @end lisp
446 @node Example -- Configuring a tool called via make
447 @subsection Example -- Configuring a tool called via make
448 @cindex Adding support for C (gcc+make)
450 In this example we will add support for C files syntax checked by
451 @code{gcc} called via @code{make}.
453 We're not required to write any new functions, as Flymake already has
454 functions for @code{make}. We just add a new entry to the
455 @code{flymake-allowed-file-name-masks}:
457 @lisp
458 (setq flymake-allowed-file-name-masks
459       (cons '(".+\\.c$"
460               flymake-simple-make-init
461               flymake-simple-cleanup
462               flymake-get-real-file-name)
463             flymake-allowed-file-name-masks))
464 @end lisp
466 @code{flymake-simple-make-init} builds the following @code{make}
467 command line:
469 @lisp
470 (list "make"
471       (list "-s" "-C"
472             base-dir
473             (concat "CHK_SOURCES=" source)
474             "SYNTAX_CHECK_MODE=1"
475             "check-syntax"))
476 @end lisp
478 @code{base-dir} is a directory containing @code{Makefile}, see @ref{Locating the buildfile}.
480 Thus, @code{Makefile} must contain the @code{check-syntax} target. In
481 our case this target might look like this:
483 @verbatim
484 check-syntax:
485         gcc -o nul -S ${CHK_SOURCES}
486 @end verbatim
488 The format of error messages reported by @code{gcc} is already
489 supported by Flymake, so we don't have to add a new entry to
490 @code{flymake-err-line-patterns}.
492 @node Flymake Implementation
493 @chapter Flymake Implementation
494 @cindex Implementation details
496 @menu
497 * Determining whether syntax check is possible::
498 * Making a temporary copy::
499 * Locating a master file::
500 * Getting the include directories::
501 * Locating the buildfile::
502 * Starting the syntax check process::
503 * Parsing the output::
504 * Highlighting erroneous lines::
505 * Interaction with other modes::
506 @end menu
508 Syntax check is started by calling @code{flymake-start-syntax-check-for-current-buffer}.
509 Flymake first determines whether it is able to do syntax
510 check. It then saves a copy of the buffer in a temporary file in the
511 buffer's directory (or in the system temp directory -- for java
512 files), creates a syntax check command and launches a process with
513 this command. The output is parsed using a list of error message patterns,
514 and error information (file name, line number, type and text) is
515 saved. After the process has finished, Flymake highlights erroneous
516 lines in the buffer using the accumulated error information.
518 @node Determining whether syntax check is possible
519 @section Determining whether syntax check is possible
520 @cindex Syntax check models
521 @cindex Master file
523 Syntax check is considered possible if there's an entry in
524 @code{flymake-allowed-file-name-masks} matching buffer's filename and
525 its @code{init-function} returns non-@code{nil} value.
527 Two syntax check modes are distinguished:
529 @enumerate
531 @item
532 Buffer can be syntax checked in a standalone fashion, that is, the
533 file (its temporary copy, in fact) can be passed over to the compiler to
534 do the syntax check. Examples are C/C++ (.c, .cpp) and Java (.java)
535 sources.
537 @item
538 Buffer can be syntax checked, but additional file, called master file,
539 is required to perform this operation. A master file is a file that
540 includes the current file, so that running a syntax check tool on it
541 will also check syntax in the current file. Examples are C/C++ (.h,
542 .hpp) headers.
544 @end enumerate
546 These modes are handled inside init/cleanup/getfname functions, see
547 @ref{Adding support for a new syntax check tool}.
549 Flymake contains implementations of all functionality required to
550 support different syntax check modes described above (making
551 temporary copies, finding master files, etc.), as well as some
552 tool-specific (routines for @code{make}, @code{Ant}, etc.) code.
555 @node Making a temporary copy
556 @section Making a temporary copy
557 @cindex Temporary copy of the buffer
558 @cindex Master file
560 After the possibility of the syntax check has been determined, a
561 temporary copy of the current buffer is made so that the most recent
562 unsaved changes could be seen by the syntax check tool. Making a copy
563 is quite straightforward in a standalone case (mode @code{1}), as it's
564 just saving buffer contents to a temporary file.
566 Things get trickier, however, when master file is involved, as it
567 requires to
569 @itemize @bullet
570 @item locate a master file
571 @item patch it to include the current file using its new (temporary)
572 name.
573 @end itemize
575 Locating a master file is discussed in the following section.
577 Patching just changes all appropriate lines of the master file so that they
578 use the new (temporary) name of the current file. For example, suppose current
579 file name is @code{file.h}, the master file is @code{file.cpp}, and
580 it includes current file via @code{#include "file.h"}. Current file's copy
581 is saved to file @code{file_flymake.h}, so the include line must be
582 changed to @code{#include "file_flymake.h"}. Finally, patched master file
583 is saved to @code{file_flymake_master.cpp}, and the last one is passed to
584 the syntax check tool.
586 @node Locating a master file
587 @section Locating a master file
588 @cindex Master file
590 Master file is located in two steps.
592 First, a list of possible master files is built. A simple name
593 matching is used to find the files. For a C++ header @code{file.h},
594 Flymake searches for all @code{.cpp} files in the directories whose relative paths are
595 stored in a customizable variable @code{flymake-master-file-dirs}, which
596 usually contains something like @code{("." "./src")}. No more than
597 @code{flymake-master-file-count-limit} entries is added to the master file
598 list. The list is then sorted to move files with names @code{file.cpp} to
599 the top.
601 Next, each master file in a list is checked to contain the appropriate
602 include directives. No more than @code{flymake-check-file-limit} of each
603 file are parsed.
605 For @code{file.h}, the include directives to look for are
606 @code{#include "file.h"}, @code{#include "../file.h"}, etc. Each
607 include is checked against a list of include directories
608 (see @ref{Getting the include directories}) to be sure it points to the
609 correct @code{file.h}.
611 First matching master file found stops the search. The master file is then
612 patched and saved to disk. In case no master file is found, syntax check is
613 aborted, and corresponding status (!) is reported in the mode line.
615 @node Getting the include directories
616 @section Getting the include directories
617 @cindex Include directories (C/C++ specific)
619 Two sets of include directories are distinguished: system include directories
620 and project include directories. The former is just the contents of the
621 @code{INCLUDE} environment variable. The latter is not so easy to obtain,
622 and the way it can be obtained can vary greatly for different projects.
623 Therefore, a customizable variable
624 @code{flymake-get-project-include-dirs-function} is used to provide the
625 way to implement the desired behavior.
627 The default implementation, @code{flymake-get-project-include-dirs-imp},
628 uses a @code{make} call. This requires a correct base directory, that is, a
629 directory containing a correct @code{Makefile}, to be determined.
631 As obtaining the project include directories might be a costly operation, its
632 return value is cached in the hash table. The cache is cleared in the beginning
633 of every syntax check attempt.
635 @node Locating the buildfile
636 @section Locating the buildfile
637 @cindex Locating the buildfile
638 @cindex buildfile, locating
639 @cindex Makefile, locating
641 Flymake can be configured to use different tools for performing syntax
642 checks. For example, it can use direct compiler call to syntax check a perl
643 script or a call to @code{make} for a more complicated case of a
644 @code{C/C++} source. The general idea is that simple files, like perl
645 scripts and html pages, can be checked by directly invoking a
646 corresponding tool. Files that are usually more complex and generally
647 used as part of larger projects, might require non-trivial options to
648 be passed to the syntax check tool, like include directories for
649 C++. The latter files are syntax checked using some build tool, like
650 @code{make} or @code{Ant}.
652 All @code{make} configuration data is usually stored in a file called
653 @code{Makefile}. To allow for future extensions, flymake uses a notion of
654 buildfile to reference the 'project configuration' file.
656 Special function, @code{flymake-find-buildfile} is provided for locating buildfiles.
657 Searching for a buildfile is done in a manner similar to that of searching
658 for possible master files. A customizable variable
659 @code{flymake-buildfile-dirs} holds a list of relative paths to the
660 buildfile. They are checked sequentially until a buildfile is found. In case
661 there's no build file, syntax check is aborted.
663 Buildfile values are also cached.
665 @node Starting the syntax check process
666 @section Starting the syntax check process
667 @cindex Syntax check process
669 The command line (command name and the list of arguments) for launching a process is returned by the
670 initialization function. Flymake then just calls @code{start-process}
671 to start an asynchronous process and configures process filter and
672 sentinel which is used for processing the output of the syntax check
673 tool.
675 @node Parsing the output
676 @section Parsing the output
677 @cindex Parsing the output
679 The output generated by the syntax check tool is parsed in the process
680 filter/sentinel using the error message patterns stored in the
681 @code{flymake-err-line-patterns} variable. This variable contains a
682 list of items of the form @code{(regexp file-idx line-idx
683 err-text-idx)}, used to determine whether a particular line is an
684 error message and extract file name, line number and error text,
685 respectively. Error type (error/warning) is also guessed by matching
686 error text with the '@code{^[wW]arning}' pattern. Anything that was not
687 classified as a warning is considered an error. Type is then used to
688 sort error menu items, which shows error messages first.
690 Flymake is also able to interpret error message patterns missing err-text-idx
691 information. This is done by merely taking the rest of the matched line
692 (@code{(substring line (match-end 0))}) as error text. This trick allows
693 to make use of a huge collection of error message line patterns from
694 @code{compile.el}. All these error patterns are appended to
695 the end of @code{flymake-err-line-patterns}.
697 The error information obtained is saved in a buffer local
698 variable. The buffer for which the process output belongs is
699 determined from the process-id@w{}->@w{}buffer mapping updated
700 after every process launch/exit.
702 @node Highlighting erroneous lines
703 @section Highlighting erroneous lines
704 @cindex Erroneous lines, faces
706 Highlighting is implemented with overlays and happens in the process
707 sentinel, after calling the cleanup function. Two customizable faces
708 are used: @code{flymake-errline} and
709 @code{flymake-warnline}.  Errors belonging outside the current
710 buffer are considered to belong to line 1 of the current buffer.
712 @node Interaction with other modes
713 @section Interaction with other modes
714 @cindex Interaction with other modes
715 @cindex Interaction with compile mode
717 The only mode flymake currently knows about is @code{compile}.
719 Flymake can be configured to not start syntax check if it thinks the
720 compilation is in progress. The check is made by the
721 @code{flymake-compilation-is-running}, which tests the
722 @code{compilation-in-progress} variable. The reason why this might be
723 useful is saving CPU time in case both syntax check and compilation
724 are very CPU intensive. The original reason for adding this feature,
725 though, was working around a locking problem with MS Visual C++ compiler.
727 Flymake also provides an alternative command for starting compilation,
728 @code{flymake-compile}:
730 @lisp
731 (defun flymake-compile ()
732   "Kill all flymake syntax checks then start compilation."
733   (interactive)
734   (flymake-stop-all-syntax-checks)
735   (call-interactively 'compile))
736 @end lisp
738 It just kills all the active syntax check processes before calling
739 @code{compile}.
741 @node GNU Free Documentation License
742 @appendix GNU Free Documentation License
743 @include doclicense.texi
745 @node Index
746 @unnumbered Index
748 @printindex cp
750 @bye
752 @ignore
753    arch-tag: 9f0db077-5598-49ab-90b9-8df9248a63ec
754 @end ignore