Subject: bug#72343: [PATCH] Fix eglot-server-programs for TeX modes

From: Augusto Stoffel <[email-masked]>
Date: Fri, 2 Aug 2024 17:13:11 +0200

On Fri, Aug 2, 2024, 16:01 João Távora <[email-masked]> wrote:

> [Did you mean to write only to me?]
>

Sorry, I'm copying the bug list now.

>
> On Fri, Aug 2, 2024 at 2:09 PM Augusto Stoffel <[email-masked]>
> wrote:
>
> >> Have you tried the :language-id _keyword_ as explained in the
> documentation I linked to? It should avoid the multiple entries.
> > I had to look at the source code for some examples to see what you mean.
> Sure, that would avoid multiple entries.
>
> I'd think this sentence:
>
> > can be either a symbol of an Emacs major mode or
> > a list of the form (mode :language-id id), with mode being a major-mode
> symbol
> > and id a string that identifies the language to the server
>
> Would be enough.  It's very typical of Emacs variables to have these kinds
> of things.
> But feel free to propose some better documentation.  Maybe an example.
>
> > Still, it's unclear to me why one would prefer a solution that requires
> dabbling into language ids where it could be avoided.
>
> The problem you're trying to solve is related to language-id, as far as I
> understand.
> The "wrong" one is being sent right now, and you want the correct one to
> be sent.
> So it's not a question of dabbling, it's about sending the correct value.
> And there's a
> setting for affecting precisely that value, with no middle man, and it was
> designed
> for solving exactly your problem. Guessing the language-id  from the
> major-mode
> name is much worse than that, IMHO.
>

I think guessing "lang" from lang-mode is perfectly fine. The problem here
is that when eglot-server-program lists a server for tex-mode and the
server is selected for use in a derived mode such as latex-mode, the
guessed language is tex and not latex.

> Also it's a more concise solution.
>

For the reason noted above, there is no "concise solution" to choose, all
derived modes from tex-mode need to be mentioned explicitly in one way or
another (either to make the guess correct, or to provide manually a
language id).

Also it's more in-line with the rest of the variable,
> Also keeps texlab working (or not working) like it did before.  Also
> doesn't spam "digestif"
> multiple times in e-s-programs.
>

Fine, I can change the patch so that texlab will still run on modes that it
doesn't support (plain TeX and ConTeXt, etc). Just please confirm that this
is the behavior you prefer.

> So if you say it works and can actually test it, please use that instead.
>
> João
>