Subject: bug#61679: 29.0.60; Eglot: staying out of trouble

From: João Távora <[email-masked]>
Date: Tue, 21 Feb 2023 15:00:47 +0000

On Tue, Feb 21, 2023 at 2:32 PM Augusto Stoffel <[email-masked]> wrote:
>
> Eglot modifies several Emacs features, and it seems to do so
> independently of the server capabilities.  For instance, it registers a
> capf and Eldoc functions even if the server does't provide completions
> respectively "hover"/signature help.
>
> In some cases (capf, xref) this seems innocuous, in others (eldoc) Eglot
> is really overwriting a possibly useful function with a possibly useless
> one.

In the Eldoc case, as of yesterday, this no longer happens.

Look at

commit e83c78b8c7784254c2c6f043530ab325c2fa7f16
Author: João Távora <[email-masked]>
Date:   Mon Feb 20 22:43:50 2023 +0000

    Eglot: respect user's Eldoc configuration by default

> I would suggest that Elgot initially should keep
> flymake-diagnostic-functions unchanged, and only overwrite it when the
> first diagnostic comes from the server.

This seems way too complicated for a problem that hasn't even been
demonstrated.  The reason there's no capability announcement for
diagnostics is likely because it's such a basic capability that
virtually every server supports it, unless you go out of your way
to find or craft one that doesn't.

When activating Eglot, you're saying "let this here LSP server
manage my buffer by connecting it with these Emacs infrastructures"
You're letting go of some of your major-mode's configuration
and user configuration for what is in 99% of the cases a much more
integrated and hassle-free IDE experience.

Even so, Eglot only temporarily overrides your configuration and
will not do so gratuitously, as the commit above illustrates.  In
Flymake's case, it is really important to override the value by
default or else super-popular languages like Python handled by
python mode start showing confusing duplicate diagnostics to
newbie users, and we don't want that.

If you really like your pre-Eglot configuration, you can combine
it with Eglot's by leveraging eglot-managed-mode-hook and
eglot-stay-out-of. This was Eglot's philosophy from the start and
I don't intend to change it.

João