* 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
* bug#33187: 27.0.50; flymake-mode's lighter shows incorrect diagnostic count
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
0 siblings, 1 reply; 3+ messages in thread
From: João Távora @ 2018-10-29 11:52 UTC (permalink / raw)
To: Michał Krzywkowski; +Cc: 33187-done, 33187
Michał Krzywkowski <k.michal@zoho.com> writes:
> After evaluating the sexp below, flymake's lighter shows [0 0]
> diagnostics, despite the fact that a warning is present in the buffer.
Hi Michal,
Thanks for reporting this. It only happens with custom error types, by
the way, which I suppose is the case with Eglot.
> The attached patch fixes this issue.
I've pushed another fix which should simplify the code rather than
complicate it. Please test it when you can.
João
^ permalink raw reply [flat|nested] 3+ messages in thread
* bug#33187: 27.0.50; flymake-mode's lighter shows incorrect diagnostic count
2018-10-29 11:52 ` João Távora
@ 2018-10-29 17:32 ` Michał Krzywkowski
0 siblings, 0 replies; 3+ messages in thread
From: Michał Krzywkowski @ 2018-10-29 17:32 UTC (permalink / raw)
To: João Távora; +Cc: 33187
On 10/29/18 12:52 PM, João Távora wrote:
> I've pushed another fix which should simplify the code rather than
> complicate it. Please test it when you can.
Thanks, that fixed the bug.
^ permalink raw reply [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 public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).