diff options
| author | João Távora | 2017-09-27 18:42:02 +0100 |
|---|---|---|
| committer | João Távora | 2017-10-03 01:07:32 +0100 |
| commit | b80d29d15e8bfd4c8594e0cf6cf42733dc308f13 (patch) | |
| tree | 360ac46e6678a02d512024c488e511fa89f85d1c | |
| parent | 2971cd063f4a8d5983cb43502e7f672057d0deed (diff) | |
| download | emacs-scratch/flymake-refactor-cleaner-for-emacs-26.tar.gz emacs-scratch/flymake-refactor-cleaner-for-emacs-26.zip | |
Start rewriting Flymake manualscratch/flymake-refactor-cleaner-for-emacs-26
* doc/misc/flymake.texi (Overview of Flymake): Rewrite a bit.
(Installing Flymake): Delete most of this.
(Running the syntax check): Mention flymake-start.
(Navigating to error lines): Rewrite.
(Viewing error messages): Commente out.
(Syntax check statuses, Troubleshooting): Rewrite a bit.
(Customizable variables): New section under "Using
Flymake". Don't mention any proc variables here.
(Configuring Flymake): Delete
(Proc backend): New chapter
(Proc customization variables): New chapter.
| -rw-r--r-- | doc/misc/flymake.texi | 268 |
1 files changed, 132 insertions, 136 deletions
diff --git a/doc/misc/flymake.texi b/doc/misc/flymake.texi index 01849b7d9a5..61133a079ec 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 | ||
| @@ -53,7 +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 | * Proc backend:: | ||
| 57 | * Flymake Implementation:: | 58 | * Flymake Implementation:: |
| 58 | * GNU Free Documentation License:: | 59 | * GNU Free Documentation License:: |
| 59 | * Index:: | 60 | * Index:: |
| @@ -63,29 +64,28 @@ modify this GNU manual.'' | |||
| 63 | @chapter Overview | 64 | @chapter Overview |
| 64 | @cindex Overview of Flymake | 65 | @cindex Overview of Flymake |
| 65 | 66 | ||
| 66 | Flymake is a universal on-the-fly syntax checker implemented as an | 67 | Flymake is a universal on-the-fly buffer checker implemented as an |
| 67 | Emacs minor mode. Flymake runs the pre-configured syntax check tool | 68 | Emacs minor mode. When enabled, Flymake visually annotates the buffer |
| 68 | (compiler for C++ files, @code{perl} for perl files, etc.)@: in the | 69 | with diagnostic information coming from one or more different sources, |
| 69 | background, passing it a temporary copy of the current buffer, and | 70 | or @emph{backend}. |
| 70 | parses the output for known error/warning message patterns. Flymake | 71 | |
| 71 | then highlights erroneous lines (i.e., lines for which at least one | 72 | Historically, Flymake used to accept a diagnostics from a single |
| 72 | error or warning has been reported by the syntax check tool), and | 73 | backend (albeit a very flexible one) which selected a syntax check |
| 73 | displays an overall buffer status in the mode line. Status information | 74 | tool from a preconfigured list (compiler for C++ files, @code{perl} |
| 74 | displayed by Flymake contains total number of errors and warnings | 75 | for perl files, etc.)@: and executed it in the background, passing it |
| 75 | reported for the buffer during the last syntax check. | 76 | a temporary copy of the current buffer, and parses the output for |
| 77 | known error/warning message patterns. This backend is still available | ||
| 78 | as a fallback and a default(@pxref{Proc backend}). | ||
| 79 | |||
| 80 | Flymake annotates the buffer by highlighting erroneous lines or | ||
| 81 | regions and displays an overall buffer status in the mode line. | ||
| 82 | Status information displayed by Flymake contains totals for different | ||
| 83 | types of diagnostics. | ||
| 76 | 84 | ||
| 77 | @code{flymake-goto-next-error} and @code{flymake-goto-prev-error} | 85 | @code{flymake-goto-next-error} and @code{flymake-goto-prev-error} |
| 78 | functions allow for easy navigation to the next/previous erroneous | 86 | functions allow for easy navigation to the next/previous erroneous |
| 79 | line, respectively. | 87 | line, respectively. When @code{flymake-mode} is active, they are |
| 80 | 88 | mapped to @kbd{M-n} and @kbd{M-p}, respectively, and by default. | |
| 81 | Calling @code{flymake-display-err-menu-for-current-line} will popup a | ||
| 82 | menu containing error messages reported by the syntax check tool for | ||
| 83 | the current line. Errors/warnings belonging to another file, such as a | ||
| 84 | @code{.h} header file included by a @code{.c} file, are shown in the | ||
| 85 | current buffer as belonging to the first line. Menu items for such | ||
| 86 | messages also contain a filename and a line number. Selecting such a | ||
| 87 | menu item will automatically open the file and jump to the line with | ||
| 88 | error. | ||
| 89 | 89 | ||
| 90 | Syntax check is done ``on-the-fly''. It is started whenever | 90 | Syntax check is done ``on-the-fly''. It is started whenever |
| 91 | 91 | ||
| @@ -97,33 +97,15 @@ delay is configurable). | |||
| 97 | @end itemize | 97 | @end itemize |
| 98 | 98 | ||
| 99 | Flymake is a universal syntax checker in the sense that it's easily | 99 | Flymake is a universal syntax checker in the sense that it's easily |
| 100 | extended to support new syntax check tools and error message | 100 | extended to support new backends. @xref{Customizable variables}. |
| 101 | patterns. @xref{Configuring Flymake}. | ||
| 102 | 101 | ||
| 103 | @node Installing Flymake | 102 | @node Installing Flymake |
| 104 | @chapter Installing | 103 | @chapter Installing |
| 105 | @cindex Installing Flymake | 104 | @cindex Installing Flymake |
| 106 | 105 | ||
| 107 | 106 | Flymake is included with Emacs and its main commands, like | |
| 108 | Flymake is packaged in a single file, @code{flymake.el}. | 107 | @code{flymake-mode}, are autoloaded. This means there is usually |
| 109 | 108 | nothing to do by way of installation. | |
| 110 | To install/update Flymake, place @code{flymake.el} to a directory | ||
| 111 | somewhere on Emacs load path. You might also want to byte-compile | ||
| 112 | @code{flymake.el} to improve performance. | ||
| 113 | |||
| 114 | Also, place the following line in the @code{.emacs} file. | ||
| 115 | |||
| 116 | @lisp | ||
| 117 | (require 'flymake) | ||
| 118 | @end lisp | ||
| 119 | |||
| 120 | You 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 | 109 | ||
| 128 | @node Using Flymake | 110 | @node Using Flymake |
| 129 | @chapter Using Flymake | 111 | @chapter Using Flymake |
| @@ -132,10 +114,10 @@ You might also map the most frequently used Flymake functions, such as | |||
| 132 | @menu | 114 | @menu |
| 133 | * Flymake mode:: | 115 | * Flymake mode:: |
| 134 | * Running the syntax check:: | 116 | * Running the syntax check:: |
| 135 | * Navigating to error lines:: | 117 | * Navigating to error lines:: @c * Viewing error messages:: |
| 136 | * Viewing error messages:: | ||
| 137 | * Syntax check statuses:: | 118 | * Syntax check statuses:: |
| 138 | * Troubleshooting:: | 119 | * Troubleshooting:: |
| 120 | * Customizable variables:: | ||
| 139 | @end menu | 121 | @end menu |
| 140 | 122 | ||
| 141 | @node Flymake mode | 123 | @node Flymake mode |
| @@ -161,10 +143,9 @@ line in @code{.emacs}: | |||
| 161 | 143 | ||
| 162 | When @code{flymake-mode} is active, syntax check is started | 144 | When @code{flymake-mode} is active, syntax check is started |
| 163 | automatically on any of the three conditions mentioned above. Syntax | 145 | automatically on any of the three conditions mentioned above. Syntax |
| 164 | check can also be started manually by using the | 146 | check can also be started manually by using the @code{flymake-start} |
| 165 | @code{flymake-start-syntax-check-for-current-buffer} function. This | 147 | function. This can be used, for example, when changes were made to |
| 166 | can be used, for example, when changes were made to some other buffer | 148 | some other buffer affecting the current buffer. |
| 167 | affecting the current buffer. | ||
| 168 | 149 | ||
| 169 | @node Navigating to error lines | 150 | @node Navigating to error lines |
| 170 | @section Navigating to error lines | 151 | @section Navigating to error lines |
| @@ -185,21 +166,24 @@ navigate the highlighted lines. | |||
| 185 | 166 | ||
| 186 | @end multitable | 167 | @end multitable |
| 187 | 168 | ||
| 188 | These functions treat erroneous lines as a linked list. Therefore, | 169 | If the user options @code{flymake-wrap-around} is active |
| 189 | @code{flymake-goto-next-error} will go to the first erroneous line | 170 | (@pxref{Customizable variables}), these functions treat diagnostics |
| 190 | when invoked in the end of the buffer. | 171 | as a linked list. Therefore, @code{flymake-goto-next-error} will go |
| 191 | 172 | to the first diagnostic when invoked in the end of the buffer. | |
| 192 | @node Viewing error messages | 173 | |
| 193 | @section Viewing error messages | 174 | @c jt@2017/09/27: The latest redesign more than likely broke this. |
| 194 | @cindex Viewing error messages | 175 | @c |
| 195 | 176 | @c @node Viewing error messages | |
| 196 | To view error messages belonging to the current line, use the | 177 | @c @section Viewing error messages |
| 197 | @code{flymake-display-err-menu-for-current-line} function. If there's | 178 | @c @cindex Viewing error messages |
| 198 | at least one error or warning reported for the current line, this | 179 | |
| 199 | function will display a popup menu with error/warning texts. | 180 | @c To view error messages belonging to the current line, use the |
| 200 | Selecting the menu item whose error belongs to another file brings | 181 | @c @code{flymake-display-err-menu-for-current-line} function. If there's |
| 201 | forward that file with the help of the | 182 | @c at least one error or warning reported for the current line, this |
| 202 | @code{flymake-goto-file-and-line} function. | 183 | @c function will display a popup menu with error/warning texts. |
| 184 | @c Selecting the menu item whose error belongs to another file brings | ||
| 185 | @c forward that file with the help of the | ||
| 186 | @c @code{flymake-goto-file-and-line} function. | ||
| 203 | 187 | ||
| 204 | @node Syntax check statuses | 188 | @node Syntax check statuses |
| 205 | @section Syntax check statuses | 189 | @section Syntax check statuses |
| @@ -209,29 +193,22 @@ After syntax check is finished, its status is displayed in the mode line. | |||
| 209 | The following statuses are defined. | 193 | The following statuses are defined. |
| 210 | 194 | ||
| 211 | @multitable @columnfractions 0.25 0.75 | 195 | @multitable @columnfractions 0.25 0.75 |
| 212 | @item Flymake* or Flymake:E/W* | 196 | @item Flymake:run |
| 213 | @tab Flymake is currently running. For the second case, E/W contains the | 197 | @tab Flymake is currently running at least one backend. |
| 214 | error and warning count for the previous run. | ||
| 215 | 198 | ||
| 216 | @item Flymake | 199 | @item Flymake |
| 217 | @tab Syntax check is not running. Usually this means syntax check was | 200 | @tab Flymake was unable to successfully execute any backend. |
| 218 | successfully passed (no errors, no warnings). Other possibilities are: | ||
| 219 | syntax check was killed as a result of executing | ||
| 220 | @code{flymake-compile}, or syntax check cannot start as compilation | ||
| 221 | is currently in progress. | ||
| 222 | |||
| 223 | @item Flymake:E/W | ||
| 224 | @tab Number of errors/warnings found by the syntax check process. | ||
| 225 | 201 | ||
| 226 | @item Flymake:! | 202 | @item Flymake [<errors> <warnings> ... ] |
| 227 | @tab Flymake was unable to find master file for the current buffer. | 203 | @tab Normal operation, number of errors/warnings found by the syntax check process. |
| 228 | @end multitable | 204 | @end multitable |
| 229 | 205 | ||
| 230 | The following errors cause a warning message and switch flymake mode | 206 | The default backend @code{flymake-proc-legacy-flymake} may encounter |
| 231 | OFF for the buffer. | 207 | some situations that cause a warning message to the @code{*Flymake |
| 208 | log*} buffer. | ||
| 232 | 209 | ||
| 233 | @multitable @columnfractions 0.25 0.75 | 210 | @multitable @columnfractions 0.25 0.75 |
| 234 | @item CFGERR | 211 | @item @code{:configuration-error} |
| 235 | @tab Syntax check process returned nonzero exit code, but no | 212 | @tab Syntax check process returned nonzero exit code, but no |
| 236 | errors/warnings were reported. This indicates a possible configuration | 213 | errors/warnings were reported. This indicates a possible configuration |
| 237 | error (for example, no suitable error message patterns for the | 214 | error (for example, no suitable error message patterns for the |
| @@ -243,10 +220,11 @@ syntax check tool). | |||
| 243 | @item NOMK | 220 | @item NOMK |
| 244 | @tab Flymake was unable to find a suitable buildfile for the current buffer. | 221 | @tab Flymake was unable to find a suitable buildfile for the current buffer. |
| 245 | 222 | ||
| 246 | @item PROCERR | 223 | @item @code{:make-process-error} |
| 247 | @tab Flymake was unable to launch a syntax check process. | 224 | @tab Flymake was unable to launch a syntax check process. |
| 248 | @end multitable | 225 | @end multitable |
| 249 | 226 | ||
| 227 | These ``panic'' situations cause the backend to be disabled. | ||
| 250 | 228 | ||
| 251 | @node Troubleshooting | 229 | @node Troubleshooting |
| 252 | @section Troubleshooting | 230 | @section Troubleshooting |
| @@ -255,97 +233,115 @@ syntax check tool). | |||
| 255 | 233 | ||
| 256 | Flymake uses a simple logging facility for indicating important points | 234 | Flymake uses a simple logging facility for indicating important points |
| 257 | in the control flow. The logging facility sends logging messages to | 235 | in the control flow. The logging facility sends logging messages to |
| 258 | the @file{*Messages*} buffer. The information logged can be used for | 236 | the @file{*Flymake log*} buffer. The information logged can be used for |
| 259 | resolving various problems related to Flymake. | 237 | resolving various problems related to Flymake. |
| 260 | 238 | ||
| 261 | Logging output is controlled by the @code{flymake-log-level} | 239 | Logging output is controlled by the Emacs @code{warning-minimum-log-level} |
| 262 | variable. @code{3} is the most verbose level, and @code{-1} switches | 240 | and @code{warning-minimum-level} variables. |
| 263 | logging off. | 241 | |
| 242 | @node Customizable variables | ||
| 243 | @section Customizable variables | ||
| 244 | @cindex Customizable variables | ||
| 245 | |||
| 246 | This section summarizes variables used for the configuration of the | ||
| 247 | Flymake user interface. | ||
| 248 | |||
| 249 | @table @code | ||
| 250 | @item flymake-no-changes-timeout | ||
| 251 | If any changes are made to the buffer, syntax check is automatically | ||
| 252 | started after @code{flymake-no-changes-timeout} seconds. | ||
| 253 | |||
| 254 | @item flymake-start-syntax-check-on-newline | ||
| 255 | A boolean flag indicating whether to start syntax check after a | ||
| 256 | newline character is added to the buffer. | ||
| 257 | |||
| 258 | @item flymake-error | ||
| 259 | A custom face for highlighting regions for which an error has been | ||
| 260 | reported. | ||
| 261 | |||
| 262 | @item flymake-warning | ||
| 263 | A custom face for highlighting regions for which a warning has been | ||
| 264 | reported. | ||
| 265 | |||
| 266 | @item flymake-note | ||
| 267 | A custom face for highlighting regions for which a note has been | ||
| 268 | reported. | ||
| 269 | |||
| 270 | @item flymake-error-bitmap | ||
| 271 | A bitmap used in the fringe to mark lines for which an error has | ||
| 272 | been reported. | ||
| 273 | |||
| 274 | @item flymake-warning-bitmap | ||
| 275 | A bitmap used in the fringe to mark lines for which a warning has | ||
| 276 | been reported. | ||
| 277 | |||
| 278 | @item flymake-fringe-indicator-position | ||
| 279 | Which fringe (if any) should show the warning/error bitmaps. | ||
| 280 | |||
| 281 | @item flymake-wrap-around | ||
| 282 | If non-nil, moving to errors with @code{flymake-goto-next-error} and | ||
| 283 | @code{flymake-goto-prev-error} wraps around buffer boundaries. | ||
| 284 | |||
| 285 | @end table | ||
| 286 | |||
| 287 | @node Extending Flymake | ||
| 288 | @chapter Extending Flymake | ||
| 289 | @cindex Extending Flymake | ||
| 264 | 290 | ||
| 265 | @node Configuring Flymake | 291 | @node Proc backend |
| 266 | @chapter Configuring and Extending Flymake | 292 | @chapter The legacy ``Proc'' backend |
| 267 | @cindex Configuring and Extending Flymake | 293 | @cindex Proc backend |
| 268 | 294 | ||
| 269 | @menu | 295 | @menu |
| 270 | * Customizable variables:: | 296 | * Proc customization variables:: |
| 271 | * Adding support for a new syntax check tool:: | 297 | * Adding support for a new syntax check tool:: |
| 272 | @end menu | 298 | @end menu |
| 273 | 299 | ||
| 274 | Flymake was designed to be easily extended for supporting new syntax | 300 | The backend @code{flymake-proc-legacy-backend} was originally designed |
| 275 | check tools and error message patterns. | 301 | to be extended for supporting new syntax check tools and error message |
| 276 | 302 | patterns. It is also controlled by its own set of customization variables | |
| 277 | @node Customizable variables | ||
| 278 | @section Customizable variables | ||
| 279 | @cindex Customizable variables | ||
| 280 | 303 | ||
| 281 | This section summarizes variables used for Flymake | 304 | @node Proc customization variables |
| 282 | configuration. | 305 | @section Customization variables for the Proc backend |
| 306 | @cindex Proc customization variables | ||
| 283 | 307 | ||
| 284 | @table @code | 308 | @table @code |
| 285 | @item flymake-log-level | 309 | @item flymake-proc-log-level |
| 286 | Controls logging output, see @ref{Troubleshooting}. | 310 | Controls logging output, see @ref{Troubleshooting}. |
| 287 | 311 | ||
| 288 | @item flymake-allowed-file-name-masks | 312 | @item flymake-proc-allowed-file-name-masks |
| 289 | A list of @code{(filename-regexp, init-function, cleanup-function | 313 | A list of @code{(filename-regexp, init-function, cleanup-function |
| 290 | getfname-function)} for configuring syntax check tools. @xref{Adding | 314 | getfname-function)} for configuring syntax check tools. @xref{Adding |
| 291 | support for a new syntax check tool}. | 315 | support for a new syntax check tool}. |
| 292 | 316 | ||
| 293 | @ignore | 317 | @ignore |
| 294 | @item flymake-buildfile-dirs | 318 | @item flymake-proc-buildfile-dirs |
| 295 | A list of directories (relative paths) for searching a | 319 | A list of directories (relative paths) for searching a |
| 296 | buildfile. @xref{Locating the buildfile}. | 320 | buildfile. @xref{Locating the buildfile}. |
| 297 | @end ignore | 321 | @end ignore |
| 298 | 322 | ||
| 299 | @item flymake-master-file-dirs | 323 | @item flymake-proc-master-file-dirs |
| 300 | A list of directories for searching a master file. @xref{Locating a | 324 | A list of directories for searching a master file. @xref{Locating a |
| 301 | master file}. | 325 | master file}. |
| 302 | 326 | ||
| 303 | @item flymake-get-project-include-dirs-function | 327 | @item flymake-proc-get-project-include-dirs-function |
| 304 | A function used for obtaining a list of project include dirs (C/C++ | 328 | A function used for obtaining a list of project include dirs (C/C++ |
| 305 | specific). @xref{Getting the include directories}. | 329 | specific). @xref{Getting the include directories}. |
| 306 | 330 | ||
| 307 | @item flymake-master-file-count-limit | 331 | @item flymake-proc-master-file-count-limit |
| 308 | @itemx flymake-check-file-limit | 332 | @itemx flymake-proc-check-file-limit |
| 309 | Used when looking for a master file. @xref{Locating a master file}. | 333 | Used when looking for a master file. @xref{Locating a master file}. |
| 310 | 334 | ||
| 311 | @item flymake-err-line-patterns | 335 | @item flymake-proc-err-line-patterns |
| 312 | Patterns for error/warning messages in the form @code{(regexp file-idx | 336 | Patterns for error/warning messages in the form @code{(regexp file-idx |
| 313 | line-idx col-idx err-text-idx)}. @xref{Parsing the output}. | 337 | line-idx col-idx err-text-idx)}. @xref{Parsing the output}. |
| 314 | 338 | ||
| 315 | @item flymake-warning-predicate | 339 | @item flymake-proc-warning-predicate |
| 316 | Predicate to classify error text as warning. @xref{Parsing the output}. | 340 | Predicate to classify error text as warning. @xref{Parsing the output}. |
| 317 | 341 | ||
| 318 | @item flymake-compilation-prevents-syntax-check | 342 | @item flymake-proc-compilation-prevents-syntax-check |
| 319 | A flag indicating whether compilation and syntax check of the same | 343 | A flag indicating whether compilation and syntax check of the same |
| 320 | file cannot be run simultaneously. | 344 | file cannot be run simultaneously. |
| 321 | |||
| 322 | @item flymake-no-changes-timeout | ||
| 323 | If any changes are made to the buffer, syntax check is automatically | ||
| 324 | started after @code{flymake-no-changes-timeout} seconds. | ||
| 325 | |||
| 326 | @item flymake-start-syntax-check-on-newline | ||
| 327 | A boolean flag indicating whether to start syntax check after a | ||
| 328 | newline character is added to the buffer. | ||
| 329 | |||
| 330 | @item flymake-errline | ||
| 331 | A custom face for highlighting lines for which at least one error has | ||
| 332 | been reported. | ||
| 333 | |||
| 334 | @item flymake-warnline | ||
| 335 | A custom face for highlighting lines for which at least one warning | ||
| 336 | and no errors have been reported. | ||
| 337 | |||
| 338 | @item flymake-error-bitmap | ||
| 339 | A bitmap used in the fringe to mark lines for which an error has | ||
| 340 | been reported. | ||
| 341 | |||
| 342 | @item flymake-warning-bitmap | ||
| 343 | A bitmap used in the fringe to mark lines for which a warning has | ||
| 344 | been reported. | ||
| 345 | |||
| 346 | @item flymake-fringe-indicator-position | ||
| 347 | Which fringe (if any) should show the warning/error bitmaps. | ||
| 348 | |||
| 349 | @end table | 345 | @end table |
| 350 | 346 | ||
| 351 | @node Adding support for a new syntax check tool | 347 | @node Adding support for a new syntax check tool |