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

João Távora <[email protected]> Thu, 30 Jul 2026 01:46:16 +0100
Newsgroups gmane.emacs.bugs
Message-ID <[email protected]>
Stéphane Marks <[email protected]> writes:

> On Wed, Jul 29, 2026 at 7:25 PM João Távora <[email protected]> wrote:
>
>  Haven't read it, but see lots of + and only one - which makes me frown. What was so wrong in Eglot's use of this
>  facility, which worked fine afaict until your changes? 
>
> Two issues with it.  First is that the LSP progress messages are percentages growing from 0-100 and the pulsing reporter
> was incorrect for that use.

OK, this is the part you fix by passing 0 and 100 to
make-progress-reporter, right?

> It shows visibly when one uses the Emacs 31 system-taskbar progress reporters that display
> graphical bars representing % completion.

I don't understand this.  What shows visibly?  Is it good or bad that it
shows visibly?  The previous reporter or the fixed one?  And before or
after your changes?  There are four combinations in total

   Your Eglot patch   Your PR patch
1. no                 no
2. no                 yes
3. yes                no
4. yes                yes

I presume 1 was fine (it worked like that for a number of years).  I
also presume that 3 and 4 fine.  I suppose 2 is the error in this bug.

> Second is that those stateful progress bars need to be cleared when
> the progress reporter is considered "done."  So we changed from a
> pulsing reporter to a "numeric" reporter and correctly called
> progress-reporter-done at the end.

You're describing your Eglot patch, which is not pushed, right?

> We amended the Tramp progress reporter similarly recently.

Does this mean you already pushed a similar fix to Tramp?

Anyway, can you try the simpler patch after my sig?  It should create
the reporter with 0-100 and also call 'progress-reporter-done' at the
appropriate time (and be a bit less intrusive).

Finally, can you spare a sentence or two about what the new progress
reporter enables?  Alternatively, point me a relevant NEWS entry?  It
seems that this new framework supports other "outlets" other than
*Messages* and the echo area.  Am I correct?  If so, the docstring of
eglot-report-progress can be amended or even its default value changed
if the new functionality is more appealing.

Jacek, what made you customize the default of eglot-report-progress to
'messages'?  Do you really like many messages in the echo area and
*Messages*?  (if you do, nothing against it, just curious).

João

diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el
index f701a38ab8b..0f0791d37ab 100644
--- a/lisp/progmodes/eglot.el
+++ b/lisp/progmodes/eglot.el
@@ -2872,7 +2872,8 @@ eglot-handle-notification
                 (if (eq eglot-report-progress 'messages)
                     (make-progress-reporter
                      (format "[eglot] %s %s: %s"
-                             (eglot-project-nickname server) token title))
+                             (eglot-project-nickname server) token title)
+                     0 100)
                   (list 'eglot--mode-line-reporter token title)))
               (upd (pcnt msg &optional
                          (pr (gethash token (eglot--progress-reporters server))))
@@ -2880,7 +2881,10 @@ eglot-handle-notification
                   ((eq (car pr) 'eglot--mode-line-reporter)
                    (setcdr (cddr pr) (list msg pcnt))
                    (force-mode-line-update t))
-                  (pr (eglot--reporter-update pr pcnt msg)))))
+                  (pr
+                   (if (eql pcnt 100)
+                       (progress-reporter-done pr)
+                     (eglot--reporter-update pr pcnt msg))))))
       (eglot--dbind ((WorkDoneProgress) kind title percentage message) value
         (pcase kind
           ("begin"