diff options
| author | Paul Eggert | 2017-10-12 13:44:56 -0700 |
|---|---|---|
| committer | Paul Eggert | 2017-10-12 13:44:56 -0700 |
| commit | d0f910cbf862db2a89d56e6414c93a93e46e202b (patch) | |
| tree | 0504513f33cdb0a31e5b04ecd60c374a5d096dda /doc/misc | |
| parent | a346d5bd25acee99bb94f9b785507d4e4ccb554b (diff) | |
| parent | 59b5dc60d660f81f8b781068d13727ed812ad555 (diff) | |
| download | emacs-d0f910cbf862db2a89d56e6414c93a93e46e202b.tar.gz emacs-d0f910cbf862db2a89d56e6414c93a93e46e202b.zip | |
Merge from origin/emacs-26
59b5dc60d6 Fix this-command-keys for "M-x foo" commands
2f4bd2fbda Let rename-file rename dirs across filesystems
413978727c Simplify Flymake user documentation
6ff18c3995 * etc/NEWS: Mention the new version of Org.
b78332c3c6 Don't use (format "%s" ...) for string copying (Bug#28774)
078fb7f6df Make frame-list-z-order on NS match Windows behaviour (bug...
# Conflicts:
# etc/NEWS
Diffstat (limited to 'doc/misc')
| -rw-r--r-- | doc/misc/flymake.texi | 166 |
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 | ||
| 68 | Flymake is a universal on-the-fly buffer checker implemented as an | 67 | Flymake is a universal on-the-fly buffer checker implemented as an |
| 69 | Emacs minor mode. When enabled, Flymake visually annotates the buffer | 68 | Emacs minor minor. To use Flymake, you must first activate |
| 70 | with diagnostic information coming from one or more different sources, | 69 | @code{flymake-mode} by using the command @kbd{flymake-mode}. |
| 71 | or @dfn{backends}. | ||
| 72 | 70 | ||
| 73 | Flymake annotates the buffer by highlighting problematic buffer | 71 | When enabled, Flymake collects information about problems in the |
| 74 | regions with a special space. It displays an overall buffer status in | 72 | buffer, called @dfn{diagnostics}, from one or more different sources, |
| 75 | the mode line containing totals for different types of diagnostics. | 73 | or @dfn{backends}, and then visually annotates the buffer by |
| 76 | 74 | highlighting problematic buffer regions with a special face. | |
| 77 | @code{flymake-goto-next-error} and @code{flymake-goto-prev-error} are | ||
| 78 | commands that allow easy navigation to the next/previous erroneous | ||
| 79 | line, respectively. If might be a good idea to map them to @kbd{M-n} | ||
| 80 | and @kbd{M-p} in @code{flymake-mode}, by adding to your init file: | ||
| 81 | 75 | ||
| 82 | @lisp | 76 | It also displays an overall buffer status in the mode line containing |
| 83 | (define-key flymake-mode-map (kbd "M-n") 'flymake-goto-next-error) | 77 | totals for different types of diagnostics. |
| 84 | (define-key flymake-mode-map (kbd "M-p") 'flymake-goto-prev-error) | ||
| 85 | @end lisp | ||
| 86 | 78 | ||
| 87 | Syntax check is done ``on-the-fly''. It is started whenever | 79 | Syntax 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 |
| 95 | a newline character is added to the buffer, unless | 87 | a 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 |
| 99 | some changes were made to the buffer more than @code{0.5} seconds ago | 91 | some 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 | ||
| 95 | Syntax check can also be started manually by typing the @kbd{M-x | ||
| 96 | flymake-start @key{RET}} command. | ||
| 97 | |||
| 98 | @code{flymake-goto-next-error} and @code{flymake-goto-prev-error} are | ||
| 99 | commands that allow easy navigation to the next/previous erroneous | ||
| 100 | line, respectively. If might be a good idea to map them to @kbd{M-n} | ||
| 101 | and @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 | |||
| 103 | Flymake is a universal syntax checker in the sense that it's easily | 108 | Flymake is a universal syntax checker in the sense that it's easily |
| 104 | extended to support new backends (@pxref{Extending Flymake}). | 109 | extended to support new backends (@pxref{Extending Flymake}). |
| 105 | 110 | ||
| 106 | Historically, Flymake used to accept diagnostics from a single, albeit | 111 | Historically, Flymake used to accept diagnostics from a single |
| 107 | reasonably flexible, backend. | 112 | backend, albeit a reasonably flexible one. |
| 108 | 113 | ||
| 109 | This backend isn't (yet) obsolete, and so is still available as a | 114 | This backend isn't (yet) obsolete, and so is still available as a |
| 110 | fallback and active by default (@pxref{The legacy Proc backend}). It works by | 115 | fallback 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 | |||
| 114 | buffer, and parsing the output for known error/warning message | 119 | buffer, and parsing the output for known error/warning message |
| 115 | patterns. | 120 | patterns. |
| 116 | 121 | ||
| 117 | @node Installing Flymake | ||
| 118 | @chapter Installing | ||
| 119 | @cindex installing flymake | ||
| 120 | |||
| 121 | Flymake is included with Emacs and its main commands, like | ||
| 122 | @code{flymake-mode}, are autoloaded. This means there is usually | ||
| 123 | nothing 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 | |||
| 143 | Flymake is an Emacs minor mode. To use Flymake, you | ||
| 144 | must first activate @code{flymake-mode} by using the command | ||
| 145 | @kbd{flymake-mode}. | ||
| 146 | |||
| 147 | Instead of manually activating @code{flymake-mode}, you can configure | ||
| 148 | Emacs to automatically enable @code{flymake-mode} upon opening any | ||
| 149 | file for which syntax check is possible. To do so, place the following | ||
| 150 | line 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 | ||
| 162 | When @code{flymake-mode} is active, syntax check is started | ||
| 163 | automatically on any of the three conditions mentioned in | ||
| 164 | @ref{Overview of Flymake}. Syntax check can also be started manually | ||
| 165 | by 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 | |||
| 171 | After syntax check is completed, lines for which at least one error or | ||
| 172 | warning has been reported are highlighted, and the total number of errors | ||
| 173 | and warning is shown in the mode line. Use the following functions to | ||
| 174 | navigate the highlighted lines: | ||
| 175 | |||
| 176 | @table @code | ||
| 177 | @findex flymake-goto-next-error | ||
| 178 | @item flymake-goto-next-error | ||
| 179 | Moves point to the next erroneous line, if any. | ||
| 180 | |||
| 181 | @findex flymake-goto-prev-error | ||
| 182 | @item flymake-goto-prev-error | ||
| 183 | Moves point to the previous erroneous line. | ||
| 184 | @end table | ||
| 185 | |||
| 186 | If the user option @code{flymake-wrap-around} is active | ||
| 187 | (@pxref{Customizable variables}), these functions treat diagnostics | ||
| 188 | as a linked list. Therefore, @code{flymake-goto-next-error} will go | ||
| 189 | to 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 | ||
| 195 | While enabled, Flymake displays its status in the mode line. | 132 | When enabled, Flymake displays its status in the mode line, which |
| 133 | provides a visual summary of diagnostic collection. It may also hint | ||
| 134 | at certain exceptional situations encountered when communicating with | ||
| 135 | backends. | ||
| 136 | |||
| 196 | The following statuses are defined: | 137 | The 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, | ||
| 142 | the total number of errors and warnings found during the last buffer | ||
| 143 | check, for all backends. They may be followed by other totals for | ||
| 144 | other 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 |
| 201 | where questioned. | 148 | where questioned. It is reasonable to assume that this is a temporary |
| 149 | delay 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 |
| 205 | Left-clicking Flymake's mode line indicator pops up a menu listing the | 153 | cannot annotate the buffer and action from the user is needed to |
| 206 | option to visit Flymake's log buffer. In this buffer these situations | 154 | investigate and remedy the situation (@pxref{Backend exceptions}). |
| 207 | can 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}. | 158 | cannot annotate it. To fix this, a user may look to extending Flymake |
| 159 | and 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 | ||
| 215 | check 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 |
| 224 | Some backends may take longer than others to respond or complete, and | 169 | Some backends may take longer than others to respond or complete, and |
| 225 | some may decide to @emph{disable} themselves if they are not suitable | 170 | some may decide to @emph{disable} themselves if they are not suitable |
| 226 | for the current buffer. A disabled backend is not tried again for | 171 | for the current buffer or encounter some unavoidable problem. A |
| 227 | future checks of the current buffer. | 172 | disabled backend is not tried again for future checks of the current |
| 173 | buffer. | ||
| 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 |
| 243 | Flymake also uses a simple logging facility for indicating important points | 189 | Flymake also uses a simple logging facility for indicating important |
| 244 | in the control flow. The logging facility sends logging messages to | 190 | points in the control flow. The logging facility sends logging |
| 245 | the @file{*Flymake log*} buffer. The information logged can be used for | 191 | messages to the @file{*Flymake log*} buffer. The information logged |
| 246 | resolving various problems related to Flymake. | 192 | can be used for resolving various problems related to Flymake. For |
| 193 | convenience, a shortcut to this buffer can be found in Flymake's menu, | ||
| 194 | accessible 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 |