From adb5f45d7bc4612916a5b8e4bd2b92d49119b57a Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jo=C3=A3o=20T=C3=A1vora?= Date: Sat, 2 Nov 2019 16:38:53 +0000 Subject: [PATCH] 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. --- doc/misc/flymake.texi | 5 +++++ lisp/progmodes/flymake.el | 7 ++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/doc/misc/flymake.texi b/doc/misc/flymake.texi index cedf1d84f90..21653b4a6d0 100644 --- a/doc/misc/flymake.texi +++ b/doc/misc/flymake.texi @@ -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. +@item +@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. + @item @vindex flymake-category @code{flymake-category} is a symbol whose property list is considered diff --git a/lisp/progmodes/flymake.el b/lisp/progmodes/flymake.el index e394096e23e..f052e002df7 100644 --- a/lisp/progmodes/flymake.el +++ b/lisp/progmodes/flymake.el @@ -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" + (flymake--lookup-type-property + type 'flymake-type-name type)) 'face (flymake--lookup-type-property type 'mode-line-face 'flymake-error)) (,(format "%s" (flymake--diag-text diag)) -- 2.39.5