aboutsummaryrefslogtreecommitdiffstats
path: root/doc
diff options
context:
space:
mode:
Diffstat (limited to 'doc')
-rw-r--r--doc/misc/flymake.texi166
1 files changed, 57 insertions, 109 deletions
diff --git a/doc/misc/flymake.texi b/doc/misc/flymake.texi
index d89a555ff73..05d879d8f4b 100644
--- a/doc/misc/flymake.texi
+++ b/doc/misc/flymake.texi
@@ -52,8 +52,6 @@ modify this GNU manual.''
52@end ifnottex 52@end ifnottex
53 53
54@menu 54@menu
55* Overview of Flymake::
56* Installing Flymake::
57* Using Flymake:: 55* Using Flymake::
58* Extending Flymake:: 56* Extending Flymake::
59* The legacy Proc backend:: 57* The legacy Proc backend::
@@ -61,50 +59,57 @@ modify this GNU manual.''
61* Index:: 59* Index::
62@end menu 60@end menu
63 61
64@node Overview of Flymake 62@node Using Flymake
65@chapter Overview 63@chapter Using Flymake
66@cindex overview of flymake 64@cindex overview of flymake
65@cindex using flymake
67 66
68Flymake is a universal on-the-fly buffer checker implemented as an 67Flymake is a universal on-the-fly buffer checker implemented as an
69Emacs minor mode. When enabled, Flymake visually annotates the buffer 68Emacs minor minor. To use Flymake, you must first activate
70with diagnostic information coming from one or more different sources, 69@code{flymake-mode} by using the command @kbd{flymake-mode}.
71or @dfn{backends}.
72 70
73Flymake annotates the buffer by highlighting problematic buffer 71When enabled, Flymake collects information about problems in the
74regions with a special space. It displays an overall buffer status in 72buffer, called @dfn{diagnostics}, from one or more different sources,
75the mode line containing totals for different types of diagnostics. 73or @dfn{backends}, and then visually annotates the buffer by
76 74highlighting problematic buffer regions with a special face.
77@code{flymake-goto-next-error} and @code{flymake-goto-prev-error} are
78commands that allow easy navigation to the next/previous erroneous
79line, respectively. If might be a good idea to map them to @kbd{M-n}
80and @kbd{M-p} in @code{flymake-mode}, by adding to your init file:
81 75
82@lisp 76It also displays an overall buffer status in the mode line containing
83(define-key flymake-mode-map (kbd "M-n") 'flymake-goto-next-error) 77totals for different types of diagnostics.
84(define-key flymake-mode-map (kbd "M-p") 'flymake-goto-prev-error)
85@end lisp
86 78
87Syntax check is done ``on-the-fly''. It is started whenever 79Syntax check is done ``on-the-fly''. It is started whenever
88 80
89@itemize @bullet 81@itemize @bullet
90@item 82@item
91@code{flymake-mode} is started, unless 83@code{flymake-mode} is started, unless
92@code{flymake-start-on-flymake-mode} is nil. 84@code{flymake-start-on-flymake-mode} is nil;
93 85
94@item 86@item
95a newline character is added to the buffer, unless 87a newline character is added to the buffer, unless
96@code{flymake-start-syntax-check-on-newline} is nil. 88@code{flymake-start-syntax-check-on-newline} is nil;
97 89
98@item 90@item
99some changes were made to the buffer more than @code{0.5} seconds ago 91some changes were made to the buffer more than @code{0.5} seconds ago
100(the delay is configurable in @code{flymake-no-changes-timeout}). 92(the delay is configurable in @code{flymake-no-changes-timeout}).
101@end itemize 93@end itemize
102 94
95Syntax check can also be started manually by typing the @kbd{M-x
96flymake-start @key{RET}} command.
97
98@code{flymake-goto-next-error} and @code{flymake-goto-prev-error} are
99commands that allow easy navigation to the next/previous erroneous
100line, respectively. If might be a good idea to map them to @kbd{M-n}
101and @kbd{M-p} in @code{flymake-mode}, by adding to your init file:
102
103@lisp
104(define-key flymake-mode-map (kbd "M-n") 'flymake-goto-next-error)
105(define-key flymake-mode-map (kbd "M-p") 'flymake-goto-prev-error)
106@end lisp
107
103Flymake is a universal syntax checker in the sense that it's easily 108Flymake is a universal syntax checker in the sense that it's easily
104extended to support new backends (@pxref{Extending Flymake}). 109extended to support new backends (@pxref{Extending Flymake}).
105 110
106Historically, Flymake used to accept diagnostics from a single, albeit 111Historically, Flymake used to accept diagnostics from a single
107reasonably flexible, backend. 112backend, albeit a reasonably flexible one.
108 113
109This backend isn't (yet) obsolete, and so is still available as a 114This backend isn't (yet) obsolete, and so is still available as a
110fallback and active by default (@pxref{The legacy Proc backend}). It works by 115fallback and active by default (@pxref{The legacy Proc backend}). It works by
@@ -114,105 +119,45 @@ background, passing it a temporary file which is a copy of the current
114buffer, and parsing the output for known error/warning message 119buffer, and parsing the output for known error/warning message
115patterns. 120patterns.
116 121
117@node Installing Flymake
118@chapter Installing
119@cindex installing flymake
120
121Flymake is included with Emacs and its main commands, like
122@code{flymake-mode}, are autoloaded. This means there is usually
123nothing to do by way of installation.
124
125@node Using Flymake
126@chapter Using Flymake
127@cindex using flymake
128
129@menu 122@menu
130* Flymake mode::
131* Running the syntax check::
132* Navigating to error lines:: @c * Viewing error messages::
133* Syntax check statuses:: 123* Syntax check statuses::
134* Backend exceptions:: 124* Backend exceptions::
135* Customizable variables:: 125* Customizable variables::
136@end menu 126@end menu
137 127
138@node Flymake mode
139@section Flymake mode
140@cindex flymake-mode
141@cindex activating flymake-mode
142
143Flymake is an Emacs minor mode. To use Flymake, you
144must first activate @code{flymake-mode} by using the command
145@kbd{flymake-mode}.
146
147Instead of manually activating @code{flymake-mode}, you can configure
148Emacs to automatically enable @code{flymake-mode} upon opening any
149file for which syntax check is possible. To do so, place the following
150line in your @file{~/.emacs}:
151
152@lisp
153(add-hook 'find-file-hook 'flymake-find-file-hook)
154@end lisp
155
156@node Running the syntax check
157@section Running the syntax check
158@cindex manually starting syntax check
159@cindex syntax check, start manually
160
161@findex flymake-start
162When @code{flymake-mode} is active, syntax check is started
163automatically on any of the three conditions mentioned in
164@ref{Overview of Flymake}. Syntax check can also be started manually
165by typing the @kbd{M-x flymake-start @key{RET}} command.
166
167@node Navigating to error lines
168@section Navigating to error lines
169@cindex navigating to error lines
170
171After syntax check is completed, lines for which at least one error or
172warning has been reported are highlighted, and the total number of errors
173and warning is shown in the mode line. Use the following functions to
174navigate the highlighted lines:
175
176@table @code
177@findex flymake-goto-next-error
178@item flymake-goto-next-error
179Moves point to the next erroneous line, if any.
180
181@findex flymake-goto-prev-error
182@item flymake-goto-prev-error
183Moves point to the previous erroneous line.
184@end table
185
186If the user option @code{flymake-wrap-around} is active
187(@pxref{Customizable variables}), these functions treat diagnostics
188as a linked list. Therefore, @code{flymake-goto-next-error} will go
189to the first diagnostic when invoked in the end of the buffer.
190
191@node Syntax check statuses 128@node Syntax check statuses
192@section Syntax check statuses 129@section Syntax check statuses
193@cindex Syntax check statuses 130@cindex Syntax check statuses
194 131
195While enabled, Flymake displays its status in the mode line. 132When enabled, Flymake displays its status in the mode line, which
133provides a visual summary of diagnostic collection. It may also hint
134at certain exceptional situations encountered when communicating with
135backends.
136
196The following statuses are defined: 137The following statuses are defined:
197 138
198@multitable @columnfractions 0.25 0.75 139@multitable @columnfractions 0.25 0.75
140@item [@var{nerrors} @var{nwarnings} ...]
141@tab Normal operation. @var{nerrors} and @var{nwarnings} are, respectively,
142the total number of errors and warnings found during the last buffer
143check, for all backends. They may be followed by other totals for
144other types of diagnostics (@pxref{Flymake error types}).
145
199@item @code{Wait} 146@item @code{Wait}
200@tab Some flymake backends haven't reported since the last time they 147@tab Some Flymake backends haven't reported since the last time they
201where questioned. 148where questioned. It is reasonable to assume that this is a temporary
149delay and Flymake will resume normal operation soon.
202 150
203@item @code{!} 151@item @code{!}
204@tab All the configured Flymake backends have disabled themselves. 152@tab All the configured Flymake backends have disabled themselves: Flymake
205Left-clicking Flymake's mode line indicator pops up a menu listing the 153cannot annotate the buffer and action from the user is needed to
206option to visit Flymake's log buffer. In this buffer these situations 154investigate and remedy the situation (@pxref{Backend exceptions}).
207can be investigated.
208 155
209@item @code{?} 156@item @code{?}
210@tab There are no configured Flymake backends in 157@tab There are no applicable Flymake backends for this buffer, thus Flymake
211@code{flymake-diagnostic-functions}. 158cannot annotate it. To fix this, a user may look to extending Flymake
159and add a new backend (@pxref{Extending Flymake}).
212 160
213@item @emph{[nerrors nwarnings]}
214@tab Normal operation, number of errors/warnings found by the syntax
215check process.
216@end multitable 161@end multitable
217 162
218@node Backend exceptions 163@node Backend exceptions
@@ -223,8 +168,9 @@ check process.
223@cindex backends, disabled 168@cindex backends, disabled
224Some backends may take longer than others to respond or complete, and 169Some backends may take longer than others to respond or complete, and
225some may decide to @emph{disable} themselves if they are not suitable 170some may decide to @emph{disable} themselves if they are not suitable
226for the current buffer. A disabled backend is not tried again for 171for the current buffer or encounter some unavoidable problem. A
227future checks of the current buffer. 172disabled backend is not tried again for future checks of the current
173buffer.
228 174
229@findex flymake-reporting-backends 175@findex flymake-reporting-backends
230@findex flymake-running-backends 176@findex flymake-running-backends
@@ -240,10 +186,12 @@ disabled backend list, so that they will be tried again in the next check.
240 186
241@cindex logging 187@cindex logging
242@cindex flymake logging 188@cindex flymake logging
243Flymake also uses a simple logging facility for indicating important points 189Flymake also uses a simple logging facility for indicating important
244in the control flow. The logging facility sends logging messages to 190points in the control flow. The logging facility sends logging
245the @file{*Flymake log*} buffer. The information logged can be used for 191messages to the @file{*Flymake log*} buffer. The information logged
246resolving various problems related to Flymake. 192can be used for resolving various problems related to Flymake. For
193convenience, a shortcut to this buffer can be found in Flymake's menu,
194accessible from the top menu bar or just left of the status indicator.
247 195
248@vindex warning-minimum-log-level 196@vindex warning-minimum-log-level
249@vindex warning-minimum-level 197@vindex warning-minimum-level