bug#81514: 32.0.50; Eglot messages progress reporter shows errors

João Távora <[email protected]> Sun, 02 Aug 2026 14:27:40 +0100
Newsgroups gmane.emacs.bugs
Message-ID <[email protected]>
"Jacek =C5=9Awierk" <[email protected]> writes:

> I checked out the latest patch, but there are still some issues.
> ...
> rust-analyzer, at least, sends many progress notifications without a
> percentage, for both `begin` and `report` events. As a result, both the
> current `master` and `emacs-31` branches signal numerous errors.

Can you try this patch?  It also includes the "cleanup progress
reporters on server death".

diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el
index 0f0791d37ab..b27d7761111 100644
--- a/lisp/progmodes/eglot.el
+++ b/lisp/progmodes/eglot.el
@@ -1491,6 +1491,11 @@ eglot--on-shutdown
          (lambda (x) (eq server
                          (get-text-property 0 'eglot--server (car x))))
          flymake-list-only-diagnostics))
+  ;; Cleanup progress reporters
+  (maphash (lambda (_ r)
+             (unless (eq (car r) 'eglot--mode-line-reporter )
+               (progress-reporter-done r)))
+           (eglot--progress-reporters server))
   (cond ((eglot--shutdown-requested server)
          t)
         ((not (eglot--inhibit-autoreconnect server))
@@ -2888,10 +2893,10 @@ eglot-handle-notification
       (eglot--dbind ((WorkDoneProgress) kind title percentage message) val=
ue
         (pcase kind
           ("begin"
-           (upd percentage (fmt title message)
+           (upd (or percentage 0) (fmt title message)
                 (puthash token (mkpr title)
                          (eglot--progress-reporters server))))
-          ("report" (upd percentage message))
+          ("report" (upd (or percentage 0) message))
           ("end" (upd (or percentage 100) message)
            (run-at-time 2 nil
                         (lambda ()

> Perhaps a separate, non-numeric progress reporter could be introduced
> for progress without a percentage.

Maybe some day in the future, not for Emacs 31, and not driven by a
backward incompatible Lisp change in the progress reports.

>  Alternatively, if supporting this is too complicated for older Emacs
> versions, such notifications could simply be ignored.

Indeed, I think that's what the previous progress reporter code did.

Jo=C3=A3o