Subject: Re: bug#78530: 31.0.50; [PATCH] eglot-code-action-suggestion doesn't call the callback function in the original buffer

From: João Távora <[email-masked]>
Date: Mon, 9 Jun 2025 00:19:36 +0100

On Sat, Jun 7, 2025 at 9:08 AM Eli Zaretskii <[email-masked]> 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.

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

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.

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.

Thanks,
João