emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] master aadac04 3/4: Correctly filter Flymake diagnostic ty


From: João Távora
Subject: [Emacs-diffs] master aadac04 3/4: Correctly filter Flymake diagnostic types shown in mode-line
Date: Tue, 5 Jun 2018 10:22:51 -0400 (EDT)

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

    Correctly filter Flymake diagnostic types shown in mode-line
    
    Thus, if a package foo has its own types foo-error and
    foo-warning, and if the buffer has no errors, the mode-line
    will correctly show `[0 0]' (zero errors and warnings) instead
    of `[0 0 0 0]' (zero errors, zero foo-errors, zero warnings,
    zero  foo-warnings).
    
    * lisp/progmodes/flymake.el
    (flymake--mode-line-format): Coalesce diagnostic types based on
    the severity, not the symbol.
---
 lisp/progmodes/flymake.el | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/lisp/progmodes/flymake.el b/lisp/progmodes/flymake.el
index 35d5672..ec933ad 100644
--- a/lisp/progmodes/flymake.el
+++ b/lisp/progmodes/flymake.el
@@ -1068,14 +1068,17 @@ applied."
       ,@(unless (or all-disabled
                     (null known))
           (cl-loop
+           with get-severity = (lambda (type)
+                                 (flymake--lookup-type-property
+                                  type
+                                  'severity
+                                  (warning-numeric-level :error)))
            for (type . severity)
            in (cl-sort (mapcar (lambda (type)
-                                 (cons type (flymake--lookup-type-property
-                                             type
-                                             'severity
-                                             (warning-numeric-level :error))))
+                                 (cons type (funcall get-severity type)))
                                (cl-union (hash-table-keys diags-by-type)
-                                         '(:error :warning)))
+                                         '(:error :warning)
+                                         :key get-severity))
                        #'>
                        :key #'cdr)
            for diags = (gethash type diags-by-type)



reply via email to

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