GNU bug report logs - #78530
31.0.50; [PATCH] eglot-code-action-suggestion doesn't call the callback function in the original buffer

Previous Next

Package: emacs;

Reported by: Yuan Fu <casouri <at> gmail.com>

Date: Wed, 21 May 2025 07:43:02 UTC

Severity: normal

Tags: patch

Found in version 31.0.50

Full log


View this message in rfc822 format

From: Yuan Fu <casouri <at> gmail.com>
To: João Távora <joaotavora <at> gmail.com>
Cc: 78530 <at> debbugs.gnu.org, Eli Zaretskii <eliz <at> gnu.org>
Subject: bug#78530: 31.0.50; [PATCH] eglot-code-action-suggestion doesn't call the callback function in the original buffer
Date: Mon, 9 Jun 2025 18:30:15 -0700

> On Jun 8, 2025, at 4:19 PM, João Távora <joaotavora <at> gmail.com> wrote:
> 
> On Sat, Jun 7, 2025 at 9:08 AM Eli Zaretskii <eliz <at> gnu.org> wrote:
>> 
>> Ping!  João, any comments or suggestions?
> 
> I think the patch is definitely in the right direction, but it would make
> even more sense if it checked if the "original buffer" is still live by
> the time the lambda is called.  If it's not, probably the callback
> lambda shouldn't get called.  This is why Eglot uses its own macro
> eglot--when-buffer-live.

Ohh yeah, good call.

> 
> And this new "rule" should be encoded in the documentation (docstring
> and/or manual).  No need for lots of text, just a note.

Will do.

> 
> And we should think a little bit if we're breaking backward
> compatibility.  Though I don't think we are: not many ElDoc clients are
> relying on the fact that the buffer the callbacks are run in is somewhat
> arbitrary.

Plus usually the callback _is_ ran in the original buffer, unless the provider of the documentation function does something weird. (In our case, eglot runs the callback in a temp buffer.)

> Finally the patch could come with some changes to Eglot as well, because
> this allows for eglot.el to be simplified.  But be careful: the way to
> do this is to do the eldoc.el change bumping its :core package version,
> and then make the eglot.el change bumping its Package-requires: eldoc
> version.  That way we guarantee that older Emacsen pulling in new eglot.el
> also pull in the new suitable eldoc.el.

Cool. Let me check if we really don’t need the eglot--when-buffer-window wrapper in the documentation functions. Or you’re certain that we don’t?

Yuan





This bug report was last modified 60 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.