aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoão Távora2021-09-12 22:16:35 +0100
committerJoão Távora2021-09-13 19:03:38 +0100
commit1f48b56f8bf370385ce6aaf7e40825ed131fafeb (patch)
tree01d0e3ce1ed223f32a3fcef09ad54fb2dd3f9893
parent44824d616b9e048cbc77dfc129e4ffb674ab11e3 (diff)
downloademacs-scratch/bug-50244.tar.gz
emacs-scratch/bug-50244.zip
Re-organize and rewrite parts of the Flymake manualscratch/bug-50244
bug#50244 * doc/misc/flymake.texi (Starting Flymake): New section. (Finding diagnostics): New section, now contains info previously in "Listing diagnostics" (Mode line status): Renamed from "Mode-line syntax check status" (Troubleshooting): Renamed from "Backend exceptions". (Flymake error types): Tweak phrasing.
-rw-r--r--doc/misc/flymake.texi217
1 files changed, 125 insertions, 92 deletions
diff --git a/doc/misc/flymake.texi b/doc/misc/flymake.texi
index 6243d79c83e..7e09d7221ab 100644
--- a/doc/misc/flymake.texi
+++ b/doc/misc/flymake.texi
@@ -1,18 +1,33 @@
1\input texinfo @c -*-texinfo; coding: utf-8 -*- 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 1.0 4@set VERSION 1.2
5@set UPDATED June 2018 5@set UPDATED September 2021
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@syncodeindex vr cp 9@syncodeindex vr cp
10@syncodeindex fn cp 10@syncodeindex fn cp
11@comment %**end of header 11@comment %**end of header
12 12
13@copying 13@copying
14This manual is for GNU Flymake (version @value{VERSION}, @value{UPDATED}), 14This manual is for GNU Flymake (version @value{VERSION}, @value{UPDATED}).
15which is a universal on-the-fly syntax checker for GNU Emacs. 15
16Flymake is a universal on-the-fly syntax checker for Emacs. When
17enabled, Flymake contacts one or more source @dfn{backends} to
18collects information about problems in the buffer, called
19@dfn{diagnostics}, and visually annotates them with a special face.
20The mode line display overall status including totals for different
21types of diagnostics.
22
23To learn about using Flymake, @xref{Using Flymake}.
24
25Flymake is designed to be easily extended to support new backends via
26an Elisp interface. @xref{Extending Flymake}
27
28Historically, Flymake used to accept diagnostics from a single
29backend. Although obsolete, it is still functional. To learn how to
30use and customize it, @xref{The legacy Proc backend}.
16 31
17Copyright @copyright{} 2004--2021 Free Software Foundation, Inc. 32Copyright @copyright{} 2004--2021 Free Software Foundation, Inc.
18 33
@@ -41,6 +56,7 @@ modify this GNU manual.''
41@page 56@page
42@vskip 0pt plus 1filll 57@vskip 0pt plus 1filll
43@insertcopying 58@insertcopying
59
44@end titlepage 60@end titlepage
45 61
46@contents 62@contents
@@ -64,19 +80,34 @@ modify this GNU manual.''
64@cindex overview of flymake 80@cindex overview of flymake
65@cindex using flymake 81@cindex using flymake
66 82
67Flymake is a universal on-the-fly buffer checker implemented as an 83Flymake is only useful if at least one @dfn{backend} is configured to
68Emacs minor mode. To use Flymake, you must first activate 84provide the buffer-checking service. This is done via the hook
69@code{flymake-mode} by using the command @kbd{flymake-mode}. 85@code{flymake-diagnostic-functions}. @xref{Hooks,Hooks,, emacs, The
86Emacs Editor}.
87
88It's possible that some major modes or a third-party package has
89already setup this hook for you, by adding @dfn{backend functions} to
90@code{flymake-diagnostic-functions}. If you know Elisp you may also
91write your own Flymake backend functions. @xref{Backend functions}.
92
93@menu
94* Starting Flymake::
95* Finding diagnostics::
96* Mode line status::
97* Troubleshooting::
98* Customizable variables::
99@end menu
70 100
71When enabled, Flymake collects information about problems in the 101@node Starting Flymake
72buffer, called @dfn{diagnostics}, from one or more different sources, 102@section Starting Flymake
73or @dfn{backends}, and then visually annotates the buffer by 103@cindex Starting Flymake
74highlighting problematic buffer regions with a special face.
75 104
76It also displays an overall buffer status in the mode line containing 105To use Flymake, the minor-mode @code{flymake-mode} must be activated.
77totals for different types of diagnostics. 106If it's not, use the command @kbd{flymake-mode} to toggle it on. The
107mode line should indicate its presence via an indicator (@pxref{Mode
108line status}).
78 109
79Syntax check is done ``on-the-fly''. It is started whenever 110Syntax checks happen ``on-the-fly''. Each check is started whenever:
80 111
81@itemize @bullet 112@itemize @bullet
82@item 113@item
@@ -90,68 +121,56 @@ nil;
90@item 121@item
91some changes were made to the buffer more than @code{0.5} seconds ago 122some changes were made to the buffer more than @code{0.5} seconds ago
92(the delay is configurable in @code{flymake-no-changes-timeout}). 123(the delay is configurable in @code{flymake-no-changes-timeout}).
93@end itemize
94 124
95Syntax check can also be started manually by typing the @kbd{M-x 125@item
96flymake-start @key{RET}} command. 126When the user invokes the command @code{flymake-start}.
127@end itemize
97 128
98If the check detected errors or warnings, the respective buffer 129If the check detected errors or warnings, the respective buffer
99regions are highlighted. You can place point on those regions and use 130regions are highlighted. @xref{Finding diagnostics} for how to
100@kbd{C-h .} (@code{display-local-help}) to see what the specific 131learn what the problems are.
101problem was. Alternatively, hovering the mouse on those regions 132
102should also display a tool-tip with the same information. 133@node Finding diagnostics
134@section Finding diagnostics
135
136@cindex Read diagnostic message
137If Flymake has highlighted the buffer, you may hover the mouse on the
138highlighted regions to learn what the specific problem
139is. Alternatively, place point on the highlighted regions and use the
140commands @code{eldoc} or @code{display-local-help}.
103 141
142@cindex Next and previous diagnostic
143If the diagnostics are outside the visible region of the buffer,
104@code{flymake-goto-next-error} and @code{flymake-goto-prev-error} are 144@code{flymake-goto-next-error} and @code{flymake-goto-prev-error} are
105commands that allow easy navigation to the next/previous erroneous 145let you navigate to the next/previous errorenous regions,
106regions, respectively. It might be a good idea to map them to @kbd{M-n} 146respectively. It might be a good idea to map them to @kbd{M-n} and
107and @kbd{M-p} in @code{flymake-mode}, by adding to your init file: 147@kbd{M-p} in @code{flymake-mode}, by adding to your init file:
108 148
109@lisp 149@lisp
110(define-key flymake-mode-map (kbd "M-n") 'flymake-goto-next-error) 150(define-key flymake-mode-map (kbd "M-n") 'flymake-goto-next-error)
111(define-key flymake-mode-map (kbd "M-p") 'flymake-goto-prev-error) 151(define-key flymake-mode-map (kbd "M-p") 'flymake-goto-prev-error)
112@end lisp 152@end lisp
113 153
114Flymake is a universal syntax checker in the sense that it's easily
115extended to support new backends (@pxref{Extending Flymake}).
116
117Historically, Flymake used to accept diagnostics from a single
118backend, albeit a reasonably flexible one.
119
120This backend isn't (yet) obsolete, and so is still available as a
121fallback and active by default (@pxref{The legacy Proc backend}). It works by
122selecting a syntax check tool from a preconfigured list (compiler for
123C@t{++} files, @command{perl} for Perl files, etc.), and executing it in the
124background, passing it a temporary file which is a copy of the current
125buffer, and parsing the output for known error/warning message
126patterns.
127
128@menu
129* Syntax check statuses::
130* Backend exceptions::
131* Customizable variables::
132@end menu
133
134@node Listing diagnostics
135@section Listing diagnostics
136@cindex Listing diagnostics 154@cindex Listing diagnostics
137
138Sometimes it is useful to have a detailed overview of the diagnostics 155Sometimes it is useful to have a detailed overview of the diagnostics
139in your files. The command @code{flymake-show-diagnostics-buffer} 156in your files without having to jump to each one to one. The commands
140displays a structured listing of diagnostics in the current buffer. 157@code{flymake-show-buffer-diagnostics} and
141The listing is displayed in a separate buffer and is continuously 158@code{flymake-show-project-diagnostics} are designed to handle this
142updated as you edit source code, adding or removing lines as you make 159situation. When invoked, they bring up a separate buffer containing a
143or correct mistakes. 160detailed structured listing of multiple diagnostics in the current
144 161buffer or for the current project, respectively (@pxref{Projects,,,
145Each line of this listing includes the type of the diagnostic, its 162emacs, The Emacs Editor}).
146line and column in the file as well as the diagnostic message. You 163
147may sort the listing by each of these columns. 164The listings is continuously updated as you edit source code, adding or
148 165removing lines as you make or correct mistakes. Each line of this
149@code{flymake-show-project-diagnostics} does something similar but for 166listing includes the type of the diagnostic, its line and column in
150the whole project (@pxref{Projects,,, emacs, The Emacs Editor}). 167the file as well as the diagnostic message. You may sort the listing
151 168by each of these columns.
152@node Mode-line synatx-check status 169
153@section Mode-line synatx-check status 170@node Mode line status
154@cindex Mode-line synatx-check status 171@section Mode line status
172@cindex Flymake mode line
173@cindex Syntax check status
155 174
156When enabled, Flymake displays its status in the mode line, which 175When enabled, Flymake displays its status in the mode line, which
157provides a visual summary of diagnostic collection. It may also hint 176provides a visual summary of diagnostic collection. It may also hint
@@ -175,7 +194,7 @@ delay and Flymake will resume normal operation soon.
175@item @code{!} 194@item @code{!}
176@tab All the configured Flymake backends have disabled themselves: Flymake 195@tab All the configured Flymake backends have disabled themselves: Flymake
177cannot annotate the buffer and action from the user is needed to 196cannot annotate the buffer and action from the user is needed to
178investigate and remedy the situation (@pxref{Backend exceptions}). 197investigate and remedy the situation (@pxref{Troubleshooting}).
179 198
180@item @code{?} 199@item @code{?}
181@tab There are no applicable Flymake backends for this buffer, thus Flymake 200@tab There are no applicable Flymake backends for this buffer, thus Flymake
@@ -184,17 +203,24 @@ and add a new backend (@pxref{Extending Flymake}).
184 203
185@end multitable 204@end multitable
186 205
187@node Backend exceptions 206If you would like to customize the appearance of the mode-line, you
188@section Backend exceptions 207can use the variables @code{flymake-mode-line-format} and
189@cindex backend exceptions 208@code{flymake-mode-line-counter-format} for that purpose.
209@xref{Customizable variables}.
210
211@node Troubleshooting
212@section Troubleshooting
213@cindex Troubleshooting
214@cindex Backend exceptions
190 215
191@cindex disabled backends 216@cindex disabled backends
192@cindex backends, disabled 217@cindex backends, disabled
193Some backends may take longer than others to respond or complete, and 218As Flymake supports multiple simutaneously active external backends,
194some may decide to @emph{disable} themselves if they are not suitable 219is becomes useful monitor their status. For example, some backends
195for the current buffer or encounter some unavoidable problem. A 220may take longer than others to respond or complete, and some may
196disabled backend is not tried again for future checks of the current 221decide to @emph{disable} themselves if they are not suitable for the
197buffer. 222current buffer or encounter some unavoidable problem. A disabled
223backend is not tried again for future checks of the current buffer.
198 224
199@findex flymake-reporting-backends 225@findex flymake-reporting-backends
200@findex flymake-running-backends 226@findex flymake-running-backends
@@ -204,18 +230,23 @@ The commands @code{flymake-reporting-backends},
204show the backends currently used and those which are disabled. 230show the backends currently used and those which are disabled.
205 231
206@cindex reset disabled backends 232@cindex reset disabled backends
207Toggling @code{flymake-mode} off and on again, or invoking 233Sometimes, re-starting a backend that disabled itself is useful after
208@code{flymake-start} with a prefix argument is one way to reset the 234some external roadblock has been removed (for example after the user
209disabled backend list, so that they will be tried again in the next check. 235installed a needed syntax-check program). Invoking
236@code{flymake-start} with a prefix argument is a way to reset the
237disabled backend list, so that they will be tried again in the next
238check. Manually toggle @code{flymake-mode} off and on again also
239works.
210 240
211@cindex logging 241@cindex logging
212@cindex flymake logging 242@cindex flymake logging
213Flymake also uses a simple logging facility for indicating important 243Flymake uses a simple logging facility for indicating important points
214points in the control flow. The logging facility sends logging 244in the control flow. The logging facility sends logging messages to
215messages to the @file{*Flymake log*} buffer. The information logged 245the @file{*Flymake log*} buffer. The logged information can be used
216can be used for resolving various problems related to Flymake. For 246for resolving various problems related to Flymake. For convenience, a
217convenience, a shortcut to this buffer can be found in Flymake's menu, 247shortcut to this buffer can be found in Flymake's menu, accessible
218accessible from the top menu bar or just left of the status indicator. 248from the top menu bar or just left of the status indicator. The
249command @code{flymake-switch-to-log-buffer} is another alternative.
219 250
220@vindex warning-minimum-log-level 251@vindex warning-minimum-log-level
221@vindex warning-minimum-level 252@vindex warning-minimum-level
@@ -235,7 +266,7 @@ configuration of the Flymake user interface.
235Format to use for the Flymake mode line indicator. 266Format to use for the Flymake mode line indicator.
236 267
237@item flymake-mode-line-counter-format 268@item flymake-mode-line-counter-format
238Mode-line construct for formatting Flymake diagnostic counters inside 269mode line construct for formatting Flymake diagnostic counters inside
239the Flymake mode line indicator. 270the Flymake mode line indicator.
240 271
241@item flymake-no-changes-timeout 272@item flymake-no-changes-timeout
@@ -288,10 +319,10 @@ Flymake can primarily be extended in one of two ways:
288@enumerate 319@enumerate
289@item 320@item
290By changing the look and feel of the annotations produced by the 321By changing the look and feel of the annotations produced by the
291different backends. 322different backends. @xref{Flymake error types}.
292 323
293@item 324@item
294By adding a new buffer-checking backend. 325By adding a new buffer-checking backend. @xref{Backend functions}.
295@end enumerate 326@end enumerate
296 327
297The following sections discuss each approach in detail. 328The following sections discuss each approach in detail.
@@ -306,10 +337,12 @@ The following sections discuss each approach in detail.
306@cindex customizing error types 337@cindex customizing error types
307@cindex error types, customization 338@cindex error types, customization
308 339
309To customize the appearance of error types, set properties on the 340To customize the appearance of error types, the user must set
310symbols associated with each diagnostic type. The standard diagnostic 341properties on the symbols associated with each diagnostic type.
311symbols are @code{:error}, @code{:warning} and @code{:note} (though 342
312the backend may define more, @pxref{Backend functions}). 343The three standard diagnostic keyowrd symbols -- @code{:error},
344@code{:warning} and @code{:note} -- have pre-configured appearances.
345However a backend may define more (@pxref{Backend functions}).
313 346
314The following properties can be set: 347The following properties can be set:
315 348
@@ -507,7 +540,7 @@ manual}) or other asynchronous mechanisms.
507 540
508In any case, backend functions are expected to return quickly or 541In any case, backend functions are expected to return quickly or
509signal an error, in which case the backend is disabled 542signal an error, in which case the backend is disabled
510(@pxref{Backend exceptions}). 543(@pxref{Troubleshooting}).
511 544
512If the function returns, Flymake considers the backend to be 545If the function returns, Flymake considers the backend to be
513@dfn{running}. If it has not done so already, the backend is expected 546@dfn{running}. If it has not done so already, the backend is expected
@@ -620,7 +653,7 @@ elisp, The Emacs Lisp Reference Manual}).
620@cindex add a log message 653@cindex add a log message
621For troubleshooting purposes, backends may record arbitrary 654For troubleshooting purposes, backends may record arbitrary
622exceptional or erroneous situations into the Flymake log 655exceptional or erroneous situations into the Flymake log
623buffer (@pxref{Backend exceptions}): 656buffer (@pxref{Troubleshooting}):
624 657
625@deffn Macro flymake-log level msg &optional args 658@deffn Macro flymake-log level msg &optional args
626Log, at level @var{level}, the message @var{msg} formatted with 659Log, at level @var{level}, the message @var{msg} formatted with
@@ -1116,7 +1149,7 @@ correct @file{file.h}.
1116First matching master file found stops the search. The master file is then 1149First matching master file found stops the search. The master file is then
1117patched and saved to disk. In case no master file is found, syntax check is 1150patched and saved to disk. In case no master file is found, syntax check is
1118aborted, and corresponding status (@samp{!}) is reported in the mode line. 1151aborted, and corresponding status (@samp{!}) is reported in the mode line.
1119@xref{Syntax check statuses}. 1152@xref{Mode line status}.
1120 1153
1121@node Getting the include directories 1154@node Getting the include directories
1122@section Getting the include directories 1155@section Getting the include directories