diff options
| author | João Távora | 2019-11-02 16:38:53 +0000 |
|---|---|---|
| committer | João Távora | 2019-11-02 16:38:53 +0000 |
| commit | adb5f45d7bc4612916a5b8e4bd2b92d49119b57a (patch) | |
| tree | 7a4f87c4e8023ad8765734d4a2fcab6bff8fe680 | |
| parent | 455e753a2b8fa2e83d23be1771f3371ba90b85f9 (diff) | |
| download | emacs-adb5f45d7bc4612916a5b8e4bd2b92d49119b57a.tar.gz emacs-adb5f45d7bc4612916a5b8e4bd2b92d49119b57a.zip | |
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.
| -rw-r--r-- | doc/misc/flymake.texi | 5 | ||||
| -rw-r--r-- | lisp/progmodes/flymake.el | 7 |
2 files changed, 11 insertions, 1 deletions
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 | |||
| @@ -337,6 +337,11 @@ error. If the overlay property @code{priority} is not specified in | |||
| 337 | it and help sort overlapping overlays. | 337 | it and help sort overlapping overlays. |
| 338 | 338 | ||
| 339 | @item | 339 | @item |
| 340 | @vindex flymake-type-name | ||
| 341 | @code{flymake-type-name} is a string used to succinctly name the error | ||
| 342 | type, in case the name of the symbol associated with it is very long. | ||
| 343 | |||
| 344 | @item | ||
| 340 | @vindex flymake-category | 345 | @vindex flymake-category |
| 341 | @code{flymake-category} is a symbol whose property list is considered | 346 | @code{flymake-category} is a symbol whose property list is considered |
| 342 | the default for missing values of any other properties. | 347 | the default for missing values of any other properties. |
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'" | |||
| 553 | (put 'flymake-error 'flymake-bitmap 'flymake-error-bitmap) | 553 | (put 'flymake-error 'flymake-bitmap 'flymake-error-bitmap) |
| 554 | (put 'flymake-error 'severity (warning-numeric-level :error)) | 554 | (put 'flymake-error 'severity (warning-numeric-level :error)) |
| 555 | (put 'flymake-error 'mode-line-face 'compilation-error) | 555 | (put 'flymake-error 'mode-line-face 'compilation-error) |
| 556 | (put 'flymake-error 'flymake-type-name "error") | ||
| 556 | 557 | ||
| 557 | (put 'flymake-warning 'face 'flymake-warning) | 558 | (put 'flymake-warning 'face 'flymake-warning) |
| 558 | (put 'flymake-warning 'flymake-bitmap 'flymake-warning-bitmap) | 559 | (put 'flymake-warning 'flymake-bitmap 'flymake-warning-bitmap) |
| 559 | (put 'flymake-warning 'severity (warning-numeric-level :warning)) | 560 | (put 'flymake-warning 'severity (warning-numeric-level :warning)) |
| 560 | (put 'flymake-warning 'mode-line-face 'compilation-warning) | 561 | (put 'flymake-warning 'mode-line-face 'compilation-warning) |
| 562 | (put 'flymake-warning 'flymake-type-name "warning") | ||
| 561 | 563 | ||
| 562 | (put 'flymake-note 'face 'flymake-note) | 564 | (put 'flymake-note 'face 'flymake-note) |
| 563 | (put 'flymake-note 'flymake-bitmap 'flymake-note-bitmap) | 565 | (put 'flymake-note 'flymake-bitmap 'flymake-note-bitmap) |
| 564 | (put 'flymake-note 'severity (warning-numeric-level :debug)) | 566 | (put 'flymake-note 'severity (warning-numeric-level :debug)) |
| 565 | (put 'flymake-note 'mode-line-face 'compilation-info) | 567 | (put 'flymake-note 'mode-line-face 'compilation-info) |
| 568 | (put 'flymake-note 'flymake-type-name "note") | ||
| 566 | 569 | ||
| 567 | (defun flymake--lookup-type-property (type prop &optional default) | 570 | (defun flymake--lookup-type-property (type prop &optional default) |
| 568 | "Look up PROP for diagnostic TYPE. | 571 | "Look up PROP for diagnostic TYPE. |
| @@ -1336,7 +1339,9 @@ POS can be a buffer position or a button" | |||
| 1336 | 'severity (warning-numeric-level :error))) | 1339 | 'severity (warning-numeric-level :error))) |
| 1337 | `[,(format "%s" line) | 1340 | `[,(format "%s" line) |
| 1338 | ,(format "%s" col) | 1341 | ,(format "%s" col) |
| 1339 | ,(propertize (format "%s" type) | 1342 | ,(propertize (format "%s" |
| 1343 | (flymake--lookup-type-property | ||
| 1344 | type 'flymake-type-name type)) | ||
| 1340 | 'face (flymake--lookup-type-property | 1345 | 'face (flymake--lookup-type-property |
| 1341 | type 'mode-line-face 'flymake-error)) | 1346 | type 'mode-line-face 'flymake-error)) |
| 1342 | (,(format "%s" (flymake--diag-text diag)) | 1347 | (,(format "%s" (flymake--diag-text diag)) |