From bfc00f1c12047ff431eaa9da3a744807c3f9e6e2 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jo=C3=A3o=20T=C3=A1vora?= Date: Wed, 7 Dec 2022 11:30:34 +0000 Subject: [PATCH] Eglot: fix setting of flymake-list-only-diagnostics (bug#59824) When Eglot receives diagnostics for a file not yet visited in Emacs, it stores them in flymake-list-only-diagnostics, which feed M-x flymake-show-project-diagnostics. If the file is eventually visited in a buffer and Eglot starts receibing diagnostics for it, the flymake-list-only-diagnostics database has to be updated accordingly, since the previous diagnostics are now stale. * lisp/progmodes/eglot.el (eglot-handle-notification): Reset flymake-list-only-diagnostics --- lisp/progmodes/eglot.el | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el index c266f6e18a3..363ca004e47 100644 --- a/lisp/progmodes/eglot.el +++ b/lisp/progmodes/eglot.el @@ -2060,9 +2060,11 @@ COMMAND is a symbol naming the command." (t 'eglot-note))) (mess (source code message) (concat source (and code (format " [%s]" code)) ": " message))) - (if-let ((buffer (find-buffer-visiting (eglot--uri-to-path uri)))) + (if-let* ((path (expand-file-name (eglot--uri-to-path uri))) + (buffer (find-buffer-visiting path))) (with-current-buffer buffer (cl-loop + initially (assoc-delete-all path flymake-list-only-diagnostics #'string=) for diag-spec across diagnostics collect (eglot--dbind ((Diagnostic) range code message severity source tags) diag-spec @@ -2105,7 +2107,6 @@ COMMAND is a symbol naming the command." (t (setq eglot--diagnostics diags))))) (cl-loop - with path = (expand-file-name (eglot--uri-to-path uri)) for diag-spec across diagnostics collect (eglot--dbind ((Diagnostic) code range message severity source) diag-spec (setq message (mess source code message)) -- 2.39.2