Commit adb5f45d authored by João Távora's avatar João Távora

Allow flymake diagnostic types to have shorter names

Eglot, a third-party package which uses Flymake, has its own
diagnostic types such as 'eglot-error', 'eglot-warning', etc...  While
not being too long, they will not fit in the type column of the "list
all diagnostics" buffer.  This commit allows diagnostic types to have
user-defined names and also assigns names to the default categories.

* doc/misc/flymake.texi (Flymake error types): Describe
flymake-type-name prop.

* lisp/progmodes/flymake.el (flymake--diagnostics-buffer-entries):
Use type names.
(flymake-error, flymake-warning, flymake-note): Give these
diagnostic categories default type names.
parent 455e753a
Pipeline #3912 failed with stage
in 78 minutes and 16 seconds
......@@ -336,6 +336,11 @@ error. If the overlay property @code{priority} is not specified in
@code{flymake-overlay-control}, @code{flymake-severity} is used to set
it and help sort overlapping overlays.
@vindex flymake-type-name
@code{flymake-type-name} is a string used to succinctly name the error
type, in case the name of the symbol associated with it is very long.
@vindex flymake-category
@code{flymake-category} is a symbol whose property list is considered
......@@ -553,16 +553,19 @@ Node `(Flymake)Flymake error types'"
(put 'flymake-error 'flymake-bitmap 'flymake-error-bitmap)
(put 'flymake-error 'severity (warning-numeric-level :error))
(put 'flymake-error 'mode-line-face 'compilation-error)
(put 'flymake-error 'flymake-type-name "error")
(put 'flymake-warning 'face 'flymake-warning)
(put 'flymake-warning 'flymake-bitmap 'flymake-warning-bitmap)
(put 'flymake-warning 'severity (warning-numeric-level :warning))
(put 'flymake-warning 'mode-line-face 'compilation-warning)
(put 'flymake-warning 'flymake-type-name "warning")
(put 'flymake-note 'face 'flymake-note)
(put 'flymake-note 'flymake-bitmap 'flymake-note-bitmap)
(put 'flymake-note 'severity (warning-numeric-level :debug))
(put 'flymake-note 'mode-line-face 'compilation-info)
(put 'flymake-note 'flymake-type-name "note")
(defun flymake--lookup-type-property (type prop &optional default)
"Look up PROP for diagnostic TYPE.
......@@ -1336,7 +1339,9 @@ POS can be a buffer position or a button"
'severity (warning-numeric-level :error)))
`[,(format "%s" line)
,(format "%s" col)
,(propertize (format "%s" type)
,(propertize (format "%s"
type 'flymake-type-name type))
'face (flymake--lookup-type-property
type 'mode-line-face 'flymake-error))
(,(format "%s" (flymake--diag-text diag))
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment