aboutsummaryrefslogtreecommitdiffstats
path: root/doc/misc
diff options
context:
space:
mode:
authorStefan Monnier2017-10-06 09:50:54 -0400
committerStefan Monnier2017-10-06 09:50:54 -0400
commit11f9cb522fed9aa6552f6315340ca7352661a1e8 (patch)
tree39facc48471c67b321c045e47d70ef030adbea44 /doc/misc
parent92045f4546b9708dc9f69954799d211c1f56ff1e (diff)
parent9655937da4a339300c624addd97674c038a01bc9 (diff)
downloademacs-11f9cb522fed9aa6552f6315340ca7352661a1e8.tar.gz
emacs-11f9cb522fed9aa6552f6315340ca7352661a1e8.zip
Merge emacs-26
Diffstat (limited to 'doc/misc')
-rw-r--r--doc/misc/flymake.texi550
-rw-r--r--doc/misc/org.texi19
2 files changed, 252 insertions, 317 deletions
diff --git a/doc/misc/flymake.texi b/doc/misc/flymake.texi
index 1bc416fd02e..5ff5537d048 100644
--- a/doc/misc/flymake.texi
+++ b/doc/misc/flymake.texi
@@ -4,7 +4,7 @@
4@set VERSION 0.3 4@set VERSION 0.3
5@set UPDATED April 2004 5@set UPDATED April 2004
6@settitle GNU Flymake @value{VERSION} 6@settitle GNU Flymake @value{VERSION}
7@include docstyle.texi 7@include ../emacs/docstyle.texi
8@syncodeindex pg cp 8@syncodeindex pg cp
9@comment %**end of header 9@comment %**end of header
10 10
@@ -35,7 +35,7 @@ modify this GNU manual.''
35@titlepage 35@titlepage
36@title GNU Flymake 36@title GNU Flymake
37@subtitle for version @value{VERSION}, @value{UPDATED} 37@subtitle for version @value{VERSION}, @value{UPDATED}
38@author Pavel Kobiakov(@email{pk_at_work@@yahoo.com}) 38@author Pavel Kobiakov(@email{pk_at_work@@yahoo.com}) and João Távora.
39@page 39@page
40@vskip 0pt plus 1filll 40@vskip 0pt plus 1filll
41@insertcopying 41@insertcopying
@@ -53,8 +53,8 @@ modify this GNU manual.''
53* Overview of Flymake:: 53* Overview of Flymake::
54* Installing Flymake:: 54* Installing Flymake::
55* Using Flymake:: 55* Using Flymake::
56* Configuring Flymake:: 56* Extending Flymake::
57* Flymake Implementation:: 57* The legacy Proc backend::
58* GNU Free Documentation License:: 58* GNU Free Documentation License::
59* Index:: 59* Index::
60@end menu 60@end menu
@@ -63,67 +63,56 @@ modify this GNU manual.''
63@chapter Overview 63@chapter Overview
64@cindex Overview of Flymake 64@cindex Overview of Flymake
65 65
66Flymake is a universal on-the-fly syntax checker implemented as an 66Flymake is a universal on-the-fly buffer checker implemented as an
67Emacs minor mode. Flymake runs the pre-configured syntax check tool 67Emacs minor mode. When enabled, Flymake visually annotates the buffer
68(compiler for C++ files, @code{perl} for perl files, etc.)@: in the 68with diagnostic information coming from one or more different sources,
69background, passing it a temporary copy of the current buffer, and 69or @emph{backends}.
70parses the output for known error/warning message patterns. Flymake 70
71then highlights erroneous lines (i.e., lines for which at least one 71Historically, Flymake used to accept diagnostics from a single, albeit
72error or warning has been reported by the syntax check tool), and 72reasonably flexible, backend.
73displays an overall buffer status in the mode line. Status information 73
74displayed by Flymake contains total number of errors and warnings 74This backend isn't (yet) obsolete and so is still available as a
75reported for the buffer during the last syntax check. 75fallback and active by default(@pxref{The legacy Proc backend}). It works by
76 76selecting a syntax check tool from a preconfigured list (compiler for
77@code{flymake-goto-next-error} and @code{flymake-goto-prev-error} 77C++ files, @code{perl} for perl files, etc.), and executing it in the
78functions allow for easy navigation to the next/previous erroneous 78background, passing it a temporary file which is a copy of the current
79line, respectively. 79buffer, and parsing the output for known error/warning message
80 80patterns.
81Calling @code{flymake-display-err-menu-for-current-line} will popup a 81
82menu containing error messages reported by the syntax check tool for 82Flymake annotates the buffer by highlighting problematic buffer
83the current line. Errors/warnings belonging to another file, such as a 83regions with a special space. It also displays an overall buffer
84@code{.h} header file included by a @code{.c} file, are shown in the 84status in the mode line. Status information displayed by Flymake
85current buffer as belonging to the first line. Menu items for such 85contains totals for different types of diagnostics.
86messages also contain a filename and a line number. Selecting such a 86
87menu item will automatically open the file and jump to the line with 87@code{flymake-goto-next-error} and @code{flymake-goto-prev-error} are
88error. 88commands that allow easy navigation to the next/previous erroneous
89line, respectively. If might be a good idea to map them to @kbd{M-n}
90and @kbd{M-p} in @code{flymake-mode}, by adding to your init file:
91
92@lisp
93(define-key flymake-mode-map (kbd "M-n") 'flymake-goto-next-error)
94(define-key flymake-mode-map (kbd "M-p") 'flymake-goto-prev-error)
95@end lisp
89 96
90Syntax check is done ``on-the-fly''. It is started whenever 97Syntax check is done ``on-the-fly''. It is started whenever
91 98
92@itemize @bullet 99@itemize @bullet
93@item buffer is loaded 100@item @code{flymake-mode} is started;
94@item a newline character is added to the buffer 101@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 102@item some changes were made to the buffer more than @code{0.5} seconds ago (the
96delay is configurable). 103delay is configurable).
97@end itemize 104@end itemize
98 105
99Flymake is a universal syntax checker in the sense that it's easily 106Flymake is a universal syntax checker in the sense that it's easily
100extended to support new syntax check tools and error message 107extended to support new backends. @xref{Customizable variables}.
101patterns. @xref{Configuring Flymake}.
102 108
103@node Installing Flymake 109@node Installing Flymake
104@chapter Installing 110@chapter Installing
105@cindex Installing Flymake 111@cindex Installing Flymake
106 112
107 113Flymake is included with Emacs and its main commands, like
108Flymake is packaged in a single file, @code{flymake.el}. 114@code{flymake-mode}, are autoloaded. This means there is usually
109 115nothing to do by way of installation.
110To install/update Flymake, place @code{flymake.el} to a directory
111somewhere on Emacs load path. You might also want to byte-compile
112@code{flymake.el} to improve performance.
113
114Also, place the following line in the @code{.emacs} file.
115
116@lisp
117(require 'flymake)
118@end lisp
119
120You might also map the most frequently used Flymake functions, such as
121@code{flymake-goto-next-error}, to some keyboard shortcuts:
122
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
127 116
128@node Using Flymake 117@node Using Flymake
129@chapter Using Flymake 118@chapter Using Flymake
@@ -132,10 +121,10 @@ You might also map the most frequently used Flymake functions, such as
132@menu 121@menu
133* Flymake mode:: 122* Flymake mode::
134* Running the syntax check:: 123* Running the syntax check::
135* Navigating to error lines:: 124* Navigating to error lines:: @c * Viewing error messages::
136* Viewing error messages::
137* Syntax check statuses:: 125* Syntax check statuses::
138* Troubleshooting:: 126* Troubleshooting::
127* Customizable variables::
139@end menu 128@end menu
140 129
141@node Flymake mode 130@node Flymake mode
@@ -161,10 +150,8 @@ line in @code{.emacs}:
161 150
162When @code{flymake-mode} is active, syntax check is started 151When @code{flymake-mode} is active, syntax check is started
163automatically on any of the three conditions mentioned above. Syntax 152automatically on any of the three conditions mentioned above. Syntax
164check can also be started manually by using the 153check can also be started manually by using the @code{flymake-start}
165@code{flymake-start-syntax-check-for-current-buffer} function. This 154function.
166can be used, for example, when changes were made to some other buffer
167affecting the current buffer.
168 155
169@node Navigating to error lines 156@node Navigating to error lines
170@section Navigating to error lines 157@section Navigating to error lines
@@ -185,69 +172,37 @@ navigate the highlighted lines.
185 172
186@end multitable 173@end multitable
187 174
188These functions treat erroneous lines as a linked list. Therefore, 175If the user option @code{flymake-wrap-around} is active
189@code{flymake-goto-next-error} will go to the first erroneous line 176(@pxref{Customizable variables}), these functions treat diagnostics
190when invoked in the end of the buffer. 177as a linked list. Therefore, @code{flymake-goto-next-error} will go
191 178to the first diagnostic when invoked in the end of the buffer.
192@node Viewing error messages
193@section Viewing error messages
194@cindex Viewing error messages
195
196To view error messages belonging to the current line, use the
197@code{flymake-display-err-menu-for-current-line} function. If there's
198at least one error or warning reported for the current line, this
199function will display a popup menu with error/warning texts.
200Selecting the menu item whose error belongs to another file brings
201forward that file with the help of the
202@code{flymake-goto-file-and-line} function.
203 179
204@node Syntax check statuses 180@node Syntax check statuses
205@section Syntax check statuses 181@section Syntax check statuses
206@cindex Syntax check statuses 182@cindex Syntax check statuses
207 183
208After syntax check is finished, its status is displayed in the mode line. 184After syntax check is finished, its status is displayed in the mode line.
209The following statuses are defined. 185The following statuses are defined:
210
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
214error and warning count for the previous run.
215
216@item Flymake
217@tab Syntax check is not running. Usually this means syntax check was
218successfully passed (no errors, no warnings). Other possibilities are:
219syntax check was killed as a result of executing
220@code{flymake-compile}, or syntax check cannot start as compilation
221is currently in progress.
222
223@item Flymake:E/W
224@tab Number of errors/warnings found by the syntax check process.
225
226@item Flymake:!
227@tab Flymake was unable to find master file for the current buffer.
228@end multitable
229
230The following errors cause a warning message and switch flymake mode
231OFF for the buffer.
232 186
233@multitable @columnfractions 0.25 0.75 187@multitable @columnfractions 0.25 0.75
234@item CFGERR 188@item @code{Wait}
235@tab Syntax check process returned nonzero exit code, but no 189@tab Some flymake backends haven't reported since the last time they
236errors/warnings were reported. This indicates a possible configuration 190where questioned.
237error (for example, no suitable error message patterns for the 191
238syntax check tool). 192@item @code{!}
239 193@tab All the configured Flymake backends have disabled themselves.
240@item NOMASTER 194Left-clicking the ``Flymake'' mode line indicator beings the user
241@tab Flymake was unable to find master file for the current buffer. 195@code{*Flymake log*} buffer where these situations may be investigated
242 196
243@item NOMK 197@item @code{?}
244@tab Flymake was unable to find a suitable buildfile for the current buffer. 198@tab There are no configured Flymake backends in
245 199@code{flymake-diagnostic-functions}.
246@item PROCERR 200
247@tab Flymake was unable to launch a syntax check process. 201@item @emph{[nerrors nwarnings]}
202@tab Normal operation, number of errors/warnings found by the syntax
203check process.
248@end multitable 204@end multitable
249 205
250
251@node Troubleshooting 206@node Troubleshooting
252@section Troubleshooting 207@section Troubleshooting
253@cindex Logging 208@cindex Logging
@@ -255,70 +210,20 @@ syntax check tool).
255 210
256Flymake uses a simple logging facility for indicating important points 211Flymake uses a simple logging facility for indicating important points
257in the control flow. The logging facility sends logging messages to 212in the control flow. The logging facility sends logging messages to
258the @file{*Messages*} buffer. The information logged can be used for 213the @file{*Flymake log*} buffer. The information logged can be used for
259resolving various problems related to Flymake. 214resolving various problems related to Flymake.
260 215
261Logging output is controlled by the @code{flymake-log-level} 216Logging output is controlled by the Emacs @code{warning-minimum-log-level}
262variable. @code{3} is the most verbose level, and @code{-1} switches 217and @code{warning-minimum-level} variables.
263logging off.
264
265@node Configuring Flymake
266@chapter Configuring and Extending Flymake
267@cindex Configuring and Extending Flymake
268
269@menu
270* Customizable variables::
271* Adding support for a new syntax check tool::
272@end menu
273
274Flymake was designed to be easily extended for supporting new syntax
275check tools and error message patterns.
276 218
277@node Customizable variables 219@node Customizable variables
278@section Customizable variables 220@section Customizable variables
279@cindex Customizable variables 221@cindex Customizable variables
280 222
281This section summarizes variables used for Flymake 223This section summarizes variables used for the configuration of the
282configuration. 224Flymake user interface.
283 225
284@table @code 226@table @code
285@item flymake-log-level
286Controls logging output, see @ref{Troubleshooting}.
287
288@item flymake-allowed-file-name-masks
289A list of @code{(filename-regexp, init-function, cleanup-function
290getfname-function)} for configuring syntax check tools. @xref{Adding
291support for a new syntax check tool}.
292
293@ignore
294@item flymake-buildfile-dirs
295A list of directories (relative paths) for searching a
296buildfile. @xref{Locating the buildfile}.
297@end ignore
298
299@item flymake-master-file-dirs
300A list of directories for searching a master file. @xref{Locating a
301master file}.
302
303@item flymake-get-project-include-dirs-function
304A function used for obtaining a list of project include dirs (C/C++
305specific). @xref{Getting the include directories}.
306
307@item flymake-master-file-count-limit
308@itemx flymake-check-file-limit
309Used when looking for a master file. @xref{Locating a master file}.
310
311@item flymake-err-line-patterns
312Patterns for error/warning messages in the form @code{(regexp file-idx
313line-idx col-idx err-text-idx)}. @xref{Parsing the output}.
314
315@item flymake-warning-predicate
316Predicate to classify error text as warning. @xref{Parsing the output}.
317
318@item flymake-compilation-prevents-syntax-check
319A flag indicating whether compilation and syntax check of the same
320file cannot be run simultaneously.
321
322@item flymake-no-changes-timeout 227@item flymake-no-changes-timeout
323If any changes are made to the buffer, syntax check is automatically 228If any changes are made to the buffer, syntax check is automatically
324started after @code{flymake-no-changes-timeout} seconds. 229started after @code{flymake-no-changes-timeout} seconds.
@@ -327,13 +232,17 @@ started after @code{flymake-no-changes-timeout} seconds.
327A boolean flag indicating whether to start syntax check after a 232A boolean flag indicating whether to start syntax check after a
328newline character is added to the buffer. 233newline character is added to the buffer.
329 234
330@item flymake-errline 235@item flymake-error
331A custom face for highlighting lines for which at least one error has 236A custom face for highlighting regions for which an error has been
332been reported. 237reported.
238
239@item flymake-warning
240A custom face for highlighting regions for which a warning has been
241reported.
333 242
334@item flymake-warnline 243@item flymake-note
335A custom face for highlighting lines for which at least one warning 244A custom face for highlighting regions for which a note has been
336and no errors have been reported. 245reported.
337 246
338@item flymake-error-bitmap 247@item flymake-error-bitmap
339A bitmap used in the fringe to mark lines for which an error has 248A bitmap used in the fringe to mark lines for which an error has
@@ -346,6 +255,76 @@ been reported.
346@item flymake-fringe-indicator-position 255@item flymake-fringe-indicator-position
347Which fringe (if any) should show the warning/error bitmaps. 256Which fringe (if any) should show the warning/error bitmaps.
348 257
258@item flymake-wrap-around
259If non-nil, moving to errors with @code{flymake-goto-next-error} and
260@code{flymake-goto-prev-error} wraps around buffer boundaries.
261
262@end table
263
264@node Extending Flymake
265@chapter Extending Flymake
266@cindex Extending Flymake
267
268@node The legacy Proc backend
269@chapter The legacy ``Proc'' backend
270@cindex The legacy Proc backend
271
272@menu
273* Proc customization variables::
274* Adding support for a new syntax check tool::
275* Implementation overview::
276* Making a temporary copy::
277* Locating a master file::
278* Getting the include directories::
279* Locating the buildfile::
280* Starting the syntax check process::
281* Parsing the output::
282* Interaction with other modes::
283@end menu
284
285The backend @code{flymake-proc-legacy-backend} was originally designed
286to be extended for supporting new syntax check tools and error message
287patterns. It is also controlled by its own set of customization variables
288
289@node Proc customization variables
290@section Customization variables for the Proc backend
291@cindex Proc customization variables
292
293@table @code
294@item flymake-proc-allowed-file-name-masks
295A list of @code{(filename-regexp, init-function, cleanup-function
296getfname-function)} for configuring syntax check tools. @xref{Adding
297support for a new syntax check tool}.
298
299@item flymake-proc-master-file-dirs
300A list of directories for searching a master file. @xref{Locating a
301master file}.
302
303@item flymake-proc-get-project-include-dirs-function
304A function used for obtaining a list of project include dirs (C/C++
305specific). @xref{Getting the include directories}.
306
307@item flymake-proc-master-file-count-limit
308@itemx flymake-proc-check-file-limit
309Used when looking for a master file. @xref{Locating a master file}.
310
311@item flymake-proc-err-line-patterns
312Patterns for error/warning messages in the form @code{(regexp file-idx
313line-idx col-idx err-text-idx)}. @xref{Parsing the output}.
314
315@item flymake-proc-diagnostic-type-pred
316A function to classify a diagnostic text as particular type of
317error. Should be a function taking an error text and returning one of
318the symbols indexing @code{flymake-diagnostic-types-alist}. If non-nil
319is returned but there is no such symbol in that table, a warning is
320assumed. If nil is returned, an error is assumed. Can also be a
321regular expression that should match only warnings. This variable
322replaces the old @code{flymake-warning-re} and
323@code{flymake-warning-predicate}.
324
325@item flymake-proc-compilation-prevents-syntax-check
326A flag indicating whether compilation and syntax check of the same
327file cannot be run simultaneously.
349@end table 328@end table
350 329
351@node Adding support for a new syntax check tool 330@node Adding support for a new syntax check tool
@@ -358,7 +337,7 @@ Which fringe (if any) should show the warning/error bitmaps.
358@end menu 337@end menu
359 338
360Syntax check tools are configured using the 339Syntax check tools are configured using the
361@code{flymake-allowed-file-name-masks} list. Each item of this list 340@code{flymake-proc-allowed-file-name-masks} list. Each item of this list
362has the following format: 341has the following format:
363 342
364@lisp 343@lisp
@@ -369,15 +348,15 @@ has the following format:
369@item filename-regexp 348@item filename-regexp
370This field is used as a key for locating init/cleanup/getfname 349This field is used as a key for locating init/cleanup/getfname
371functions for the buffer. Items in 350functions for the buffer. Items in
372@code{flymake-allowed-file-name-masks} are searched sequentially. The 351@code{flymake-proc-allowed-file-name-masks} are searched sequentially.
373first item with @code{filename-regexp} matching buffer filename is 352The first item with @code{filename-regexp} matching buffer filename is
374selected. If no match is found, @code{flymake-mode} is switched off. 353selected. If no match is found, @code{flymake-mode} is switched off.
375 354
376@item init-function 355@item init-function
377@code{init-function} is required to initialize the syntax check, 356@code{init-function} is required to initialize the syntax check,
378usually by creating a temporary copy of the buffer contents. The 357usually by creating a temporary copy of the buffer contents. The
379function must return @code{(list cmd-name arg-list)}. If 358function must return @code{(list cmd-name arg-list)}. If
380@code{init-function} returns null, syntax check is aborted, by 359@code{init-function} returns null, syntax check is aborted, but
381@code{flymake-mode} is not switched off. 360@code{flymake-mode} is not switched off.
382 361
383@item cleanup-function 362@item cleanup-function
@@ -390,16 +369,16 @@ This function is used for translating filenames reported by the syntax
390check tool into ``real'' filenames. Filenames reported by the tool 369check tool into ``real'' filenames. Filenames reported by the tool
391will be different from the real ones, as actually the tool works with 370will be different from the real ones, as actually the tool works with
392the temporary copy. In most cases, the default implementation 371the temporary copy. In most cases, the default implementation
393provided by Flymake, @code{flymake-get-real-file-name}, can be used as 372provided by Flymake, @code{flymake-proc-get-real-file-name}, can be
394@code{getfname-function}. 373used as @code{getfname-function}.
395 374
396@end table 375@end table
397 376
398To add support for a new syntax check tool, write corresponding 377To add support for a new syntax check tool, write corresponding
399@code{init-function}, and, optionally @code{cleanup-function} and 378@code{init-function} and, optionally, @code{cleanup-function} and
400@code{getfname-function}. If the format of error messages reported by 379@code{getfname-function}. If the format of error messages reported by
401the new tool is not yet supported by Flymake, add a new entry to 380the new tool is not yet supported by Flymake, add a new entry to
402the @code{flymake-err-line-patterns} list. 381the @code{flymake-proc-err-line-patterns} list.
403 382
404The following sections contain some examples of configuring Flymake 383The following sections contain some examples of configuring Flymake
405support for various syntax check tools. 384support for various syntax check tools.
@@ -415,42 +394,42 @@ checking.
415First, we write the @code{init-function}: 394First, we write the @code{init-function}:
416 395
417@lisp 396@lisp
418(defun flymake-perl-init () 397(defun flymake-proc-perl-init ()
419 (let* ((temp-file (flymake-init-create-temp-buffer-copy 398 (let* ((temp-file (flymake-proc-init-create-temp-buffer-copy
420 'flymake-create-temp-inplace)) 399 'flymake-proc-create-temp-inplace))
421 (local-file (file-relative-name 400 (local-file (file-relative-name
422 temp-file 401 temp-file
423 (file-name-directory buffer-file-name)))) 402 (file-name-directory buffer-file-name))))
424 (list "perl" (list "-wc " local-file)))) 403 (list "perl" (list "-wc " local-file))))
425@end lisp 404@end lisp
426 405
427@code{flymake-perl-init} creates a temporary copy of the buffer 406@code{flymake-proc-perl-init} creates a temporary copy of the buffer
428contents with the help of 407contents with the help of
429@code{flymake-init-create-temp-buffer-copy}, and builds an appropriate 408@code{flymake-proc-init-create-temp-buffer-copy}, and builds an appropriate
430command line. 409command line.
431 410
432Next, we add a new entry to the 411Next, we add a new entry to the
433@code{flymake-allowed-file-name-masks}: 412@code{flymake-proc-allowed-file-name-masks}:
434 413
435@lisp 414@lisp
436(setq flymake-allowed-file-name-masks 415(setq flymake-proc-allowed-file-name-masks
437 (cons '(".+\\.pl$" 416 (cons '(".+\\.pl$"
438 flymake-perl-init 417 flymake-proc-perl-init
439 flymake-simple-cleanup 418 flymake-proc-simple-cleanup
440 flymake-get-real-file-name) 419 flymake-proc-get-real-file-name)
441 flymake-allowed-file-name-masks)) 420 flymake-proc-allowed-file-name-masks))
442@end lisp 421@end lisp
443 422
444Note that we use standard @code{cleanup-function} and 423Note that we use standard @code{cleanup-function} and
445@code{getfname-function}. 424@code{getfname-function}.
446 425
447Finally, we add an entry to @code{flymake-err-line-patterns}: 426Finally, we add an entry to @code{flymake-proc-err-line-patterns}:
448 427
449@lisp 428@lisp
450(setq flymake-err-line-patterns 429(setq flymake-proc-err-line-patterns
451 (cons '("\\(.*\\) at \\([^ \n]+\\) line \\([0-9]+\\)[,.\n]" 430 (cons '("\\(.*\\) at \\([^ \n]+\\) line \\([0-9]+\\)[,.\n]"
452 2 3 nil 1) 431 2 3 nil 1)
453 flymake-err-line-patterns)) 432 flymake-proc-err-line-patterns))
454@end lisp 433@end lisp
455 434
456@node Example---Configuring a tool called via make 435@node Example---Configuring a tool called via make
@@ -462,18 +441,18 @@ In this example we will add support for C files syntax checked by
462 441
463We're not required to write any new functions, as Flymake already has 442We're not required to write any new functions, as Flymake already has
464functions for @command{make}. We just add a new entry to the 443functions for @command{make}. We just add a new entry to the
465@code{flymake-allowed-file-name-masks}: 444@code{flymake-proc-allowed-file-name-masks}:
466 445
467@lisp 446@lisp
468(setq flymake-allowed-file-name-masks 447(setq flymake-proc-allowed-file-name-masks
469 (cons '(".+\\.c$" 448 (cons '(".+\\.c$"
470 flymake-simple-make-init 449 flymake-proc-simple-make-init
471 flymake-simple-cleanup 450 flymake-proc-simple-cleanup
472 flymake-get-real-file-name) 451 flymake-proc-get-real-file-name)
473 flymake-allowed-file-name-masks)) 452 flymake-proc-allowed-file-name-masks))
474@end lisp 453@end lisp
475 454
476@code{flymake-simple-make-init} builds the following @command{make} 455@code{flymake-proc-simple-make-init} builds the following @command{make}
477command line: 456command line:
478 457
479@lisp 458@lisp
@@ -492,7 +471,7 @@ our case this target might look like this:
492 471
493@verbatim 472@verbatim
494check-syntax: 473check-syntax:
495 gcc -o /dev/null -S ${CHK_SOURCES} 474 gcc -o /dev/null -S ${CHK_SOURCES} || true
496@end verbatim 475@end verbatim
497 476
498@noindent 477@noindent
@@ -504,42 +483,25 @@ Automake variable @code{COMPILE}:
504 483
505@verbatim 484@verbatim
506check-syntax: 485check-syntax:
507 $(COMPILE) -o /dev/null -S ${CHK_SOURCES} 486 $(COMPILE) -o /dev/null -S ${CHK_SOURCES} || true
508@end verbatim 487@end verbatim
509 488
510@node Flymake Implementation 489@node Implementation overview
511@chapter Flymake Implementation 490@section Implementation overview
512@cindex Implementation details
513
514@menu
515* Determining whether syntax check is possible::
516* Making a temporary copy::
517* Locating a master file::
518* Getting the include directories::
519* Locating the buildfile::
520* Starting the syntax check process::
521* Parsing the output::
522* Highlighting erroneous lines::
523* Interaction with other modes::
524@end menu
525
526Syntax check is started by calling @code{flymake-start-syntax-check-for-current-buffer}.
527Flymake first determines whether it is able to do syntax
528check. It then saves a copy of the buffer in a temporary file in the
529buffer's directory (or in the system temp directory, for java
530files), creates a syntax check command and launches a process with
531this command. The output is parsed using a list of error message patterns,
532and error information (file name, line number, type and text) is
533saved. After the process has finished, Flymake highlights erroneous
534lines in the buffer using the accumulated error information.
535
536@node Determining whether syntax check is possible
537@section Determining whether syntax check is possible
538@cindex Syntax check models 491@cindex Syntax check models
539@cindex Master file 492@cindex Master file
540 493
494@code{flymake-proc-legacy-backend} saves a copy of the buffer in a
495temporary file in the buffer's directory (or in the system temp
496directory, for Java files), creates a syntax check command and
497launches a process with this command. The output is parsed using a
498list of error message patterns, and error information (file name, line
499number, type and text) is saved. After the process has finished,
500Flymake highlights erroneous lines in the buffer using the accumulated
501error information.
502
541Syntax check is considered possible if there's an entry in 503Syntax check is considered possible if there's an entry in
542@code{flymake-allowed-file-name-masks} matching buffer's filename and 504@code{flymake-proc-allowed-file-name-masks} matching buffer's filename and
543its @code{init-function} returns non-@code{nil} value. 505its @code{init-function} returns non-@code{nil} value.
544 506
545Two syntax check modes are distinguished: 507Two syntax check modes are distinguished:
@@ -564,10 +526,10 @@ will also check syntax in the current file. Examples are C/C++ (.h,
564These modes are handled inside init/cleanup/getfname functions, see 526These modes are handled inside init/cleanup/getfname functions, see
565@ref{Adding support for a new syntax check tool}. 527@ref{Adding support for a new syntax check tool}.
566 528
567Flymake contains implementations of all functionality required to 529The Proc backend contains implementations of all functionality
568support different syntax check modes described above (making temporary 530required to support different syntax check modes described above
569copies, finding master files, etc.), as well as some tool-specific 531(making temporary copies, finding master files, etc.), as well as some
570(routines for Make, Ant, etc.)@: code. 532tool-specific (routines for Make, Ant, etc.)@: code.
571 533
572 534
573@node Making a temporary copy 535@node Making a temporary copy
@@ -609,15 +571,16 @@ Master file is located in two steps.
609 571
610First, a list of possible master files is built. A simple name 572First, a list of possible master files is built. A simple name
611matching is used to find the files. For a C++ header @code{file.h}, 573matching is used to find the files. For a C++ header @code{file.h},
612Flymake searches for all @code{.cpp} files in the directories whose relative paths are 574the Proc backend searches for all @code{.cpp} files in the directories
613stored in a customizable variable @code{flymake-master-file-dirs}, which 575whose relative paths are stored in a customizable variable
614usually contains something like @code{("." "./src")}. No more than 576@code{flymake-proc-master-file-dirs}, which usually contains something
615@code{flymake-master-file-count-limit} entries is added to the master file 577like @code{("." "./src")}. No more than
616list. The list is then sorted to move files with names @code{file.cpp} to 578@code{flymake-proc-master-file-count-limit} entries is added to the
617the top. 579master file list. The list is then sorted to move files with names
580@code{file.cpp} to the top.
618 581
619Next, each master file in a list is checked to contain the appropriate 582Next, each master file in a list is checked to contain the appropriate
620include directives. No more than @code{flymake-check-file-limit} of each 583include directives. No more than @code{flymake-proc-check-file-limit} of each
621file are parsed. 584file are parsed.
622 585
623For @code{file.h}, the include directives to look for are 586For @code{file.h}, the include directives to look for are
@@ -639,10 +602,10 @@ and project include directories. The former is just the contents of the
639@code{INCLUDE} environment variable. The latter is not so easy to obtain, 602@code{INCLUDE} environment variable. The latter is not so easy to obtain,
640and the way it can be obtained can vary greatly for different projects. 603and the way it can be obtained can vary greatly for different projects.
641Therefore, a customizable variable 604Therefore, a customizable variable
642@code{flymake-get-project-include-dirs-function} is used to provide the 605@code{flymake-proc-get-project-include-dirs-function} is used to provide the
643way to implement the desired behavior. 606way to implement the desired behavior.
644 607
645The default implementation, @code{flymake-get-project-include-dirs-imp}, 608The default implementation, @code{flymake-proc-get-project-include-dirs-imp},
646uses a @command{make} call. This requires a correct base directory, that is, a 609uses a @command{make} call. This requires a correct base directory, that is, a
647directory containing a correct @file{Makefile}, to be determined. 610directory containing a correct @file{Makefile}, to be determined.
648 611
@@ -656,27 +619,27 @@ of every syntax check attempt.
656@cindex buildfile, locating 619@cindex buildfile, locating
657@cindex Makefile, locating 620@cindex Makefile, locating
658 621
659Flymake can be configured to use different tools for performing syntax 622The Proc backend can be configured to use different tools for
660checks. For example, it can use direct compiler call to syntax check a perl 623performing syntax checks. For example, it can use direct compiler
661script or a call to @command{make} for a more complicated case of a 624call to syntax check a perl script or a call to @command{make} for a
662@code{C/C++} source. The general idea is that simple files, like perl 625more complicated case of a @code{C/C++} source. The general idea is
663scripts and html pages, can be checked by directly invoking a 626that simple files, like perl scripts and html pages, can be checked by
664corresponding tool. Files that are usually more complex and generally 627directly invoking a corresponding tool. Files that are usually more
665used as part of larger projects, might require non-trivial options to 628complex and generally used as part of larger projects, might require
666be passed to the syntax check tool, like include directories for 629non-trivial options to be passed to the syntax check tool, like
667C++. The latter files are syntax checked using some build tool, like 630include directories for C++. The latter files are syntax checked
668Make or Ant. 631using some build tool, like Make or Ant.
669 632
670All Make configuration data is usually stored in a file called 633All Make configuration data is usually stored in a file called
671@code{Makefile}. To allow for future extensions, flymake uses a notion of 634@code{Makefile}. To allow for future extensions, Flymake uses a notion of
672buildfile to reference the 'project configuration' file. 635buildfile to reference the 'project configuration' file.
673 636
674Special function, @code{flymake-find-buildfile} is provided for locating buildfiles. 637Special function, @code{flymake-proc-find-buildfile} is provided for locating buildfiles.
675Searching for a buildfile is done in a manner similar to that of searching 638Searching for a buildfile is done in a manner similar to that of searching
676for possible master files. 639for possible master files.
677@ignore 640@ignore
678A customizable variable 641A customizable variable
679@code{flymake-buildfile-dirs} holds a list of relative paths to the 642@code{flymake-proc-buildfile-dirs} holds a list of relative paths to the
680buildfile. They are checked sequentially until a buildfile is found. 643buildfile. They are checked sequentially until a buildfile is found.
681@end ignore 644@end ignore
682In case there's no build file, syntax check is aborted. 645In case there's no build file, syntax check is aborted.
@@ -687,12 +650,12 @@ Buildfile values are also cached.
687@section Starting the syntax check process 650@section Starting the syntax check process
688@cindex Syntax check process 651@cindex Syntax check process
689 652
690The command line (command name and the list of arguments) for launching a process is returned by the 653The command line (command name and the list of arguments) for
691initialization function. Flymake then just calls @code{start-process} 654launching a process is returned by the initialization function. The
692to start an asynchronous process and configures a process filter and 655Proc backend then just starts an asynchronous process and configures a
693sentinel, which are used for processing the output of the syntax check 656process filter and sentinel, which are used for processing the output
694tool. When exiting Emacs, running Flymake processes will be killed 657of the syntax check tool. When exiting Emacs, running processes will
695without prompting the user. 658be killed without prompting the user.
696 659
697@node Parsing the output 660@node Parsing the output
698@section Parsing the output 661@section Parsing the output
@@ -700,7 +663,7 @@ without prompting the user.
700 663
701The output generated by the syntax check tool is parsed in the process 664The output generated by the syntax check tool is parsed in the process
702filter/sentinel using the error message patterns stored in the 665filter/sentinel using the error message patterns stored in the
703@code{flymake-err-line-patterns} variable. This variable contains a 666@code{flymake-proc-err-line-patterns} variable. This variable contains a
704list of items of the form @code{(regexp file-idx line-idx 667list of items of the form @code{(regexp file-idx line-idx
705err-text-idx)}, used to determine whether a particular line is an 668err-text-idx)}, used to determine whether a particular line is an
706error message and extract file name, line number and error text, 669error message and extract file name, line number and error text,
@@ -709,66 +672,39 @@ error text with the '@code{^[wW]arning}' pattern. Anything that was not
709classified as a warning is considered an error. Type is then used to 672classified as a warning is considered an error. Type is then used to
710sort error menu items, which shows error messages first. 673sort error menu items, which shows error messages first.
711 674
712Flymake is also able to interpret error message patterns missing err-text-idx 675The Proc backend is also able to interpret error message patterns
713information. This is done by merely taking the rest of the matched line 676missing err-text-idx information. This is done by merely taking the
714(@code{(substring line (match-end 0))}) as error text. This trick allows 677rest of the matched line (@code{(substring line (match-end 0))}) as
715making use of a huge collection of error message line patterns from 678error text. This trick allows making use of a huge collection of
716@code{compile.el}. All these error patterns are appended to 679error message line patterns from @code{compile.el}. All these error
717the end of @code{flymake-err-line-patterns}. 680patterns are appended to the end of
681@code{flymake-proc-err-line-patterns}.
718 682
719The error information obtained is saved in a buffer local 683The error information obtained is saved in a buffer local
720variable. The buffer for which the process output belongs is 684variable. The buffer for which the process output belongs is
721determined from the process-id@w{}->@w{}buffer mapping updated 685determined from the process-id@w{}->@w{}buffer mapping updated
722after every process launch/exit. 686after every process launch/exit.
723 687
724@node Highlighting erroneous lines
725@section Highlighting erroneous lines
726@cindex Erroneous lines, faces
727
728Highlighting is implemented with overlays and happens in the process
729sentinel, after calling the cleanup function. Two customizable faces
730are used: @code{flymake-errline} and
731@code{flymake-warnline}. Errors belonging outside the current
732buffer are considered to belong to line 1 of the current buffer.
733
734@c This manual does not use vindex.
735@c @vindex flymake-fringe-indicator-position
736@c @vindex flymake-error-bitmap
737@c @vindex flymake-warning-bitmap
738If the option @code{flymake-fringe-indicator-position} is non-@code{nil},
739errors and warnings are also highlighted in the left or right fringe,
740using the bitmaps specified by @code{flymake-error-bitmap}
741and @code{flymake-warning-bitmap}.
742
743@node Interaction with other modes 688@node Interaction with other modes
744@section Interaction with other modes 689@section Interaction with other modes
745@cindex Interaction with other modes 690@cindex Interaction with other modes
746@cindex Interaction with compile mode 691@cindex Interaction with compile mode
747 692
748The only mode flymake currently knows about is @code{compile}. 693The only mode the Proc backend currently knows about is
694@code{compile}.
749 695
750Flymake can be configured to not start syntax check if it thinks the 696The Proc backend can be configured to not start syntax check if it
751compilation is in progress. The check is made by the 697thinks the compilation is in progress, by testing the
752@code{flymake-compilation-is-running}, which tests the
753@code{compilation-in-progress} variable. The reason why this might be 698@code{compilation-in-progress} variable. The reason why this might be
754useful is saving CPU time in case both syntax check and compilation 699useful is saving CPU time in case both syntax check and compilation
755are very CPU intensive. The original reason for adding this feature, 700are very CPU intensive. The original reason for adding this feature,
756though, was working around a locking problem with MS Visual C++ 701though, was working around a locking problem with MS Visual C++
757compiler. 702compiler. The variable in question is
703@code{flymake-proc-compilation-prevents-syntax-check}.
758 704
759Flymake also provides an alternative command for starting compilation, 705The Proc backend also provides an alternative command for starting
760@code{flymake-compile}: 706compilation, @code{flymake-proc-compile}. It just kills all the active
761 707syntax check processes before calling @code{compile}.
762@lisp
763(defun flymake-compile ()
764 "Kill all flymake syntax checks then start compilation."
765 (interactive)
766 (flymake-stop-all-syntax-checks)
767 (call-interactively 'compile))
768@end lisp
769
770It just kills all the active syntax check processes before calling
771@code{compile}.
772 708
773@node GNU Free Documentation License 709@node GNU Free Documentation License
774@appendix GNU Free Documentation License 710@appendix GNU Free Documentation License
diff --git a/doc/misc/org.texi b/doc/misc/org.texi
index b6a4fa23557..72fbbade59e 100644
--- a/doc/misc/org.texi
+++ b/doc/misc/org.texi
@@ -4,7 +4,7 @@
4@settitle The Org Manual 4@settitle The Org Manual
5@include docstyle.texi 5@include docstyle.texi
6 6
7@set VERSION 9.1.1 7@set VERSION 9.1.2
8@set DATE 2017-09-17 8@set DATE 2017-09-17
9 9
10@c Version and Contact Info 10@c Version and Contact Info
@@ -1257,13 +1257,8 @@ Org uses just two commands, bound to @key{TAB} and
1257@end example 1257@end example
1258 1258
1259@vindex org-cycle-emulate-tab 1259@vindex org-cycle-emulate-tab
1260@vindex org-cycle-global-at-bob
1261The cursor must be on a headline for this to work@footnote{see, however, 1260The cursor must be on a headline for this to work@footnote{see, however,
1262the option @code{org-cycle-emulate-tab}.}. When the cursor is at the 1261the option @code{org-cycle-emulate-tab}.}.
1263beginning of the buffer and the first line is not a headline, then
1264@key{TAB} actually runs global cycling (see below)@footnote{see the
1265option @code{org-cycle-global-at-bob}.}. Also when called with a prefix
1266argument (@kbd{C-u @key{TAB}}), global cycling is invoked.
1267 1262
1268@cindex global visibility states 1263@cindex global visibility states
1269@cindex global cycling 1264@cindex global cycling
@@ -1283,6 +1278,11 @@ When @kbd{S-@key{TAB}} is called with a numeric prefix argument N, the
1283CONTENTS view up to headlines of level N will be shown. Note that inside 1278CONTENTS view up to headlines of level N will be shown. Note that inside
1284tables, @kbd{S-@key{TAB}} jumps to the previous field. 1279tables, @kbd{S-@key{TAB}} jumps to the previous field.
1285 1280
1281@vindex org-cycle-global-at-bob
1282You can run global cycling using @key{TAB} only if point is at the very
1283beginning of the buffer, but not on a headline, and
1284@code{org-cycle-global-at-bob} is set to a non-@code{nil} value.
1285
1286@cindex set startup visibility, command 1286@cindex set startup visibility, command
1287@orgcmd{C-u C-u @key{TAB},org-set-startup-visibility} 1287@orgcmd{C-u C-u @key{TAB},org-set-startup-visibility}
1288Switch back to the startup visibility of the buffer (@pxref{Initial visibility}). 1288Switch back to the startup visibility of the buffer (@pxref{Initial visibility}).
@@ -1659,11 +1659,9 @@ line. In particular, if an ordered list reaches number @samp{10.}, then the
1659list. An item ends before the next line that is less or equally indented 1659list. An item ends before the next line that is less or equally indented
1660than its bullet/number. 1660than its bullet/number.
1661 1661
1662@vindex org-list-empty-line-terminates-plain-lists
1663A list ends whenever every item has ended, which means before any line less 1662A list ends whenever every item has ended, which means before any line less
1664or equally indented than items at top level. It also ends before two blank 1663or equally indented than items at top level. It also ends before two blank
1665lines@footnote{See also @code{org-list-empty-line-terminates-plain-lists}.}. 1664lines. In that case, all items are closed. Here is an example:
1666In that case, all items are closed. Here is an example:
1667 1665
1668@example 1666@example
1669@group 1667@group
@@ -14991,6 +14989,7 @@ directory on the local machine.
14991 '(("org" 14989 '(("org"
14992 :base-directory "~/org/" 14990 :base-directory "~/org/"
14993 :publishing-directory "~/public_html" 14991 :publishing-directory "~/public_html"
14992 :publishing-function org-html-publish-to-html
14994 :section-numbers nil 14993 :section-numbers nil
14995 :with-toc nil 14994 :with-toc nil
14996 :html-head "<link rel=\"stylesheet\" 14995 :html-head "<link rel=\"stylesheet\"