aboutsummaryrefslogtreecommitdiffstats
path: root/doc/misc
diff options
context:
space:
mode:
authorJoão Távora2018-06-05 15:13:02 +0100
committerJoão Távora2018-06-05 15:22:16 +0100
commitfa794d1b603e52e2a80d69c5610b782904ee6a69 (patch)
treee6dbf1d0ac1460488235e7785bf392caf472404c /doc/misc
parentaadac04923c9ae47f0bccc706857b94166c9d355 (diff)
downloademacs-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.texi150
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 278To customize the appearance of error types, set properties on the
279The variable @code{flymake-diagnostic-types-alist} is looked up by 279symbols associated with each diagnostic type. The standard diagnostic
280Flymake every time an annotation for a diagnostic is created in the 280symbols are @code{:error}, @code{:warning} and @code{:note} (though
281buffer. Specifically, this variable holds a table of correspondence 281the backend may define more, @pxref{Backend functions}).
282between symbols designating diagnostic types and an additional 282
283sub-table of properties pertaining to each diagnostic type. 283The following properties can be set:
284
285Both tables are laid out in association list (@pxref{Association
286Lists,,, elisp, The Emacs Lisp Reference Manual}) format, and thus can
287be conveniently accessed with the functions of the @code{assoc}
288family.
289
290You can use any symbol-value association in the properties sub-table,
291but some symbols have special meaning as to where and how Flymake
292presents 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
300the syntax of @code{flymake-error-bitmap} (@pxref{Customizable 291the syntax of @code{flymake-error-bitmap} (@pxref{Customizable
301variables}). It is overridden by any @code{before-string} overlay 292variables}). It is overridden by any @code{before-string} overlay
302property. 293property.
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
307severity. The higher the value, the more serious is the error. If 298Flymake annotations. With the exception of @code{category} and
308the overlay property @code{priority} is not specified, @code{severity} 299@code{evaporate}, these properties are applied directly to the created
309is used to set it and help sort overlapping overlays. 300overlay (@pxref{Overlay Properties,,, elisp, The Emacs Lisp Reference
301Manual}).
310 302
311@item 303As an example, here's how to make diagnostics of the type @code{:note}
312Every property pertaining to overlays (@pxref{Overlay Properties,,, 304stand out more prominently:
313elisp, The Emacs Lisp Reference Manual}), except @code{category} and
314@code{evaporate}. These properties are used to affect the appearance
315of Flymake annotations.
316 305
317As 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))
319raising the characters using a @code{display} overlay property. 308@end example
309
310If you push another alist entry in front, it overrides the previous
311one. So this effectively removes the face from @code{:note}
312diagnostics:
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
318To restore the original look for @code{:note} types, empty or remove
319its @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
328diagnostic's severity. The higher the value, the more serious is the
329error. If the overlay property @code{priority} is not specified in
330@code{flymake-overlay-control}, @code{flymake-severity} is used to set
331it 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
336Three default diagnostic types, @code{:error}, @code{:warning} and 343Three 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
340symbols @code{flymake-error}, @code{flymake-warning} and 346category symbol @code{flymake-error}, @code{flymake-warning} and
341@code{flymake-note}. 347@code{flymake-note}.
342 348
343These category symbols' plists is where the values of customizable 349These category symbols' plist is where the values of customizable
344variables and faces such as @code{flymake-error-bitmap} are found. 350variables and faces (such as @code{flymake-error-bitmap}) are found.
345Thus, if you change their plists, Flymake may stop honoring these 351Thus, if you change their plists, Flymake may stop honoring these user
346user customizations. 352customizations.
347 353
348The @code{flymake-category} special property is also especially useful 354The @code{flymake-category} special property is especially useful for
349for backends which create diagnostics objects with non-default 355backends which create diagnostics objects with non-default types that
350types that differ from an existing type by only a few properties 356differ from an existing type by only a few properties (@pxref{Flymake
351(@pxref{Flymake utility functions}). 357utility functions}).
352 358
353As an example, consider configuring a new diagnostic type 359As 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
355priority but without an overlay face. 361without 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
436detailed below; 437detailed below;
437 438
438@item 439@item
439the remaining arguments are keyword-value pairs of the 440the remaining arguments are keyword-value pairs of the form
440form @w{@code{(@var{:key} @var{value} @var{:key2} @var{value2}...)}}. Currently, 441@w{@code{(@var{:key} @var{value} @var{:key2} @var{value2}...)}}.
441Flymake provides no such arguments, but backend functions must be 442Currently, Flymake provides no such arguments, but backend functions
442prepared to accept (and possibly ignore) any number of them. 443must be prepared to accept (and possibly ignore) any number of them.
443@end itemize 444@end itemize
444 445
445Whenever Flymake or the user decide to re-check the buffer, backend 446Whenever 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
514Make a Flymake diagnostic for @var{buffer}'s region from @var{beg} to 515Make 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 517types}), and @var{text} is a description of the problem detected in
517of the problem detected in this region. 518this 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
715line-idx col-idx err-text-idx)}. @xref{Parsing the output}. 716line-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
718A function to classify a diagnostic text as particular type of 719A function to classify a diagnostic text as particular type of error.
719error. Should be a function taking an error text and returning one of 720Should be a function taking an error text and returning a diagnostic
720the symbols indexing @code{flymake-diagnostic-types-alist}. If non-nil 721symbol (@pxref{Flymake error types}). If non-nil is returned but
721is returned but there is no such symbol in that table, a warning is 722there is no such symbol in that table, a warning is assumed. If nil
722assumed. If nil is returned, an error is assumed. Can also be a 723is returned, an error is assumed. Can also be a regular expression
723regular expression that should match only warnings. This variable 724that should match only warnings. This variable replaces the old
724replaces 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
728A flag indicating whether compilation and syntax check of the same 728A flag indicating whether compilation and syntax check of the same