aboutsummaryrefslogtreecommitdiffstats
path: root/doc/misc
diff options
context:
space:
mode:
authorEli Zaretskii2017-10-10 17:08:51 +0300
committerEli Zaretskii2017-10-10 17:08:51 +0300
commit00adeb43e90d549eaa45499380ee007321e4ea0a (patch)
treea2faa15e070ee9f4a0d3ac6a5b1da3e5960ab70b /doc/misc
parent44c6401733227d0a1b416bd217d99877d586ead8 (diff)
downloademacs-00adeb43e90d549eaa45499380ee007321e4ea0a.tar.gz
emacs-00adeb43e90d549eaa45499380ee007321e4ea0a.zip
Improve the Flymake manual
* doc/misc/flymake.texi: Add a 'coding' cookie. Add a @syncodeindex directive for @vindex. Use 2 spaces between sentences. Lower-case @cindex entries. (Overview of Flymake): Fix use of @itemize and @pxref. Fix punctuation and markup. (Backend exceptions): Use @emph instead of @dfn. Add more indexing. (Customizable variables, Extending Flymake): Improve wording. (Flymake error types): Fix usage of @itemize. Improve wording. (Backend functions): Fix punctuation. Fix markup. Add a cross-reference to ELisp manual. (Flymake utility functions): Add a cross-reference to ELisp manual. (An annotated example backend): Fix punctuation and typos. (Flymake mode, Running the syntax check) (Navigating to error lines, Backend exceptions) (Customizable variables, Flymake error types, Backend functions) (Flymake utility functions, Proc customization variables) (Locating a master file, Locating the buildfile) (Starting the syntax check process, Parsing the output) (Interaction with other modes): Fix indexing. Add index entries for functions, variables, and concepts.
Diffstat (limited to 'doc/misc')
-rw-r--r--doc/misc/flymake.texi385
1 files changed, 219 insertions, 166 deletions
diff --git a/doc/misc/flymake.texi b/doc/misc/flymake.texi
index 9207ed496f7..d89a555ff73 100644
--- a/doc/misc/flymake.texi
+++ b/doc/misc/flymake.texi
@@ -1,4 +1,4 @@
1\input texinfo @c -*-texinfo-*- 1\input texinfo @c -*-texinfo; coding: utf-8 -*-
2@comment %**start of header 2@comment %**start of header
3@setfilename ../../info/flymake.info 3@setfilename ../../info/flymake.info
4@set VERSION 0.3 4@set VERSION 0.3
@@ -6,6 +6,8 @@
6@settitle GNU Flymake @value{VERSION} 6@settitle GNU Flymake @value{VERSION}
7@include docstyle.texi 7@include docstyle.texi
8@syncodeindex pg cp 8@syncodeindex pg cp
9@syncodeindex vr cp
10@syncodeindex fn cp
9@comment %**end of header 11@comment %**end of header
10 12
11@copying 13@copying
@@ -61,20 +63,20 @@ modify this GNU manual.''
61 63
62@node Overview of Flymake 64@node Overview of Flymake
63@chapter Overview 65@chapter Overview
64@cindex Overview of Flymake 66@cindex overview of flymake
65 67
66Flymake is a universal on-the-fly buffer checker implemented as an 68Flymake is a universal on-the-fly buffer checker implemented as an
67Emacs minor mode. When enabled, Flymake visually annotates the buffer 69Emacs minor mode. When enabled, Flymake visually annotates the buffer
68with diagnostic information coming from one or more different sources, 70with diagnostic information coming from one or more different sources,
69or @dfn{backends}. 71or @dfn{backends}.
70 72
71Flymake annotates the buffer by highlighting problematic buffer 73Flymake annotates the buffer by highlighting problematic buffer
72regions with a special space. It displays an overall buffer status in 74regions with a special space. It displays an overall buffer status in
73the mode line containing totals for different types of diagnostics. 75the mode line containing totals for different types of diagnostics.
74 76
75@code{flymake-goto-next-error} and @code{flymake-goto-prev-error} are 77@code{flymake-goto-next-error} and @code{flymake-goto-prev-error} are
76commands that allow easy navigation to the next/previous erroneous 78commands that allow easy navigation to the next/previous erroneous
77line, respectively. If might be a good idea to map them to @kbd{M-n} 79line, respectively. If might be a good idea to map them to @kbd{M-n}
78and @kbd{M-p} in @code{flymake-mode}, by adding to your init file: 80and @kbd{M-p} in @code{flymake-mode}, by adding to your init file:
79 81
80@lisp 82@lisp
@@ -85,42 +87,44 @@ and @kbd{M-p} in @code{flymake-mode}, by adding to your init file:
85Syntax check is done ``on-the-fly''. It is started whenever 87Syntax check is done ``on-the-fly''. It is started whenever
86 88
87@itemize @bullet 89@itemize @bullet
88@item @code{flymake-mode} is started, unless 90@item
89 @code{flymake-start-on-flymake-mode} is nil. 91@code{flymake-mode} is started, unless
92@code{flymake-start-on-flymake-mode} is nil.
90 93
91@item a newline character is added to the buffer, unless 94@item
92 @code{flymake-start-syntax-check-on-newline} is nil. 95a newline character is added to the buffer, unless
96@code{flymake-start-syntax-check-on-newline} is nil.
93 97
94@item some changes were made to the buffer more than @code{0.5} 98@item
95 seconds ago (the delay is configurable in 99some changes were made to the buffer more than @code{0.5} seconds ago
96 @code{flymake-no-changes-timeout}). 100(the delay is configurable in @code{flymake-no-changes-timeout}).
97@end itemize 101@end itemize
98 102
99Flymake is a universal syntax checker in the sense that it's easily 103Flymake is a universal syntax checker in the sense that it's easily
100extended to support new backends @pxref{Extending Flymake}. 104extended to support new backends (@pxref{Extending Flymake}).
101 105
102Historically, Flymake used to accept diagnostics from a single, albeit 106Historically, Flymake used to accept diagnostics from a single, albeit
103reasonably flexible, backend. 107reasonably flexible, backend.
104 108
105This backend isn't (yet) obsolete and so is still available as a 109This backend isn't (yet) obsolete, and so is still available as a
106fallback and active by default(@pxref{The legacy Proc backend}). It works by 110fallback and active by default (@pxref{The legacy Proc backend}). It works by
107selecting a syntax check tool from a preconfigured list (compiler for 111selecting a syntax check tool from a preconfigured list (compiler for
108C++ files, @code{perl} for perl files, etc.), and executing it in the 112C@t{++} files, @command{perl} for Perl files, etc.), and executing it in the
109background, passing it a temporary file which is a copy of the current 113background, passing it a temporary file which is a copy of the current
110buffer, and parsing the output for known error/warning message 114buffer, and parsing the output for known error/warning message
111patterns. 115patterns.
112 116
113@node Installing Flymake 117@node Installing Flymake
114@chapter Installing 118@chapter Installing
115@cindex Installing Flymake 119@cindex installing flymake
116 120
117Flymake is included with Emacs and its main commands, like 121Flymake is included with Emacs and its main commands, like
118@code{flymake-mode}, are autoloaded. This means there is usually 122@code{flymake-mode}, are autoloaded. This means there is usually
119nothing to do by way of installation. 123nothing to do by way of installation.
120 124
121@node Using Flymake 125@node Using Flymake
122@chapter Using Flymake 126@chapter Using Flymake
123@cindex Using Flymake 127@cindex using flymake
124 128
125@menu 129@menu
126* Flymake mode:: 130* Flymake mode::
@@ -134,15 +138,16 @@ nothing to do by way of installation.
134@node Flymake mode 138@node Flymake mode
135@section Flymake mode 139@section Flymake mode
136@cindex flymake-mode 140@cindex flymake-mode
141@cindex activating flymake-mode
137 142
138Flymake is an Emacs minor mode. To use Flymake, you 143Flymake is an Emacs minor mode. To use Flymake, you
139must first activate @code{flymake-mode} by using the 144must first activate @code{flymake-mode} by using the command
140@code{flymake-mode} function. 145@kbd{flymake-mode}.
141 146
142Instead of manually activating @code{flymake-mode}, you can configure 147Instead of manually activating @code{flymake-mode}, you can configure
143Flymake to automatically enable @code{flymake-mode} upon opening any 148Emacs to automatically enable @code{flymake-mode} upon opening any
144file for which syntax check is possible. To do so, place the following 149file for which syntax check is possible. To do so, place the following
145line in @code{.emacs}: 150line in your @file{~/.emacs}:
146 151
147@lisp 152@lisp
148(add-hook 'find-file-hook 'flymake-find-file-hook) 153(add-hook 'find-file-hook 'flymake-find-file-hook)
@@ -150,30 +155,32 @@ line in @code{.emacs}:
150 155
151@node Running the syntax check 156@node Running the syntax check
152@section Running the syntax check 157@section Running the syntax check
153@cindex Manually starting the syntax check 158@cindex manually starting syntax check
159@cindex syntax check, start manually
154 160
161@findex flymake-start
155When @code{flymake-mode} is active, syntax check is started 162When @code{flymake-mode} is active, syntax check is started
156automatically on any of the three conditions mentioned above. Syntax 163automatically on any of the three conditions mentioned in
157check can also be started manually by using the @code{flymake-start} 164@ref{Overview of Flymake}. Syntax check can also be started manually
158command. 165by typing the @kbd{M-x flymake-start @key{RET}} command.
159 166
160@node Navigating to error lines 167@node Navigating to error lines
161@section Navigating to error lines 168@section Navigating to error lines
162@cindex Navigating to error lines 169@cindex navigating to error lines
163 170
164After syntax check is completed, lines for which at least one error or 171After syntax check is completed, lines for which at least one error or
165warning has been reported are highlighted, and total number of errors 172warning has been reported are highlighted, and the total number of errors
166and warning is shown in the mode line. Use the following functions to 173and warning is shown in the mode line. Use the following functions to
167navigate the highlighted lines: 174navigate the highlighted lines:
168 175
169@table @code 176@table @code
170 177@findex flymake-goto-next-error
171@item flymake-goto-next-error 178@item flymake-goto-next-error
172Moves point to the next erroneous line, if any. 179Moves point to the next erroneous line, if any.
173 180
181@findex flymake-goto-prev-error
174@item flymake-goto-prev-error 182@item flymake-goto-prev-error
175Moves point to the previous erroneous line. 183Moves point to the previous erroneous line.
176
177@end table 184@end table
178 185
179If the user option @code{flymake-wrap-around} is active 186If the user option @code{flymake-wrap-around} is active
@@ -196,7 +203,7 @@ where questioned.
196@item @code{!} 203@item @code{!}
197@tab All the configured Flymake backends have disabled themselves. 204@tab All the configured Flymake backends have disabled themselves.
198Left-clicking Flymake's mode line indicator pops up a menu listing the 205Left-clicking Flymake's mode line indicator pops up a menu listing the
199option to visit Flymake's log buffer. In this buffer these situations 206option to visit Flymake's log buffer. In this buffer these situations
200can be investigated. 207can be investigated.
201 208
202@item @code{?} 209@item @code{?}
@@ -210,38 +217,48 @@ check process.
210 217
211@node Backend exceptions 218@node Backend exceptions
212@section Backend exceptions 219@section Backend exceptions
213@cindex Logging 220@cindex backend exceptions
214@cindex Backend exceptions
215 221
222@cindex disabled backends
223@cindex backends, disabled
216Some backends may take longer than others to respond or complete, and 224Some backends may take longer than others to respond or complete, and
217some may decide to @dfn{disable} themselves if they are not suitable 225some may decide to @emph{disable} themselves if they are not suitable
218for the current buffer. A disabled backend is not tried again for 226for the current buffer. A disabled backend is not tried again for
219future checks of the current buffer. 227future checks of the current buffer.
220 228
229@findex flymake-reporting-backends
230@findex flymake-running-backends
231@findex flymake-disabled-backends
221The commands @code{flymake-reporting-backends}, 232The commands @code{flymake-reporting-backends},
222@code{flymake-running-backends} and @code{flymake-disabled-backends} 233@code{flymake-running-backends} and @code{flymake-disabled-backends}
223inform on the specific situation. 234show the backends currently used and those which are disabled.
224 235
225Toggling @code{flymake-mode} off and on again or invoking 236@cindex reset disabled backends
237Toggling @code{flymake-mode} off and on again, or invoking
226@code{flymake-start} with a prefix argument is one way to reset the 238@code{flymake-start} with a prefix argument is one way to reset the
227disabled backend list so they will be tried again in the next check. 239disabled backend list, so that they will be tried again in the next check.
228 240
241@cindex logging
242@cindex flymake logging
229Flymake also uses a simple logging facility for indicating important points 243Flymake also uses a simple logging facility for indicating important points
230in the control flow. The logging facility sends logging messages to 244in the control flow. The logging facility sends logging messages to
231the @file{*Flymake log*} buffer. The information logged can be used for 245the @file{*Flymake log*} buffer. The information logged can be used for
232resolving various problems related to Flymake. 246resolving various problems related to Flymake.
233 247
248@vindex warning-minimum-log-level
249@vindex warning-minimum-level
234Logging output is controlled by the Emacs @code{warning-minimum-log-level} 250Logging output is controlled by the Emacs @code{warning-minimum-log-level}
235and @code{warning-minimum-level} variables. 251and @code{warning-minimum-level} variables.
236 252
237@node Customizable variables 253@node Customizable variables
238@section Customizable variables 254@section Customizable variables
239@cindex Customizable variables 255@cindex customizable variables
256@cindex variables for customizing flymake
240 257
241This section summarizes customization variables used for the 258This section summarizes customization variables used for the
242configuration of the Flymake user interface. 259configuration of the Flymake user interface.
243 260
244@table @code 261@vtable @code
245@item flymake-no-changes-timeout 262@item flymake-no-changes-timeout
246If any changes are made to the buffer, syntax check is automatically 263If any changes are made to the buffer, syntax check is automatically
247started after this many seconds, unless the user makes another change, 264started after this many seconds, unless the user makes another change,
@@ -249,7 +266,7 @@ which resets the timer.
249 266
250@item flymake-start-syntax-check-on-newline 267@item flymake-start-syntax-check-on-newline
251A boolean flag indicating whether to start syntax check immediately 268A boolean flag indicating whether to start syntax check immediately
252after a newline character is added to the buffer. 269after a newline character is inserted into the buffer.
253 270
254@item flymake-start-on-flymake-mode 271@item flymake-start-on-flymake-mode
255A boolean flag indicating whether to start syntax check immediately 272A boolean flag indicating whether to start syntax check immediately
@@ -281,12 +298,11 @@ Which fringe (if any) should show the warning/error bitmaps.
281@item flymake-wrap-around 298@item flymake-wrap-around
282If non-nil, moving to errors with @code{flymake-goto-next-error} and 299If non-nil, moving to errors with @code{flymake-goto-next-error} and
283@code{flymake-goto-prev-error} wraps around buffer boundaries. 300@code{flymake-goto-prev-error} wraps around buffer boundaries.
284 301@end vtable
285@end table
286 302
287@node Extending Flymake 303@node Extending Flymake
288@chapter Extending Flymake 304@chapter Extending Flymake
289@cindex Extending Flymake 305@cindex extending flymake
290 306
291Flymake can primarily be extended in one of two ways: 307Flymake can primarily be extended in one of two ways:
292 308
@@ -299,7 +315,7 @@ different backends.
299By adding a new buffer-checking backend. 315By adding a new buffer-checking backend.
300@end enumerate 316@end enumerate
301 317
302The following sections discuss each approach in detail: 318The following sections discuss each approach in detail.
303 319
304@menu 320@menu
305* Flymake error types:: 321* Flymake error types::
@@ -308,7 +324,10 @@ The following sections discuss each approach in detail:
308 324
309@node Flymake error types 325@node Flymake error types
310@section Customizing Flymake error types 326@section Customizing Flymake error types
327@cindex customizing error types
328@cindex error types, customization
311 329
330@vindex flymake-diagnostic-types-alist
312The variable @code{flymake-diagnostic-types-alist} is looked up by 331The variable @code{flymake-diagnostic-types-alist} is looked up by
313Flymake every time an annotation for a diagnostic is created in the 332Flymake every time an annotation for a diagnostic is created in the
314buffer. Specifically, this variable holds a table of correspondence 333buffer. Specifically, this variable holds a table of correspondence
@@ -326,49 +345,60 @@ presents the diagnostic:
326 345
327@itemize 346@itemize
328 347
329@item @code{bitmap}, an image displayed in the fringe according to 348@item
349@cindex bitmap of diagnostic
350@code{bitmap}, an image displayed in the fringe according to
330@code{flymake-fringe-indicator-position}. The value actually follows 351@code{flymake-fringe-indicator-position}. The value actually follows
331the syntax of @code{flymake-error-bitmap}(@pxref{Customizable 352the syntax of @code{flymake-error-bitmap} (@pxref{Customizable
332variables}). It is overridden by any @code{before-string} overlay 353variables}). It is overridden by any @code{before-string} overlay
333property. 354property.
334 355
335@item @code{severity} is a non-negative integer specifying the diagnostic's 356@item
336severity. The higher, the more serious. If the overlay property 357@cindex severity of diagnostic
337@code{priority} is not specified, @code{severity} is used to set it 358@code{severity} is a non-negative integer specifying the diagnostic's
338and help sort overlapping overlays. 359severity. The higher the value, the more serious is the error. If
360the overlay property @code{priority} is not specified, @code{severity}
361is used to set it and help sort overlapping overlays.
339 362
340@item Every property pertaining to overlays (@pxref{Overlay 363@item
341Properties,,, elisp, The Emacs Lisp Reference Manual}), except 364Every property pertaining to overlays (@pxref{Overlay Properties,,,
342@code{category} and @code{evaporate}. These properties are used to 365elisp, The Emacs Lisp Reference Manual}), except @code{category} and
343affect the appearance of Flymake annotations. 366@code{evaporate}. These properties are used to affect the appearance
367of Flymake annotations.
344 368
345As an example, here's how to make errors (diagnostics of the type 369As an example, here's how to make errors (diagnostics of the type
346@code{:error}) stand out even more prominently in the buffer, by 370@code{:error}) stand out even more prominently in the buffer, by
347raising the characters with a @code{display} overlay property. 371raising the characters using a @code{display} overlay property.
348 372
349@example 373@example
350(push '(display . (raise 1.2)) 374(push '(display . (raise 1.2))
351 (cdr (assoc :error flymake-diagnostic-types-alist))) 375 (cdr (assoc :error flymake-diagnostic-types-alist)))
352@end example 376@end example
353 377
354@item @code{flymake-category} is a symbol whose property list is considered 378@item
355a default for missing values of any other properties. 379@vindex flymake-category
380@code{flymake-category} is a symbol whose property list is considered
381the default for missing values of any other properties.
356@end itemize 382@end itemize
357 383
384@cindex predefined diagnostic types
385@vindex flymake-error
386@vindex flymake-warning
387@vindex flymake-note
358Three default diagnostic types, @code{:error}, @code{:warning} and 388Three default diagnostic types, @code{:error}, @code{:warning} and
359@code{:note} are predefined in 389@code{:note} are predefined in
360@code{flymake-diagnostic-types-alist}. By default each lists a single 390@code{flymake-diagnostic-types-alist}. By default each lists a single
361@code{flymake-category} property whose value is, respectively, the 391@code{flymake-category} property whose value is, respectively, the
362symbols @code{flymake-error}, @code{flymake-warning} and 392symbols @code{flymake-error}, @code{flymake-warning} and
363@code{flymake-note}. 393@code{flymake-note}.
364 394
365These category symbols' plists is where the values of customizable 395These category symbols' plists is where the values of customizable
366variables and faces such as @code{flymake-error-bitmap} are found. 396variables and faces such as @code{flymake-error-bitmap} are found.
367Thus, if you change their plists, Flymake may stop honouring these 397Thus, if you change their plists, Flymake may stop honoring these
368user customizations. 398user customizations.
369 399
370The @code{flymake-category} special property is also especially useful 400The @code{flymake-category} special property is also especially useful
371to backend authors that create diagnostics objects with non-default 401for backends which create diagnostics objects with non-default
372types that differ from an existing type by only a few properties 402types that differ from an existing type by only a few properties
373(@pxref{Flymake utility functions}). 403(@pxref{Flymake utility functions}).
374 404
@@ -383,8 +413,9 @@ priority but without an overlay face.
383 (flymake-category . flymake-note)))) 413 (flymake-category . flymake-note))))
384@end example 414@end example
385 415
416@vindex flymake-text
386As you might have guessed, Flymake's annotations are implemented as 417As you might have guessed, Flymake's annotations are implemented as
387overlays(@pxref{Overlays,,, elisp, The Emacs Lisp Reference Manual}). 418overlays (@pxref{Overlays,,, elisp, The Emacs Lisp Reference Manual}).
388Along with the properties that you specify for the specific type of 419Along with the properties that you specify for the specific type of
389diagnostic, Flymake adds the property @code{flymake-text} to these 420diagnostic, Flymake adds the property @code{flymake-text} to these
390overlays, and sets it to the message string that the backend used to 421overlays, and sets it to the message string that the backend used to
@@ -392,8 +423,8 @@ describe the diagnostic.
392 423
393Since overlays also support arbitrary keymaps, you can use this 424Since overlays also support arbitrary keymaps, you can use this
394property @code{flymake-text} to create interactive annotations, such 425property @code{flymake-text} to create interactive annotations, such
395as in the following example binding a @kbd{mouse-3} event (middle 426as in the following example of binding a @kbd{mouse-3} event (middle
396mouse button click) to an internet search for the text of a 427mouse button click) to an Internet search for the text of a
397@code{:warning} or @code{:error}. 428@code{:warning} or @code{:error}.
398 429
399@example 430@example
@@ -424,82 +455,92 @@ mouse button click) to an internet search for the text of a
424 455
425@node Backend functions 456@node Backend functions
426@section Backend functions 457@section Backend functions
458@cindex backend functions
427 459
460@vindex flymake-diagnostic-functions
428Flymake backends are Lisp functions placed in the special hook 461Flymake backends are Lisp functions placed in the special hook
429@code{flymake-diagnostic-functions}. 462@code{flymake-diagnostic-functions}.
430 463
431A backend's responsibility is to diagnose the contents of a buffer for 464A backend's responsibility is to diagnose the contents of a buffer for
432problems, registering these problem's positions, type and summarized 465problems, registering the problem's positions, type, and summary
433description. This information is collected in the form of diagnostic 466description. This information is collected in the form of diagnostic
434objects created with the function @code{flymake-make-diagnostic} and 467objects created by the function @code{flymake-make-diagnostic}
435then handed over to Flymake, which then proceeds to annotate the 468(@pxref{Flymake utility functions}), and
469then handed over to Flymake, which proceeds to annotate the
436buffer. 470buffer.
437 471
438A request for a buffer check and the subsequent delivery of 472A request for a buffer check, and the subsequent delivery of
439diagnostics are the two key events of the interaction between Flymake 473diagnostics, are two key events of the interaction between Flymake
440and backend. Each such event corresponds to a well-defined function 474and backend. Each such event corresponds to a well-defined function
441calling convention: one for calls made by Flymake into the backend via 475calling convention: one for calls made by Flymake into the backend via
442the backend function, and second one in the reverse direction via a 476the backend function, the other in the reverse direction via a
443callback. To be usable, backends must adhere to both. 477callback. To be usable, backends must adhere to both.
444 478
445Backend functions must accept an arbitrary number of arguments: 479Backend functions must accept an arbitrary number of arguments:
446 480
447@itemize 481@itemize
448@item the first argument is always @var{report-fn}, a callback function 482@item
483the first argument is always @var{report-fn}, a callback function
449detailed below; 484detailed below;
450 485
451@item the remaining arguments are keyword-value pairs in the 486@item
452form (@var{:key} @var{value} @var{:key2} @var{value2}...). Currently, 487the remaining arguments are keyword-value pairs of the
488form @w{@code{(@var{:key} @var{value} @var{:key2} @var{value2}...)}}. Currently,
453Flymake provides no such arguments, but backend functions must be 489Flymake provides no such arguments, but backend functions must be
454prepared to accept (and possibly ignore) any number of them. 490prepared to accept (and possibly ignore) any number of them.
455@end itemize 491@end itemize
456 492
457Whenever Flymake or the user decides to re-check the buffer, backend 493Whenever Flymake or the user decide to re-check the buffer, backend
458functions are called as detailed above and are expected to initiate 494functions are called as detailed above, and are expected to initiate
459this check, but aren't in any way required to complete it before 495this check, but aren't in any way required to complete it before
460exiting: if the computation involved is computationally expensive, as 496exiting: if the computation involved is expensive, as
461is often the case in large buffers, that slower task should be 497is often the case with large buffers, that slower task should be
462scheduled for the future using asynchronous processes or other 498scheduled for the future using asynchronous sub-processes
463asynchronous mechanisms. 499(@pxref{Asynchronous Processes,,, elisp, The Emacs Lisp reference
500manual}) or other asynchronous mechanisms.
464 501
465In any case, backend functions are expected to return quickly or 502In any case, backend functions are expected to return quickly or
466signal an error, in which case the backend is disabled 503signal an error, in which case the backend is disabled
467(@pxref{Backend exceptions}). 504(@pxref{Backend exceptions}).
468 505
469If the function returns, Flymake considers the backend to be 506If the function returns, Flymake considers the backend to be
470@dfn{running}. If it has not done so already, the backend is expected 507@dfn{running}. If it has not done so already, the backend is expected
471to call the function @var{report-fn} passed to it, at which point 508to call the function @var{report-fn} passed to it, at which point
472Flymake considers the backend to be @dfn{reporting}. Backends call 509Flymake considers the backend to be @dfn{reporting}. Backends call
473@var{report-fn} by passing it a single argument @var{report-action} 510@var{report-fn} by passing it a single argument @var{report-action}
474followed by an optional list of keyword-value pairs in the form 511followed by an optional list of keyword-value pairs of the form
475(@var{:report-key} @var{value} @var{:report-key2} @var{value2}...). 512@w{@code{(@var{:report-key} @var{value} @var{:report-key2} @var{value2}...)}}.
476 513
477Currently accepted values for @var{report-action} are: 514Currently accepted values for @var{report-action} are:
478 515
479@itemize 516@itemize
480@item A (possibly empty) list of diagnostic objects created with 517@item
518A (possibly empty) list of diagnostic objects created by
481@code{flymake-make-diagnostic}, causing Flymake to annotate the 519@code{flymake-make-diagnostic}, causing Flymake to annotate the
482buffer with this information. 520buffer with this information.
483 521
484A backend may call @var{report-fn} repeatedly in this manner, but only 522A backend may call @var{report-fn} repeatedly in this manner, but only
485until Flymake considers that the most recently requested buffer check 523until Flymake considers that the most recently requested buffer check
486is now obsolete because, say, buffer contents have changed in the 524is now obsolete, because, say, buffer contents have changed in the
487meantime. The backend is only given notice of this via a renewed call 525meantime. The backend is only given notice of this via a renewed call
488to the backend function. Thus, to prevent making obsolete reports and 526to the backend function. Thus, to prevent making obsolete reports and
489wasting resources, backend functions should first cancel any ongoing 527wasting resources, backend functions should first cancel any ongoing
490processing from previous calls. 528processing from previous calls.
491 529
492@item The symbol @code{:panic}, signaling that the backend has encountered 530@item
531The symbol @code{:panic}, signaling that the backend has encountered
493an exceptional situation and should be disabled. 532an exceptional situation and should be disabled.
494@end itemize 533@end itemize
495 534
496Currently accepted @var{report-key} arguments are: 535Currently accepted @var{report-key} arguments are:
497 536
498@itemize 537@itemize
499@item @code{:explanation}: value should give user-readable 538@item
539@code{:explanation}, whose value should give user-readable
500details of the situation encountered, if any. 540details of the situation encountered, if any.
501 541
502@item @code{:force}: value should be a boolean suggesting 542@item
543@code{:force}, whose value should be a boolean suggesting
503that Flymake consider the report even if it was somehow 544that Flymake consider the report even if it was somehow
504unexpected. 545unexpected.
505@end itemize 546@end itemize
@@ -511,7 +552,9 @@ unexpected.
511 552
512@node Flymake utility functions 553@node Flymake utility functions
513@subsection Flymake utility functions 554@subsection Flymake utility functions
555@cindex utility functions
514 556
557@cindex create diagnostic object
515Before delivering them to Flymake, backends create diagnostic objects 558Before delivering them to Flymake, backends create diagnostic objects
516by calling the function @code{flymake-make-diagnostic}. 559by calling the function @code{flymake-make-diagnostic}.
517 560
@@ -522,36 +565,41 @@ Make a Flymake diagnostic for @var{buffer}'s region from @var{beg} to
522of the problem detected in this region. 565of the problem detected in this region.
523@end deffn 566@end deffn
524 567
568@cindex buffer position from line and column number
525It is often the case with external syntax tools that a diagnostic's 569It is often the case with external syntax tools that a diagnostic's
526position is reported in terms of a line number, and sometimes a column 570position is reported in terms of a line number, and sometimes a column
527number. To convert this information into a buffer position, backends 571number. To convert this information into a buffer position, backends
528can use the following function: 572can use the following function:
529 573
530@deffn Function flymake-diag-region buffer line &optional col 574@deffn Function flymake-diag-region buffer line &optional col
531Compute @var{buffer}'s region (@var{beg} . @var{end}) corresponding to 575Compute @var{buffer}'s region (@var{beg} . @var{end}) corresponding to
532@var{line} and @var{col}. If @var{col} is nil, return a region just 576@var{line} and @var{col}. If @var{col} is nil, return a region just
533for @var{line}. Return nil if the region is invalid. 577for @var{line}. Return nil if the region is invalid.
534@end deffn 578@end deffn
535 579
580@cindex add a log message
536For troubleshooting purposes, backends may record arbitrary 581For troubleshooting purposes, backends may record arbitrary
537exceptional or erroneous situations into the Flymake log 582exceptional or erroneous situations into the Flymake log
538buffer (@pxref{Backend exceptions}): 583buffer (@pxref{Backend exceptions}):
539 584
540@deffn Macro flymake-log level msg &optional args 585@deffn Macro flymake-log level msg &optional args
541Log, at level @var{level}, the message @var{msg} formatted with 586Log, at level @var{level}, the message @var{msg} formatted with
542@var{args}. @var{level} is passed to @code{display-warning}, which is 587@var{args}. @var{level} is passed to @code{display-warning}
588(@pxref{Warning Basics,,, elisp, The Emacs Lisp reference Manual}), which is
543used to display the warning in Flymake's log buffer. 589used to display the warning in Flymake's log buffer.
544@end deffn 590@end deffn
545 591
546@node An annotated example backend 592@node An annotated example backend
547@subsection An annotated example backend 593@subsection An annotated example backend
594@cindex example of backend
595@cindex backend, annotated example
548 596
549This section presents an annotated example of a complete working 597This section presents an annotated example of a complete working
550Flymake backend. The example illustrates the process of writing a 598Flymake backend. The example illustrates the process of writing a
551backend as outlined above. 599backend as outlined above.
552 600
553The backend in question is used for checking Ruby source files. It 601The backend in question is used for checking Ruby source files. It
554uses asynchronous processes (@pxref{Asynchronous Processes,,, elisp, 602uses asynchronous sub-processes (@pxref{Asynchronous Processes,,, elisp,
555The Emacs Lisp Reference Manual}), a common technique for performing 603The Emacs Lisp Reference Manual}), a common technique for performing
556parallel processing in Emacs. 604parallel processing in Emacs.
557 605
@@ -569,39 +617,39 @@ Binding,,, elisp, The Emacs Lisp Reference Manual}) to be active.
569 (unless (executable-find 617 (unless (executable-find
570 "ruby") (error "Cannot find a suitable ruby")) 618 "ruby") (error "Cannot find a suitable ruby"))
571 ;; If a live process launched in an earlier check was found, that 619 ;; If a live process launched in an earlier check was found, that
572 ;; process is killed. When that process's sentinel eventually runs, 620 ;; process is killed. When that process's sentinel eventually runs,
573 ;; it will notice its obsoletion, since if have since reset 621 ;; it will notice its obsoletion, since it have since reset
574 ;; `ruby-flymake-proc' to a different value 622 ;; `ruby-flymake-proc' to a different value
575 ;; 623 ;;
576 (when (process-live-p ruby--flymake-proc) 624 (when (process-live-p ruby--flymake-proc)
577 (kill-process ruby--flymake-proc)) 625 (kill-process ruby--flymake-proc))
578 626
579 ;; save the current buffer, the narrowing restrinction, remove any 627 ;; Save the current buffer, the narrowing restriction, remove any
580 ;; narrowing restriction 628 ;; narrowing restriction.
581 ;; 629 ;;
582 (let ((source (current-buffer))) 630 (let ((source (current-buffer)))
583 (save-restriction 631 (save-restriction
584 (widen) 632 (widen)
585 ;; reset the `ruby--flymake-proc' process to a new process 633 ;; Reset the `ruby--flymake-proc' process to a new process
586 ;; calling the ruby tool 634 ;; calling the ruby tool.
587 ;; 635 ;;
588 (setq 636 (setq
589 ruby--flymake-proc 637 ruby--flymake-proc
590 (make-process 638 (make-process
591 :name "ruby-flymake" :noquery t :connection-type 'pipe 639 :name "ruby-flymake" :noquery t :connection-type 'pipe
592 ;; make output goes to a temporary buffer 640 ;; Make output go to a temporary buffer.
593 ;; 641 ;;
594 :buffer (generate-new-buffer " *ruby-flymake*") 642 :buffer (generate-new-buffer " *ruby-flymake*")
595 :command '("ruby" "-w" "-c") 643 :command '("ruby" "-w" "-c")
596 :sentinel 644 :sentinel
597 (lambda (proc _event) 645 (lambda (proc _event)
598 ;; Check that the process as indeed exited, as it might 646 ;; Check that the process has indeed exited, as it might
599 ;; be simply suspended 647 ;; be simply suspended.
600 ;; 648 ;;
601 (when (eq 'exit (process-status proc)) 649 (when (eq 'exit (process-status proc))
602 (unwind-protect 650 (unwind-protect
603 ;; Only proceed if `proc' is the same as 651 ;; Only proceed if `proc' is the same as
604 ;; `ruby--flymake-proc' which indicates that 652 ;; `ruby--flymake-proc', which indicates that
605 ;; `proc' is not an obsolete process. 653 ;; `proc' is not an obsolete process.
606 ;; 654 ;;
607 (if (eq proc ruby--flymake-proc) 655 (if (eq proc ruby--flymake-proc)
@@ -635,8 +683,8 @@ Binding,,, elisp, The Emacs Lisp Reference Manual}) to be active.
635 ;; check's output. 683 ;; check's output.
636 ;; 684 ;;
637 (kill-buffer (process-buffer proc))))))) 685 (kill-buffer (process-buffer proc)))))))
638 ;; send the buffer contents to the process's stdin, followed by 686 ;; Send the buffer contents to the process's stdin, followed by
639 ;; an EOF 687 ;; an EOF.
640 ;; 688 ;;
641 (process-send-region ruby--flymake-proc (point-min) (point-max)) 689 (process-send-region ruby--flymake-proc (point-min) (point-max))
642 (process-send-eof ruby--flymake-proc)))) 690 (process-send-eof ruby--flymake-proc))))
@@ -649,7 +697,7 @@ Binding,,, elisp, The Emacs Lisp Reference Manual}) to be active.
649 697
650@node The legacy Proc backend 698@node The legacy Proc backend
651@chapter The legacy ``Proc'' backend 699@chapter The legacy ``Proc'' backend
652@cindex The legacy Proc backend 700@cindex legacy proc backend
653 701
654@menu 702@menu
655* Proc customization variables:: 703* Proc customization variables::
@@ -664,15 +712,16 @@ Binding,,, elisp, The Emacs Lisp Reference Manual}) to be active.
664* Interaction with other modes:: 712* Interaction with other modes::
665@end menu 713@end menu
666 714
715@findex flymake-proc-legacy-backend
667The backend @code{flymake-proc-legacy-backend} was originally designed 716The backend @code{flymake-proc-legacy-backend} was originally designed
668to be extended for supporting new syntax check tools and error message 717to be extended for supporting new syntax check tools and error message
669patterns. It is also controlled by its own set of customization variables 718patterns. It is also controlled by its own set of customization variables
670 719
671@node Proc customization variables 720@node Proc customization variables
672@section Customization variables for the Proc backend 721@section Customization variables for the Proc backend
673@cindex Proc customization variables 722@cindex proc backend customization variables
674 723
675@table @code 724@vtable @code
676@item flymake-proc-allowed-file-name-masks 725@item flymake-proc-allowed-file-name-masks
677A list of @code{(filename-regexp, init-function, cleanup-function 726A list of @code{(filename-regexp, init-function, cleanup-function
678getfname-function)} for configuring syntax check tools. @xref{Adding 727getfname-function)} for configuring syntax check tools. @xref{Adding
@@ -696,22 +745,22 @@ line-idx col-idx err-text-idx)}. @xref{Parsing the output}.
696 745
697@item flymake-proc-diagnostic-type-pred 746@item flymake-proc-diagnostic-type-pred
698A function to classify a diagnostic text as particular type of 747A function to classify a diagnostic text as particular type of
699error. Should be a function taking an error text and returning one of 748error. Should be a function taking an error text and returning one of
700the symbols indexing @code{flymake-diagnostic-types-alist}. If non-nil 749the symbols indexing @code{flymake-diagnostic-types-alist}. If non-nil
701is returned but there is no such symbol in that table, a warning is 750is returned but there is no such symbol in that table, a warning is
702assumed. If nil is returned, an error is assumed. Can also be a 751assumed. If nil is returned, an error is assumed. Can also be a
703regular expression that should match only warnings. This variable 752regular expression that should match only warnings. This variable
704replaces the old @code{flymake-warning-re} and 753replaces the old @code{flymake-warning-re} and
705@code{flymake-warning-predicate}. 754@code{flymake-warning-predicate}.
706 755
707@item flymake-proc-compilation-prevents-syntax-check 756@item flymake-proc-compilation-prevents-syntax-check
708A flag indicating whether compilation and syntax check of the same 757A flag indicating whether compilation and syntax check of the same
709file cannot be run simultaneously. 758file cannot be run simultaneously. @xref{Interaction with other modes}.
710@end table 759@end vtable
711 760
712@node Adding support for a new syntax check tool 761@node Adding support for a new syntax check tool
713@section Adding support for a new syntax check tool 762@section Adding support for a new syntax check tool
714@cindex Adding support for a new syntax check tool 763@cindex adding support for a new syntax check tool
715 764
716@menu 765@menu
717* Example---Configuring a tool called directly:: 766* Example---Configuring a tool called directly::
@@ -753,10 +802,9 @@ will be different from the real ones, as actually the tool works with
753the temporary copy. In most cases, the default implementation 802the temporary copy. In most cases, the default implementation
754provided by Flymake, @code{flymake-proc-get-real-file-name}, can be 803provided by Flymake, @code{flymake-proc-get-real-file-name}, can be
755used as @code{getfname-function}. 804used as @code{getfname-function}.
756
757@end table 805@end table
758 806
759To add support for a new syntax check tool, write corresponding 807To add support for a new syntax check tool, write the corresponding
760@code{init-function} and, optionally, @code{cleanup-function} and 808@code{init-function} and, optionally, @code{cleanup-function} and
761@code{getfname-function}. If the format of error messages reported by 809@code{getfname-function}. If the format of error messages reported by
762the new tool is not yet supported by Flymake, add a new entry to 810the new tool is not yet supported by Flymake, add a new entry to
@@ -767,10 +815,10 @@ support for various syntax check tools.
767 815
768@node Example---Configuring a tool called directly 816@node Example---Configuring a tool called directly
769@subsection Example---Configuring a tool called directly 817@subsection Example---Configuring a tool called directly
770@cindex Adding support for perl 818@cindex adding support for perl
771 819
772In this example, we will add support for @code{perl} as a syntax check 820In this example, we will add support for @command{perl} as a syntax check
773tool. @code{perl} supports the @code{-c} option which does syntax 821tool. @command{perl} supports the @option{-c} option which does syntax
774checking. 822checking.
775 823
776First, we write the @code{init-function}: 824First, we write the @code{init-function}:
@@ -816,7 +864,7 @@ Finally, we add an entry to @code{flymake-proc-err-line-patterns}:
816 864
817@node Example---Configuring a tool called via make 865@node Example---Configuring a tool called via make
818@subsection Example---Configuring a tool called via make 866@subsection Example---Configuring a tool called via make
819@cindex Adding support for C (gcc+make) 867@cindex adding support for C (gcc+make)
820 868
821In this example we will add support for C files syntax checked by 869In this example we will add support for C files syntax checked by
822@command{gcc} called via @command{make}. 870@command{gcc} called via @command{make}.
@@ -846,9 +894,10 @@ command line:
846 "check-syntax")) 894 "check-syntax"))
847@end lisp 895@end lisp
848 896
849@code{base-dir} is a directory containing @code{Makefile}, see @ref{Locating the buildfile}. 897@code{base-dir} is a directory containing the @file{Makefile}, see
898@ref{Locating the buildfile}.
850 899
851Thus, @code{Makefile} must contain the @code{check-syntax} target. In 900Thus, @file{Makefile} must contain the @code{check-syntax} target. In
852our case this target might look like this: 901our case this target might look like this:
853 902
854@verbatim 903@verbatim
@@ -870,11 +919,11 @@ check-syntax:
870 919
871@node Implementation overview 920@node Implementation overview
872@section Implementation overview 921@section Implementation overview
873@cindex Syntax check models 922@cindex syntax check models
874@cindex Master file 923@cindex master file
875 924
876@code{flymake-proc-legacy-backend} saves a copy of the buffer in a 925@code{flymake-proc-legacy-backend} saves a copy of the buffer in a
877temporary file in the buffer's directory (or in the system temp 926temporary file in the buffer's directory (or in the system temporary
878directory, for Java files), creates a syntax check command and 927directory, for Java files), creates a syntax check command and
879launches a process with this command. The output is parsed using a 928launches a process with this command. The output is parsed using a
880list of error message patterns, and error information (file name, line 929list of error message patterns, and error information (file name, line
@@ -893,15 +942,15 @@ Two syntax check modes are distinguished:
893@item 942@item
894Buffer can be syntax checked in a standalone fashion, that is, the 943Buffer can be syntax checked in a standalone fashion, that is, the
895file (its temporary copy, in fact) can be passed over to the compiler to 944file (its temporary copy, in fact) can be passed over to the compiler to
896do the syntax check. Examples are C/C++ (.c, .cpp) and Java (.java) 945do the syntax check. Examples are C/C@t{++} sources (@file{.c},
897sources. 946@file{.cpp}) and Java (@file{.java}).
898 947
899@item 948@item
900Buffer can be syntax checked, but additional file, called master file, 949Buffer can be syntax checked, but additional file, called master file,
901is required to perform this operation. A master file is a file that 950is required to perform this operation. A master file is a file that
902includes the current file, so that running a syntax check tool on it 951includes the current file, so that running a syntax check tool on it
903will also check syntax in the current file. Examples are C/C++ (.h, 952will also check syntax in the current file. Examples are C/C@t{++}
904.hpp) headers. 953headers (@file{.h}, @file{.hpp}).
905 954
906@end enumerate 955@end enumerate
907 956
@@ -916,8 +965,7 @@ tool-specific (routines for Make, Ant, etc.)@: code.
916 965
917@node Making a temporary copy 966@node Making a temporary copy
918@section Making a temporary copy 967@section Making a temporary copy
919@cindex Temporary copy of the buffer 968@cindex temporary copy of the buffer
920@cindex Master file
921 969
922After the possibility of the syntax check has been determined, a 970After the possibility of the syntax check has been determined, a
923temporary copy of the current buffer is made so that the most recent 971temporary copy of the current buffer is made so that the most recent
@@ -929,9 +977,10 @@ Things get trickier, however, when master file is involved, as it
929requires to 977requires to
930 978
931@itemize @bullet 979@itemize @bullet
932@item locate a master file 980@item
933@item patch it to include the current file using its new (temporary) 981locate a master file
934name. 982@item
983patch it to include the current file using its new (temporary) name.
935@end itemize 984@end itemize
936 985
937Locating a master file is discussed in the following section. 986Locating a master file is discussed in the following section.
@@ -947,37 +996,39 @@ the syntax check tool.
947 996
948@node Locating a master file 997@node Locating a master file
949@section Locating a master file 998@section Locating a master file
950@cindex Master file 999@cindex locating a master file
1000@cindex master file, locating
951 1001
952Master file is located in two steps. 1002Master file is located in two steps.
953 1003
954First, a list of possible master files is built. A simple name 1004First, a list of possible master files is built. A simple name
955matching is used to find the files. For a C++ header @code{file.h}, 1005matching is used to find the files. For a C++ header @file{file.h},
956the Proc backend searches for all @code{.cpp} files in the directories 1006the Proc backend searches for all @file{.cpp} files in the directories
957whose relative paths are stored in a customizable variable 1007whose relative paths are stored in a customizable variable
958@code{flymake-proc-master-file-dirs}, which usually contains something 1008@code{flymake-proc-master-file-dirs}, which usually contains something
959like @code{("." "./src")}. No more than 1009like @code{("." "./src")}. No more than
960@code{flymake-proc-master-file-count-limit} entries is added to the 1010@code{flymake-proc-master-file-count-limit} entries is added to the
961master file list. The list is then sorted to move files with names 1011master file list. The list is then sorted to move files with names
962@code{file.cpp} to the top. 1012@file{file.cpp} to the top.
963 1013
964Next, each master file in a list is checked to contain the appropriate 1014Next, each master file in a list is checked to contain the appropriate
965include directives. No more than @code{flymake-proc-check-file-limit} of each 1015include directives. No more than @code{flymake-proc-check-file-limit} of each
966file are parsed. 1016file are parsed.
967 1017
968For @code{file.h}, the include directives to look for are 1018For @file{file.h}, the include directives to look for are
969@code{#include "file.h"}, @code{#include "../file.h"}, etc. Each 1019@code{#include "file.h"}, @code{#include "../file.h"}, etc. Each
970include is checked against a list of include directories 1020include is checked against a list of include directories
971(see @ref{Getting the include directories}) to be sure it points to the 1021(see @ref{Getting the include directories}) to be sure it points to the
972correct @code{file.h}. 1022correct @file{file.h}.
973 1023
974First matching master file found stops the search. The master file is then 1024First matching master file found stops the search. The master file is then
975patched and saved to disk. In case no master file is found, syntax check is 1025patched and saved to disk. In case no master file is found, syntax check is
976aborted, and corresponding status (!) is reported in the mode line. 1026aborted, and corresponding status (@samp{!}) is reported in the mode line.
1027@xref{Syntax check statuses}.
977 1028
978@node Getting the include directories 1029@node Getting the include directories
979@section Getting the include directories 1030@section Getting the include directories
980@cindex Include directories (C/C++ specific) 1031@cindex include directories (C/C++ specific)
981 1032
982Two sets of include directories are distinguished: system include directories 1033Two sets of include directories are distinguished: system include directories
983and project include directories. The former is just the contents of the 1034and project include directories. The former is just the contents of the
@@ -997,25 +1048,26 @@ of every syntax check attempt.
997 1048
998@node Locating the buildfile 1049@node Locating the buildfile
999@section Locating the buildfile 1050@section Locating the buildfile
1000@cindex Locating the buildfile 1051@cindex locating the buildfile
1001@cindex buildfile, locating 1052@cindex buildfile, locating
1002@cindex Makefile, locating 1053@cindex Makefile, locating
1003 1054
1004The Proc backend can be configured to use different tools for 1055The Proc backend can be configured to use different tools for
1005performing syntax checks. For example, it can use direct compiler 1056performing syntax checks. For example, it can use direct compiler
1006call to syntax check a perl script or a call to @command{make} for a 1057call to syntax check a perl script or a call to @command{make} for a
1007more complicated case of a @code{C/C++} source. The general idea is 1058more complicated case of a C/C@t{++} source. The general idea is
1008that simple files, like perl scripts and html pages, can be checked by 1059that simple files, like Perl scripts and @acronym{HTML} pages, can be checked by
1009directly invoking a corresponding tool. Files that are usually more 1060directly invoking a corresponding tool. Files that are usually more
1010complex and generally used as part of larger projects, might require 1061complex and generally used as part of larger projects, might require
1011non-trivial options to be passed to the syntax check tool, like 1062non-trivial options to be passed to the syntax check tool, like
1012include directories for C++. The latter files are syntax checked 1063include directories for C@t{++}. The latter files are syntax checked
1013using some build tool, like Make or Ant. 1064using some build tool, like Make or Ant.
1014 1065
1015All Make configuration data is usually stored in a file called 1066All Make configuration data is usually stored in a file called
1016@code{Makefile}. To allow for future extensions, Flymake uses a notion of 1067@file{Makefile}. To allow for future extensions, Flymake uses a notion of
1017buildfile to reference the 'project configuration' file. 1068buildfile to reference the @dfn{project configuration} file.
1018 1069
1070@findex flymake-proc-find-buildfile
1019Special function, @code{flymake-proc-find-buildfile} is provided for locating buildfiles. 1071Special function, @code{flymake-proc-find-buildfile} is provided for locating buildfiles.
1020Searching for a buildfile is done in a manner similar to that of searching 1072Searching for a buildfile is done in a manner similar to that of searching
1021for possible master files. 1073for possible master files.
@@ -1024,13 +1076,13 @@ A customizable variable
1024@code{flymake-proc-buildfile-dirs} holds a list of relative paths to the 1076@code{flymake-proc-buildfile-dirs} holds a list of relative paths to the
1025buildfile. They are checked sequentially until a buildfile is found. 1077buildfile. They are checked sequentially until a buildfile is found.
1026@end ignore 1078@end ignore
1027In case there's no build file, syntax check is aborted. 1079In case there's no build file, the syntax check is aborted.
1028 1080
1029Buildfile values are also cached. 1081Buildfile values are also cached.
1030 1082
1031@node Starting the syntax check process 1083@node Starting the syntax check process
1032@section Starting the syntax check process 1084@section Starting the syntax check process
1033@cindex Syntax check process 1085@cindex syntax check process, legacy proc backend
1034 1086
1035The command line (command name and the list of arguments) for 1087The command line (command name and the list of arguments) for
1036launching a process is returned by the initialization function. The 1088launching a process is returned by the initialization function. The
@@ -1041,16 +1093,16 @@ be killed without prompting the user.
1041 1093
1042@node Parsing the output 1094@node Parsing the output
1043@section Parsing the output 1095@section Parsing the output
1044@cindex Parsing the output 1096@cindex parsing the output, legacy proc backend
1045 1097
1046The output generated by the syntax check tool is parsed in the process 1098The output generated by the syntax check tool is parsed in the process
1047filter/sentinel using the error message patterns stored in the 1099filter/sentinel using the error message patterns stored in the
1048@code{flymake-proc-err-line-patterns} variable. This variable contains a 1100@code{flymake-proc-err-line-patterns} variable. This variable contains a
1049list of items of the form @code{(regexp file-idx line-idx 1101list of items of the form @w{@code{(regexp file-idx line-idx
1050err-text-idx)}, used to determine whether a particular line is an 1102err-text-idx)}}, used to determine whether a particular line is an
1051error message and extract file name, line number and error text, 1103error message and extract file name, line number and error text,
1052respectively. Error type (error/warning) is also guessed by matching 1104respectively. Error type (error/warning) is also guessed by matching
1053error text with the '@code{^[wW]arning}' pattern. Anything that was not 1105error text with the @samp{^[wW]arning} pattern. Anything that was not
1054classified as a warning is considered an error. Type is then used to 1106classified as a warning is considered an error. Type is then used to
1055sort error menu items, which shows error messages first. 1107sort error menu items, which shows error messages first.
1056 1108
@@ -1058,7 +1110,7 @@ The Proc backend is also able to interpret error message patterns
1058missing err-text-idx information. This is done by merely taking the 1110missing err-text-idx information. This is done by merely taking the
1059rest of the matched line (@code{(substring line (match-end 0))}) as 1111rest of the matched line (@code{(substring line (match-end 0))}) as
1060error text. This trick allows making use of a huge collection of 1112error text. This trick allows making use of a huge collection of
1061error message line patterns from @code{compile.el}. All these error 1113error message line patterns from @file{compile.el}. All these error
1062patterns are appended to the end of 1114patterns are appended to the end of
1063@code{flymake-proc-err-line-patterns}. 1115@code{flymake-proc-err-line-patterns}.
1064 1116
@@ -1069,8 +1121,8 @@ after every process launch/exit.
1069 1121
1070@node Interaction with other modes 1122@node Interaction with other modes
1071@section Interaction with other modes 1123@section Interaction with other modes
1072@cindex Interaction with other modes 1124@cindex interaction with other modes, legacy proc backend
1073@cindex Interaction with compile mode 1125@cindex interaction with compile mode, legacy proc backend
1074 1126
1075The only mode the Proc backend currently knows about is 1127The only mode the Proc backend currently knows about is
1076@code{compile}. 1128@code{compile}.
@@ -1084,8 +1136,9 @@ though, was working around a locking problem with MS Visual C++
1084compiler. The variable in question is 1136compiler. The variable in question is
1085@code{flymake-proc-compilation-prevents-syntax-check}. 1137@code{flymake-proc-compilation-prevents-syntax-check}.
1086 1138
1139@findex flymake-proc-compile
1087The Proc backend also provides an alternative command for starting 1140The Proc backend also provides an alternative command for starting
1088compilation, @code{flymake-proc-compile}. It just kills all the active 1141compilation, @code{flymake-proc-compile}. It just kills all the active
1089syntax check processes before calling @code{compile}. 1142syntax check processes before calling @code{compile}.
1090 1143
1091@node GNU Free Documentation License 1144@node GNU Free Documentation License