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

From: Augusto Stoffel <[email-masked]>
Date: Tue, 6 Aug 2024 17:45:04 +0200

On Tue, Aug 6, 2024, 17:34 João Távora <[email-masked]> wrote:

> * lisp/progmodes/eglot.el (eglot-server-programs): Explicitly list modes
> derived from tex-mode, so that the correct language id is guessed.
>
> Won't it break when another mode is derived from it?
>

Not really, since such a hypothetical mode has no support from the servers.

May I ask why
> don't you just use the :language-id cookie which is designed
> exactly for this -- to avoid a guess?
>

That doesn't work, because apparently Eglot picks the language id of the
first mode in the listing that applies, which previously was the generic
tex-mode. That doesn't allow distinguishing latex and plain TeX. Again, the
issue is not guessing the language id string from the mode name, but rather
choosing the right mode symbol to guess from.

(Above I say apparently because this is not documented behavior, although
it's easy to check or verify reading the code.)