diff options
| author | João Távora | 2021-09-12 22:16:35 +0100 |
|---|---|---|
| committer | João Távora | 2021-09-13 19:03:38 +0100 |
| commit | 1f48b56f8bf370385ce6aaf7e40825ed131fafeb (patch) | |
| tree | 01d0e3ce1ed223f32a3fcef09ad54fb2dd3f9893 | |
| parent | 44824d616b9e048cbc77dfc129e4ffb674ab11e3 (diff) | |
| download | emacs-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.texi | 217 |
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 |
| 14 | This manual is for GNU Flymake (version @value{VERSION}, @value{UPDATED}), | 14 | This manual is for GNU Flymake (version @value{VERSION}, @value{UPDATED}). |
| 15 | which is a universal on-the-fly syntax checker for GNU Emacs. | 15 | |
| 16 | Flymake is a universal on-the-fly syntax checker for Emacs. When | ||
| 17 | enabled, Flymake contacts one or more source @dfn{backends} to | ||
| 18 | collects information about problems in the buffer, called | ||
| 19 | @dfn{diagnostics}, and visually annotates them with a special face. | ||
| 20 | The mode line display overall status including totals for different | ||
| 21 | types of diagnostics. | ||
| 22 | |||
| 23 | To learn about using Flymake, @xref{Using Flymake}. | ||
| 24 | |||
| 25 | Flymake is designed to be easily extended to support new backends via | ||
| 26 | an Elisp interface. @xref{Extending Flymake} | ||
| 27 | |||
| 28 | Historically, Flymake used to accept diagnostics from a single | ||
| 29 | backend. Although obsolete, it is still functional. To learn how to | ||
| 30 | use and customize it, @xref{The legacy Proc backend}. | ||
| 16 | 31 | ||
| 17 | Copyright @copyright{} 2004--2021 Free Software Foundation, Inc. | 32 | Copyright @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 | ||
| 67 | Flymake is a universal on-the-fly buffer checker implemented as an | 83 | Flymake is only useful if at least one @dfn{backend} is configured to |
| 68 | Emacs minor mode. To use Flymake, you must first activate | 84 | provide 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 |
| 86 | Emacs Editor}. | ||
| 87 | |||
| 88 | It's possible that some major modes or a third-party package has | ||
| 89 | already setup this hook for you, by adding @dfn{backend functions} to | ||
| 90 | @code{flymake-diagnostic-functions}. If you know Elisp you may also | ||
| 91 | write 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 | ||
| 71 | When enabled, Flymake collects information about problems in the | 101 | @node Starting Flymake |
| 72 | buffer, called @dfn{diagnostics}, from one or more different sources, | 102 | @section Starting Flymake |
| 73 | or @dfn{backends}, and then visually annotates the buffer by | 103 | @cindex Starting Flymake |
| 74 | highlighting problematic buffer regions with a special face. | ||
| 75 | 104 | ||
| 76 | It also displays an overall buffer status in the mode line containing | 105 | To use Flymake, the minor-mode @code{flymake-mode} must be activated. |
| 77 | totals for different types of diagnostics. | 106 | If it's not, use the command @kbd{flymake-mode} to toggle it on. The |
| 107 | mode line should indicate its presence via an indicator (@pxref{Mode | ||
| 108 | line status}). | ||
| 78 | 109 | ||
| 79 | Syntax check is done ``on-the-fly''. It is started whenever | 110 | Syntax 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 |
| 91 | some changes were made to the buffer more than @code{0.5} seconds ago | 122 | some 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 | ||
| 95 | Syntax check can also be started manually by typing the @kbd{M-x | 125 | @item |
| 96 | flymake-start @key{RET}} command. | 126 | When the user invokes the command @code{flymake-start}. |
| 127 | @end itemize | ||
| 97 | 128 | ||
| 98 | If the check detected errors or warnings, the respective buffer | 129 | If the check detected errors or warnings, the respective buffer |
| 99 | regions are highlighted. You can place point on those regions and use | 130 | regions are highlighted. @xref{Finding diagnostics} for how to |
| 100 | @kbd{C-h .} (@code{display-local-help}) to see what the specific | 131 | learn what the problems are. |
| 101 | problem was. Alternatively, hovering the mouse on those regions | 132 | |
| 102 | should also display a tool-tip with the same information. | 133 | @node Finding diagnostics |
| 134 | @section Finding diagnostics | ||
| 135 | |||
| 136 | @cindex Read diagnostic message | ||
| 137 | If Flymake has highlighted the buffer, you may hover the mouse on the | ||
| 138 | highlighted regions to learn what the specific problem | ||
| 139 | is. Alternatively, place point on the highlighted regions and use the | ||
| 140 | commands @code{eldoc} or @code{display-local-help}. | ||
| 103 | 141 | ||
| 142 | @cindex Next and previous diagnostic | ||
| 143 | If 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 |
| 105 | commands that allow easy navigation to the next/previous erroneous | 145 | let you navigate to the next/previous errorenous regions, |
| 106 | regions, respectively. It might be a good idea to map them to @kbd{M-n} | 146 | respectively. It might be a good idea to map them to @kbd{M-n} and |
| 107 | and @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 | ||
| 114 | Flymake is a universal syntax checker in the sense that it's easily | ||
| 115 | extended to support new backends (@pxref{Extending Flymake}). | ||
| 116 | |||
| 117 | Historically, Flymake used to accept diagnostics from a single | ||
| 118 | backend, albeit a reasonably flexible one. | ||
| 119 | |||
| 120 | This backend isn't (yet) obsolete, and so is still available as a | ||
| 121 | fallback and active by default (@pxref{The legacy Proc backend}). It works by | ||
| 122 | selecting a syntax check tool from a preconfigured list (compiler for | ||
| 123 | C@t{++} files, @command{perl} for Perl files, etc.), and executing it in the | ||
| 124 | background, passing it a temporary file which is a copy of the current | ||
| 125 | buffer, and parsing the output for known error/warning message | ||
| 126 | patterns. | ||
| 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 | |||
| 138 | Sometimes it is useful to have a detailed overview of the diagnostics | 155 | Sometimes it is useful to have a detailed overview of the diagnostics |
| 139 | in your files. The command @code{flymake-show-diagnostics-buffer} | 156 | in your files without having to jump to each one to one. The commands |
| 140 | displays a structured listing of diagnostics in the current buffer. | 157 | @code{flymake-show-buffer-diagnostics} and |
| 141 | The listing is displayed in a separate buffer and is continuously | 158 | @code{flymake-show-project-diagnostics} are designed to handle this |
| 142 | updated as you edit source code, adding or removing lines as you make | 159 | situation. When invoked, they bring up a separate buffer containing a |
| 143 | or correct mistakes. | 160 | detailed structured listing of multiple diagnostics in the current |
| 144 | 161 | buffer or for the current project, respectively (@pxref{Projects,,, | |
| 145 | Each line of this listing includes the type of the diagnostic, its | 162 | emacs, The Emacs Editor}). |
| 146 | line and column in the file as well as the diagnostic message. You | 163 | |
| 147 | may sort the listing by each of these columns. | 164 | The listings is continuously updated as you edit source code, adding or |
| 148 | 165 | removing lines as you make or correct mistakes. Each line of this | |
| 149 | @code{flymake-show-project-diagnostics} does something similar but for | 166 | listing includes the type of the diagnostic, its line and column in |
| 150 | the whole project (@pxref{Projects,,, emacs, The Emacs Editor}). | 167 | the file as well as the diagnostic message. You may sort the listing |
| 151 | 168 | by 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 | ||
| 156 | When enabled, Flymake displays its status in the mode line, which | 175 | When enabled, Flymake displays its status in the mode line, which |
| 157 | provides a visual summary of diagnostic collection. It may also hint | 176 | provides 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 |
| 177 | cannot annotate the buffer and action from the user is needed to | 196 | cannot annotate the buffer and action from the user is needed to |
| 178 | investigate and remedy the situation (@pxref{Backend exceptions}). | 197 | investigate 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 | 206 | If you would like to customize the appearance of the mode-line, you |
| 188 | @section Backend exceptions | 207 | can 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 |
| 193 | Some backends may take longer than others to respond or complete, and | 218 | As Flymake supports multiple simutaneously active external backends, |
| 194 | some may decide to @emph{disable} themselves if they are not suitable | 219 | is becomes useful monitor their status. For example, some backends |
| 195 | for the current buffer or encounter some unavoidable problem. A | 220 | may take longer than others to respond or complete, and some may |
| 196 | disabled backend is not tried again for future checks of the current | 221 | decide to @emph{disable} themselves if they are not suitable for the |
| 197 | buffer. | 222 | current buffer or encounter some unavoidable problem. A disabled |
| 223 | backend 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}, | |||
| 204 | show the backends currently used and those which are disabled. | 230 | show the backends currently used and those which are disabled. |
| 205 | 231 | ||
| 206 | @cindex reset disabled backends | 232 | @cindex reset disabled backends |
| 207 | Toggling @code{flymake-mode} off and on again, or invoking | 233 | Sometimes, re-starting a backend that disabled itself is useful after |
| 208 | @code{flymake-start} with a prefix argument is one way to reset the | 234 | some external roadblock has been removed (for example after the user |
| 209 | disabled backend list, so that they will be tried again in the next check. | 235 | installed a needed syntax-check program). Invoking |
| 236 | @code{flymake-start} with a prefix argument is a way to reset the | ||
| 237 | disabled backend list, so that they will be tried again in the next | ||
| 238 | check. Manually toggle @code{flymake-mode} off and on again also | ||
| 239 | works. | ||
| 210 | 240 | ||
| 211 | @cindex logging | 241 | @cindex logging |
| 212 | @cindex flymake logging | 242 | @cindex flymake logging |
| 213 | Flymake also uses a simple logging facility for indicating important | 243 | Flymake uses a simple logging facility for indicating important points |
| 214 | points in the control flow. The logging facility sends logging | 244 | in the control flow. The logging facility sends logging messages to |
| 215 | messages to the @file{*Flymake log*} buffer. The information logged | 245 | the @file{*Flymake log*} buffer. The logged information can be used |
| 216 | can be used for resolving various problems related to Flymake. For | 246 | for resolving various problems related to Flymake. For convenience, a |
| 217 | convenience, a shortcut to this buffer can be found in Flymake's menu, | 247 | shortcut to this buffer can be found in Flymake's menu, accessible |
| 218 | accessible from the top menu bar or just left of the status indicator. | 248 | from the top menu bar or just left of the status indicator. The |
| 249 | command @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. | |||
| 235 | Format to use for the Flymake mode line indicator. | 266 | Format to use for the Flymake mode line indicator. |
| 236 | 267 | ||
| 237 | @item flymake-mode-line-counter-format | 268 | @item flymake-mode-line-counter-format |
| 238 | Mode-line construct for formatting Flymake diagnostic counters inside | 269 | mode line construct for formatting Flymake diagnostic counters inside |
| 239 | the Flymake mode line indicator. | 270 | the 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 |
| 290 | By changing the look and feel of the annotations produced by the | 321 | By changing the look and feel of the annotations produced by the |
| 291 | different backends. | 322 | different backends. @xref{Flymake error types}. |
| 292 | 323 | ||
| 293 | @item | 324 | @item |
| 294 | By adding a new buffer-checking backend. | 325 | By adding a new buffer-checking backend. @xref{Backend functions}. |
| 295 | @end enumerate | 326 | @end enumerate |
| 296 | 327 | ||
| 297 | The following sections discuss each approach in detail. | 328 | The 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 | ||
| 309 | To customize the appearance of error types, set properties on the | 340 | To customize the appearance of error types, the user must set |
| 310 | symbols associated with each diagnostic type. The standard diagnostic | 341 | properties on the symbols associated with each diagnostic type. |
| 311 | symbols are @code{:error}, @code{:warning} and @code{:note} (though | 342 | |
| 312 | the backend may define more, @pxref{Backend functions}). | 343 | The three standard diagnostic keyowrd symbols -- @code{:error}, |
| 344 | @code{:warning} and @code{:note} -- have pre-configured appearances. | ||
| 345 | However a backend may define more (@pxref{Backend functions}). | ||
| 313 | 346 | ||
| 314 | The following properties can be set: | 347 | The following properties can be set: |
| 315 | 348 | ||
| @@ -507,7 +540,7 @@ manual}) or other asynchronous mechanisms. | |||
| 507 | 540 | ||
| 508 | In any case, backend functions are expected to return quickly or | 541 | In any case, backend functions are expected to return quickly or |
| 509 | signal an error, in which case the backend is disabled | 542 | signal an error, in which case the backend is disabled |
| 510 | (@pxref{Backend exceptions}). | 543 | (@pxref{Troubleshooting}). |
| 511 | 544 | ||
| 512 | If the function returns, Flymake considers the backend to be | 545 | If 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 |
| 621 | For troubleshooting purposes, backends may record arbitrary | 654 | For troubleshooting purposes, backends may record arbitrary |
| 622 | exceptional or erroneous situations into the Flymake log | 655 | exceptional or erroneous situations into the Flymake log |
| 623 | buffer (@pxref{Backend exceptions}): | 656 | buffer (@pxref{Troubleshooting}): |
| 624 | 657 | ||
| 625 | @deffn Macro flymake-log level msg &optional args | 658 | @deffn Macro flymake-log level msg &optional args |
| 626 | Log, at level @var{level}, the message @var{msg} formatted with | 659 | Log, at level @var{level}, the message @var{msg} formatted with |
| @@ -1116,7 +1149,7 @@ correct @file{file.h}. | |||
| 1116 | First matching master file found stops the search. The master file is then | 1149 | First matching master file found stops the search. The master file is then |
| 1117 | patched and saved to disk. In case no master file is found, syntax check is | 1150 | patched and saved to disk. In case no master file is found, syntax check is |
| 1118 | aborted, and corresponding status (@samp{!}) is reported in the mode line. | 1151 | aborted, 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 |