flymake-diagnostic-types-alist is looked up by
Flymake every time an annotation for a diagnostic is created in the
buffer. Specifically, this variable holds a table of correspondence
between symbols designating diagnostic types and an additional
sub-table of properties pertaining to each diagnostic type.
Both tables are laid out in association list (see Association Lists) format, and thus can
be conveniently accessed with the functions of the
You can use any symbol-value association in the properties sub-table, but some symbols have special meaning as to where and how Flymake presents the diagnostic:
bitmap, an image displayed in the fringe according to
flymake-fringe-indicator-position. The value actually follows the syntax of
flymake-error-bitmap(see Customizable variables). It is overridden by any
severityis a non-negative integer specifying the diagnostic's severity. The higher the value, the more serious is the error. If the overlay property
priorityis not specified,
severityis used to set it and help sort overlapping overlays.
evaporate. These properties are used to affect the appearance of Flymake annotations.
As an example, here's how to make errors (diagnostics of the type
:error) stand out even more prominently in the buffer, by
raising the characters using a
display overlay property.
(push '(display . (raise 1.2)) (cdr (assoc :error flymake-diagnostic-types-alist)))
flymake-categoryis a symbol whose property list is considered the default for missing values of any other properties.
Three default diagnostic types,
:note are predefined in
flymake-diagnostic-types-alist. By default each lists a single
flymake-category property whose value is, respectively, the
These category symbols' plists is where the values of customizable
variables and faces such as
flymake-error-bitmap are found.
Thus, if you change their plists, Flymake may stop honoring these
flymake-category special property is also especially useful
for backends which create diagnostics objects with non-default
types that differ from an existing type by only a few properties
(see Flymake utility functions).
As an example, consider configuring a new diagnostic type
:low-priority-note that behaves much like the
priority but without an overlay face.
(add-to-list 'flymake-diagnostic-types-alist `(:low-priority-note . ((face . nil) (flymake-category . flymake-note))))
As you might have guessed, Flymake's annotations are implemented as
overlays (see Overlays).
Along with the properties that you specify for the specific type of
diagnostic, Flymake adds the property
these overlays, and sets it to the object that the backend created
Since overlays also support arbitrary keymaps, you can use this along
with the functions
flymake-diagnostic-text (see Flymake utility functions) to
create interactive annotations, such as in the following example of
mouse-3 event (middle mouse button click) to an
Internet search for the text of a
(defun my-search-for-message (event) (interactive "e") (let* ((diags (flymake-diagnostics (posn-point (event-start event)))) (topmost-diag (car diags))) (eww-browse-url (concat "https://duckduckgo.com/?q=" (replace-regexp-in-string " " "+" (flymake-diagnostic-text topmost-diag))) t))) (dolist (type '(:warning :error)) (let ((a (assoc type flymake-diagnostic-types-alist))) (setf (cdr a) (append `((mouse-face . highlight) (keymap . ,(let ((map (make-sparse-keymap))) (define-key map [mouse-2] 'my-search-for-message) map))) (cdr a)))))