From 0e6635fdb9ad34dea0540c121c8b981a4fc14832 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jo=C3=A3o=20T=C3=A1vora?= Date: Mon, 29 Oct 2018 11:41:04 +0000 Subject: [PATCH] Fix Flymake's diagnostic count with custom error types Fixes: bug#33187 * lisp/progmodes/flymake.el (flymake--mode-line-format): Replace cl-union with iterative cl-pushnew. --- lisp/progmodes/flymake.el | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/lisp/progmodes/flymake.el b/lisp/progmodes/flymake.el index 5831301a57c..f0f93f10878 100644 --- a/lisp/progmodes/flymake.el +++ b/lisp/progmodes/flymake.el @@ -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 -- 2.39.5