[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master adb5f45: Allow flymake diagnostic types to have shorter names

From: Joo Tvora
Subject: master adb5f45: Allow flymake diagnostic types to have shorter names
Date: Sat, 2 Nov 2019 12:39:08 -0400 (EDT)

branch: master
commit adb5f45d7bc4612916a5b8e4bd2b92d49119b57a
Author: João Távora <address@hidden>
Commit: João Távora <address@hidden>

    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 cedf1d8..21653b4 100644
--- a/doc/misc/flymake.texi
+++ b/doc/misc/flymake.texi
@@ -337,6 +337,11 @@ error.  If the overlay property @code{priority} is not 
specified in
 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
 the default for missing values of any other properties.
diff --git a/lisp/progmodes/flymake.el b/lisp/progmodes/flymake.el
index e394096..f052e00 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))

reply via email to

[Prev in Thread] Current Thread [Next in Thread]