]> git.eshelyaron.com Git - emacs.git/commitdiff
Allow flymake diagnostic types to have shorter names
authorJoão Távora <joaotavora@gmail.com>
Sat, 2 Nov 2019 16:38:53 +0000 (16:38 +0000)
committerJoão Távora <joaotavora@gmail.com>
Sat, 2 Nov 2019 16:38:53 +0000 (16:38 +0000)
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
lisp/progmodes/flymake.el

index cedf1d84f90da1705d89bef8f1d9237200ac3157..21653b4a6d0b87befa5bd6a959bdf165cb6e7cd8 100644 (file)
@@ -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
index e394096e23e89f66397aa588a07af670bd680c46..f052e002df7d6dc2f71cfb9ed3b20b199ad26533 100644 (file)
@@ -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))