]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix Flymake's diagnostic count with custom error types
authorJoão Távora <joaotavora@gmail.com>
Mon, 29 Oct 2018 11:41:04 +0000 (11:41 +0000)
committerJoão Távora <joaotavora@gmail.com>
Mon, 29 Oct 2018 11:46:11 +0000 (11:46 +0000)
Fixes: bug#33187
* lisp/progmodes/flymake.el (flymake--mode-line-format): Replace
cl-union with iterative cl-pushnew.

lisp/progmodes/flymake.el

index 5831301a57c54f57d7c718cdb5496804fd1740f7..f0f93f108785673b5847927df5e0c219afa253c6 100644 (file)
@@ -1183,20 +1183,17 @@ default) no filter is applied."
       ,@(unless (or all-disabled
                     (null known))
           (cl-loop
-           for (type . severity)
-           in (cl-sort (mapcar (lambda (type)
-                                 (cons type (flymake--severity type)))
-                               (cl-union (hash-table-keys diags-by-type)
-                                         '(:error :warning)
-                                         :key #'flymake--severity))
-                       #'>
-                       :key #'cdr)
+           with types = (hash-table-keys diags-by-type)
+           with _augmented = (cl-loop for extra in '(:error :warning)
+                                      do (cl-pushnew extra types
+                                                     :key #'flymake--severity))
+           for type in (cl-sort types #'> :key #'flymake--severity)
            for diags = (gethash type diags-by-type)
            for face = (flymake--lookup-type-property type
                                                      'mode-line-face
                                                      'compilation-error)
-           when (or diags
-                    (>= severity (warning-numeric-level :warning)))
+           when (or diags (>= (flymake--severity type)
+                              (warning-numeric-level :warning)))
            collect `(:propertize
                      ,(format "%d" (length diags))
                      face ,face