]> git.eshelyaron.com Git - emacs.git/commitdiff
Eglot: tweak previous change (clear Flymake 'Wait' state)
authorJoão Távora <joaotavora@gmail.com>
Wed, 30 Apr 2025 21:44:56 +0000 (22:44 +0100)
committerEshel Yaron <me@eshelyaron.com>
Thu, 1 May 2025 08:32:41 +0000 (10:32 +0200)
When we don't have anything to give to Flymake, we still want to
signal we're alive so the mode-line doesn't show a confusing
'Wait'.

* lisp/progmodes/eglot.el (eglot--report-to-flymake): Clear 'Wait'
state.

(cherry picked from commit dd5ae0f3ba56e762ae1265b0cb0fe9f2a28281ec)

lisp/progmodes/eglot.el

index 5556dcb9cc6edfad6c52320c814a9d459d329496..6f3256977aa637fea4ed8ca9f654a3e0eb15eac4 100644 (file)
@@ -3165,16 +3165,24 @@ may be called multiple times (respecting the protocol of
 
 (defun eglot--report-to-flymake (diags version)
   "Internal helper for `eglot-flymake-backend'."
-  (when (or (null version) (= version eglot--versioned-identifier))
     (save-restriction
       (widen)
-      (funcall eglot--current-flymake-report-fn diags
-               ;; If the buffer hasn't changed since last
-               ;; call to the report function, flymake won't
-               ;; delete old diagnostics.  Using :region
-               ;; keyword forces flymake to delete
-               ;; them (github#159).
-               :region (cons (point-min) (point-max)))))
+      (if (or (null version) (= version eglot--versioned-identifier))
+          (funcall eglot--current-flymake-report-fn diags
+                   ;; If the buffer hasn't changed since last
+                   ;; call to the report function, flymake won't
+                   ;; delete old diagnostics.  Using :region
+                   ;; keyword forces flymake to delete
+                   ;; them (github#159).
+                   :region (cons (point-min) (point-max)))
+        ;; Here, we don't have anything up to date to give Flymake: we
+        ;; just want to keep whatever diagnostics it has annotated in
+        ;; the buffer. However, as a nice-to-have, we still want to
+        ;; signal we're alive and clear a possible "Wait" state.  We
+        ;; hackingly achieve this by reporting an empty list and making
+        ;; sure it pertains to a 0-length region.
+        (funcall eglot--current-flymake-report-fn nil
+                 :region (cons (point-min) (point-min)))))
   (setq eglot--diagnostics (cons diags version)))
 
 (defun eglot-xref-backend () "Eglot xref backend." 'eglot)