emacs-31 d828a19fdc0: Eglot: fix use of progress reporters again (bug#81514)

João Távora <[email protected]> Sun, 2 Aug 2026 15:15:06 -0400 (EDT)
Newsgroups gmane.emacs.diffs
Message-ID <[email protected]>
branch: emacs-31
commit d828a19fdc064b4fa324779143d78fbff9a9a7b2
Author: João Távora <[email protected]>
Commit: João Távora <[email protected]>

    Eglot: fix use of progress reporters again (bug#81514)
    
    There were still some cases of errors reported with the new stricter
    progress reporters.
    
    * lisp/progmodes/eglot.el (eglot--on-shutdown): Cleanup with
    progress-reporter-done.
    (eglot-handle-notification): Always pass percentage to
    progress-reporter-update.
---
 lisp/progmodes/eglot.el | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

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 @@ PRESERVE-BUFFERS as in `eglot-shutdown', which see."
          (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 @@ return it back to the server.  :null is returned if the list was empty."
       (eglot--dbind ((WorkDoneProgress) kind title percentage message) value
         (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 ()