From f080ea95c3e98b1f911d8ea0ab7b6e5ba3b122b5 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jo=C3=A3o=20T=C3=A1vora?= Date: Wed, 30 Apr 2025 22:44:56 +0100 Subject: [PATCH] Eglot: tweak previous change (clear Flymake 'Wait' state) 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 | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el index 5556dcb9cc6..6f3256977aa 100644 --- a/lisp/progmodes/eglot.el +++ b/lisp/progmodes/eglot.el @@ -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) -- 2.39.5