diff options
| author | João Távora | 2018-06-05 15:13:02 +0100 |
|---|---|---|
| committer | João Távora | 2018-06-05 15:22:16 +0100 |
| commit | fa794d1b603e52e2a80d69c5610b782904ee6a69 (patch) | |
| tree | e6dbf1d0ac1460488235e7785bf392caf472404c /doc/misc | |
| parent | aadac04923c9ae47f0bccc706857b94166c9d355 (diff) | |
| download | emacs-fa794d1b603e52e2a80d69c5610b782904ee6a69.tar.gz emacs-fa794d1b603e52e2a80d69c5610b782904ee6a69.zip | |
Obsolete Flymake's flymake-diagnostic-types-alist
That varaiable was an association between symbols and properties,
effecively duplicating symbol's property lists. It is simpler to just
put properties on symbols. Backward compatibility to the old variable
has been kept.
* doc/misc/flymake.texi (Flymake error types): Don't mention
flymake-diagnostic-types-alist.
(Flymake error types): Rework section.
(Backend functions): Refill a paragraph.
(Flymake utility functions): Don't mention
flymake-diagnostic-types-alist.
(Proc customization variables): Don't mention
flymake-diagnostic-types-alist.
* etc/NEWS: Mention obsoletion of flymake-diagnostic-types-alist.
* lisp/progmodes/flymake-proc.el
(flymake-proc--diagnostics-for-pattern): Don't use
flymake-diagnostic-types-alist.
* lisp/progmodes/flymake.el: Rewrite commentary.
(flymake-make-diagnostic, flymake-mode, flymake-goto-next-error)
(flymake-goto-prev-error): Don't mention
flymake-diagnostic-types-alist in docstring.
(flymake-diagnostic-types-alist): Make obsolete.
(:error, :warning, :note): Put flymake-category in these symbols.
(flymake-error, flymake-warning, flymake-note): Put
`flymake-bitmap', not `bitmap' in these symbols.
(flymake--lookup-type-property, flymake--highlight-line): Rewrite.
Honor flymake-diagnostic-types-alist for backward
compatibility.
* lisp/progmodes/python.el (python-flymake-msg-alist): Don't
mention flymake-diagnostic-types-alist.
Diffstat (limited to 'doc/misc')
| -rw-r--r-- | doc/misc/flymake.texi | 150 |
1 files changed, 75 insertions, 75 deletions
diff --git a/doc/misc/flymake.texi b/doc/misc/flymake.texi index 9260f4f22ba..e7f4da75bb9 100644 --- a/doc/misc/flymake.texi +++ b/doc/misc/flymake.texi | |||
| @@ -275,54 +275,61 @@ The following sections discuss each approach in detail. | |||
| 275 | @cindex customizing error types | 275 | @cindex customizing error types |
| 276 | @cindex error types, customization | 276 | @cindex error types, customization |
| 277 | 277 | ||
| 278 | @vindex flymake-diagnostic-types-alist | 278 | To customize the appearance of error types, set properties on the |
| 279 | The variable @code{flymake-diagnostic-types-alist} is looked up by | 279 | symbols associated with each diagnostic type. The standard diagnostic |
| 280 | Flymake every time an annotation for a diagnostic is created in the | 280 | symbols are @code{:error}, @code{:warning} and @code{:note} (though |
| 281 | buffer. Specifically, this variable holds a table of correspondence | 281 | the backend may define more, @pxref{Backend functions}). |
| 282 | between symbols designating diagnostic types and an additional | 282 | |
| 283 | sub-table of properties pertaining to each diagnostic type. | 283 | The following properties can be set: |
| 284 | |||
| 285 | Both tables are laid out in association list (@pxref{Association | ||
| 286 | Lists,,, elisp, The Emacs Lisp Reference Manual}) format, and thus can | ||
| 287 | be conveniently accessed with the functions of the @code{assoc} | ||
| 288 | family. | ||
| 289 | |||
| 290 | You can use any symbol-value association in the properties sub-table, | ||
| 291 | but some symbols have special meaning as to where and how Flymake | ||
| 292 | presents the diagnostic: | ||
| 293 | 284 | ||
| 294 | @itemize | 285 | @itemize |
| 295 | 286 | ||
| 296 | @item | 287 | @item |
| 297 | @cindex bitmap of diagnostic | 288 | @cindex bitmap of diagnostic |
| 298 | @code{bitmap}, an image displayed in the fringe according to | 289 | @code{flymake-bitmap}, an image displayed in the fringe according to |
| 299 | @code{flymake-fringe-indicator-position}. The value actually follows | 290 | @code{flymake-fringe-indicator-position}. The value actually follows |
| 300 | the syntax of @code{flymake-error-bitmap} (@pxref{Customizable | 291 | the syntax of @code{flymake-error-bitmap} (@pxref{Customizable |
| 301 | variables}). It is overridden by any @code{before-string} overlay | 292 | variables}). It is overridden by any @code{before-string} overlay |
| 302 | property. | 293 | property. |
| 303 | 294 | ||
| 304 | @item | 295 | @item |
| 305 | @cindex severity of diagnostic | 296 | @code{flymake-overlay-control}, an alist ((@var{OVPROP} . @var{VALUE}) |
| 306 | @code{severity} is a non-negative integer specifying the diagnostic's | 297 | @var{...}) of further properties used to affect the appearance of |
| 307 | severity. The higher the value, the more serious is the error. If | 298 | Flymake annotations. With the exception of @code{category} and |
| 308 | the overlay property @code{priority} is not specified, @code{severity} | 299 | @code{evaporate}, these properties are applied directly to the created |
| 309 | is used to set it and help sort overlapping overlays. | 300 | overlay (@pxref{Overlay Properties,,, elisp, The Emacs Lisp Reference |
| 301 | Manual}). | ||
| 310 | 302 | ||
| 311 | @item | 303 | As an example, here's how to make diagnostics of the type @code{:note} |
| 312 | Every property pertaining to overlays (@pxref{Overlay Properties,,, | 304 | stand out more prominently: |
| 313 | elisp, The Emacs Lisp Reference Manual}), except @code{category} and | ||
| 314 | @code{evaporate}. These properties are used to affect the appearance | ||
| 315 | of Flymake annotations. | ||
| 316 | 305 | ||
| 317 | As an example, here's how to make errors (diagnostics of the type | 306 | @example |
| 318 | @code{:error}) stand out even more prominently in the buffer, by | 307 | (push '(face . highlight) (get :note 'flymake-overlay-control)) |
| 319 | raising the characters using a @code{display} overlay property. | 308 | @end example |
| 309 | |||
| 310 | If you push another alist entry in front, it overrides the previous | ||
| 311 | one. So this effectively removes the face from @code{:note} | ||
| 312 | diagnostics: | ||
| 320 | 313 | ||
| 321 | @example | 314 | @example |
| 322 | (push '(display . (raise 1.2)) | 315 | (push '(face . nil) (get :note 'flymake-overlay-control)) |
| 323 | (cdr (assoc :error flymake-diagnostic-types-alist))) | ||
| 324 | @end example | 316 | @end example |
| 325 | 317 | ||
| 318 | To restore the original look for @code{:note} types, empty or remove | ||
| 319 | its @code{flymake-overlay-control} property: | ||
| 320 | |||
| 321 | @example | ||
| 322 | (put :note 'flymake-overlay-control '()) | ||
| 323 | @end example | ||
| 324 | |||
| 325 | @item | ||
| 326 | @cindex severity of diagnostic | ||
| 327 | @code{flymake-severity} is a non-negative integer specifying the | ||
| 328 | diagnostic's severity. The higher the value, the more serious is the | ||
| 329 | error. If the overlay property @code{priority} is not specified in | ||
| 330 | @code{flymake-overlay-control}, @code{flymake-severity} is used to set | ||
| 331 | it and help sort overlapping overlays. | ||
| 332 | |||
| 326 | @item | 333 | @item |
| 327 | @vindex flymake-category | 334 | @vindex flymake-category |
| 328 | @code{flymake-category} is a symbol whose property list is considered | 335 | @code{flymake-category} is a symbol whose property list is considered |
| @@ -333,32 +340,29 @@ the default for missing values of any other properties. | |||
| 333 | @vindex flymake-error | 340 | @vindex flymake-error |
| 334 | @vindex flymake-warning | 341 | @vindex flymake-warning |
| 335 | @vindex flymake-note | 342 | @vindex flymake-note |
| 336 | Three default diagnostic types, @code{:error}, @code{:warning} and | 343 | Three default diagnostic types are predefined: @code{:error}, |
| 337 | @code{:note} are predefined in | 344 | @code{:warning}, and @code{:note}. By default, each one of them has a |
| 338 | @code{flymake-diagnostic-types-alist}. By default each lists a single | ||
| 339 | @code{flymake-category} property whose value is, respectively, the | 345 | @code{flymake-category} property whose value is, respectively, the |
| 340 | symbols @code{flymake-error}, @code{flymake-warning} and | 346 | category symbol @code{flymake-error}, @code{flymake-warning} and |
| 341 | @code{flymake-note}. | 347 | @code{flymake-note}. |
| 342 | 348 | ||
| 343 | These category symbols' plists is where the values of customizable | 349 | These category symbols' plist is where the values of customizable |
| 344 | variables and faces such as @code{flymake-error-bitmap} are found. | 350 | variables and faces (such as @code{flymake-error-bitmap}) are found. |
| 345 | Thus, if you change their plists, Flymake may stop honoring these | 351 | Thus, if you change their plists, Flymake may stop honoring these user |
| 346 | user customizations. | 352 | customizations. |
| 347 | 353 | ||
| 348 | The @code{flymake-category} special property is also especially useful | 354 | The @code{flymake-category} special property is especially useful for |
| 349 | for backends which create diagnostics objects with non-default | 355 | backends which create diagnostics objects with non-default types that |
| 350 | types that differ from an existing type by only a few properties | 356 | differ from an existing type by only a few properties (@pxref{Flymake |
| 351 | (@pxref{Flymake utility functions}). | 357 | utility functions}). |
| 352 | 358 | ||
| 353 | As an example, consider configuring a new diagnostic type | 359 | As an example, consider configuring a new diagnostic type |
| 354 | @code{:low-priority-note} that behaves much like the @code{:note} | 360 | @code{:low-priority-note} that behaves much like @code{:note}, but |
| 355 | priority but without an overlay face. | 361 | without an overlay face. |
| 356 | 362 | ||
| 357 | @example | 363 | @example |
| 358 | (add-to-list | 364 | (put :low-priority-note 'flymake-overlay-control '((face . nil))) |
| 359 | 'flymake-diagnostic-types-alist | 365 | (put :low-priority-note 'flymake-category 'flymake-note) |
| 360 | `(:low-priority-note . ((face . nil) | ||
| 361 | (flymake-category . flymake-note)))) | ||
| 362 | @end example | 366 | @end example |
| 363 | 367 | ||
| 364 | @vindex flymake-diagnostics | 368 | @vindex flymake-diagnostics |
| @@ -389,20 +393,17 @@ Internet search for the text of a @code{:warning} or @code{:error}. | |||
| 389 | (eww-browse-url | 393 | (eww-browse-url |
| 390 | (concat | 394 | (concat |
| 391 | "https://duckduckgo.com/?q=" | 395 | "https://duckduckgo.com/?q=" |
| 392 | (replace-regexp-in-string " " | 396 | (replace-regexp-in-string |
| 393 | "+" | 397 | " " "+" (flymake-diagnostic-text topmost-diag))) |
| 394 | (flymake-diagnostic-text topmost-diag))) | ||
| 395 | t))) | 398 | t))) |
| 396 | 399 | ||
| 397 | (dolist (type '(:warning :error)) | 400 | (dolist (type '(:warning :error)) |
| 398 | (let ((a (assoc type flymake-diagnostic-types-alist))) | 401 | (push '(mouse-face . highlight) (get type 'flymake-overlay-control)) |
| 399 | (setf (cdr a) | 402 | (push `(keymap . ,(let ((map (make-sparse-keymap))) |
| 400 | (append `((mouse-face . highlight) | 403 | (define-key map [mouse-2] |
| 401 | (keymap . ,(let ((map (make-sparse-keymap))) | 404 | 'my-search-for-message) |
| 402 | (define-key map [mouse-2] | 405 | map)) |
| 403 | 'my-search-for-message) | 406 | (get type 'flymake-overlay-control))) |
| 404 | map))) | ||
| 405 | (cdr a))))) | ||
| 406 | @end example | 407 | @end example |
| 407 | 408 | ||
| 408 | @node Backend functions | 409 | @node Backend functions |
| @@ -436,10 +437,10 @@ the first argument is always @var{report-fn}, a callback function | |||
| 436 | detailed below; | 437 | detailed below; |
| 437 | 438 | ||
| 438 | @item | 439 | @item |
| 439 | the remaining arguments are keyword-value pairs of the | 440 | the remaining arguments are keyword-value pairs of the form |
| 440 | form @w{@code{(@var{:key} @var{value} @var{:key2} @var{value2}...)}}. Currently, | 441 | @w{@code{(@var{:key} @var{value} @var{:key2} @var{value2}...)}}. |
| 441 | Flymake provides no such arguments, but backend functions must be | 442 | Currently, Flymake provides no such arguments, but backend functions |
| 442 | prepared to accept (and possibly ignore) any number of them. | 443 | must be prepared to accept (and possibly ignore) any number of them. |
| 443 | @end itemize | 444 | @end itemize |
| 444 | 445 | ||
| 445 | Whenever Flymake or the user decide to re-check the buffer, backend | 446 | Whenever Flymake or the user decide to re-check the buffer, backend |
| @@ -512,9 +513,9 @@ by calling the function @code{flymake-make-diagnostic}. | |||
| 512 | 513 | ||
| 513 | @deffn Function flymake-make-diagnostic buffer beg end type text | 514 | @deffn Function flymake-make-diagnostic buffer beg end type text |
| 514 | Make a Flymake diagnostic for @var{buffer}'s region from @var{beg} to | 515 | Make a Flymake diagnostic for @var{buffer}'s region from @var{beg} to |
| 515 | @var{end}. @var{type} is a key to | 516 | @var{end}. @var{type} is a diagnostic symbol (@pxref{Flymake error |
| 516 | @code{flymake-diagnostic-types-alist} and @var{text} is a description | 517 | types}), and @var{text} is a description of the problem detected in |
| 517 | of the problem detected in this region. | 518 | this region. |
| 518 | @end deffn | 519 | @end deffn |
| 519 | 520 | ||
| 520 | @cindex access diagnostic object | 521 | @cindex access diagnostic object |
| @@ -715,14 +716,13 @@ Patterns for error/warning messages in the form @code{(regexp file-idx | |||
| 715 | line-idx col-idx err-text-idx)}. @xref{Parsing the output}. | 716 | line-idx col-idx err-text-idx)}. @xref{Parsing the output}. |
| 716 | 717 | ||
| 717 | @item flymake-proc-diagnostic-type-pred | 718 | @item flymake-proc-diagnostic-type-pred |
| 718 | A function to classify a diagnostic text as particular type of | 719 | A function to classify a diagnostic text as particular type of error. |
| 719 | error. Should be a function taking an error text and returning one of | 720 | Should be a function taking an error text and returning a diagnostic |
| 720 | the symbols indexing @code{flymake-diagnostic-types-alist}. If non-nil | 721 | symbol (@pxref{Flymake error types}). If non-nil is returned but |
| 721 | is returned but there is no such symbol in that table, a warning is | 722 | there is no such symbol in that table, a warning is assumed. If nil |
| 722 | assumed. If nil is returned, an error is assumed. Can also be a | 723 | is returned, an error is assumed. Can also be a regular expression |
| 723 | regular expression that should match only warnings. This variable | 724 | that should match only warnings. This variable replaces the old |
| 724 | replaces the old @code{flymake-warning-re} and | 725 | @code{flymake-warning-re} and @code{flymake-warning-predicate}. |
| 725 | @code{flymake-warning-predicate}. | ||
| 726 | 726 | ||
| 727 | @item flymake-proc-compilation-prevents-syntax-check | 727 | @item flymake-proc-compilation-prevents-syntax-check |
| 728 | A flag indicating whether compilation and syntax check of the same | 728 | A flag indicating whether compilation and syntax check of the same |