Subject: Re: flymake-show-project-diagnotics not updating (eglot for Java with jdtls)

From: João Távora <[email-masked]>
Date: Sun, 04 Dec 2022 21:03:12 +0000

David Ventimiglia <[email-masked]> writes:

> I grant that this may not be a bug and could be a mis-configuration,
> but I am trying to track that down.  Thanks!

I may have found the possibly culprit in Eglot.  I wish you could try
the patch after my sig, untested by me.  Also, if you find that the
project listing still doesn't update automatically, please go to its
buffer and type 'g' (and report back here that you needed this extra
step).

João

diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el
index e057b12e0ee..3d0e97bba8c 100644
--- a/lisp/progmodes/eglot.el
+++ b/lisp/progmodes/eglot.el
@@ -2048,9 +2048,11 @@ eglot-handle-notification
                     (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
@@ -2093,7 +2095,6 @@ eglot-handle-notification
                          (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))