* bug#33187: 27.0.50; flymake-mode's lighter shows incorrect diagnostic count
@ 2018-10-27 12:25 Michał Krzywkowski
2018-10-29 11:52 ` João Távora
0 siblings, 1 reply; 3+ messages in thread
From: Michał Krzywkowski @ 2018-10-27 12:25 UTC (permalink / raw)
To: 33187
[-- Attachment #1: Type: text/plain, Size: 942 bytes --]
After evaluating the sexp below, flymake's lighter shows [0 0]
diagnostics, despite the fact that a warning is present in the buffer.
If you uncomment the comment, flymake correctly shows that there are [1 1] diagnostics.
(with-current-buffer (get-buffer-create "*scratch*")
(erase-buffer)
(insert "aaaaa")
(put 'my-warning 'flymake-category 'flymake-warning)
(put 'my-error 'flymake-category 'flymake-error)
(defun check-buffer (fn &rest)
(with-current-buffer "*scratch*"
(funcall
fn (list
(flymake-make-diagnostic (current-buffer) 1 2 'my-warning "Warning.")
;; (flymake-make-diagnostic (current-buffer) 2 3 'my-error "Error.")
))))
(setq flymake-diagnostic-functions '(check-buffer))
(flymake-mode +1)
(pop-to-buffer (current-buffer)))
The attached patch fixes this issue.
Repository revision: 3e81e9a0e7742197354515f3d3ea55fdb201eb29
[-- Attachment #2: 0001-Fix-Flymake-s-lighter-displaying-incorrect-diagnosti.patch --]
[-- Type: application/octet-stream, Size: 1380 bytes --]
From 590c94d38cf2786093120b4952813e25ed94fb41 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Micha=C5=82=20Krzywkowski?= <k.michal@zoho.com>
Date: Sat, 27 Oct 2018 14:08:11 +0200
Subject: [PATCH] Fix Flymake's lighter displaying incorrect diagnostic count
* lisp/progmodes/flymake.el (flymake--mode-line-format): Lookup
diagnostics by their severity when custom diagnostic types are used.
---
lisp/progmodes/flymake.el | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/lisp/progmodes/flymake.el b/lisp/progmodes/flymake.el
index 5831301a57..6a1cf5628e 100644
--- a/lisp/progmodes/flymake.el
+++ b/lisp/progmodes/flymake.el
@@ -1191,7 +1191,10 @@ flymake--mode-line-format
:key #'flymake--severity))
#'>
:key #'cdr)
- for diags = (gethash type diags-by-type)
+ for diags = (or (gethash type diags-by-type)
+ (cl-loop for k being the hash-keys of diags-by-type
+ when (eq severity (flymake--severity k))
+ return (gethash k diags-by-type)))
for face = (flymake--lookup-type-property type
'mode-line-face
'compilation-error)
--
2.11.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-10-29 17:32 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-10-27 12:25 bug#33187: 27.0.50; flymake-mode's lighter shows incorrect diagnostic count Michał Krzywkowski
2018-10-29 11:52 ` João Távora
2018-10-29 17:32 ` Michał Krzywkowski
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.