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

From: Augusto Stoffel <[email-masked]>
Date: Sun, 28 Jul 2024 20:08:11 +0200

Tags: patch

I noticed Eglot currently sends the languageId "tex" in all TeX-derived
modes, which is not correct; it should be "latex", "bibtex", etc.

See the attached patch for a fix.

>From 754127ad8bfa6ade7fe9a836df2a8bea75d711ea Mon Sep 17 00:00:00 2001
From: Augusto Stoffel <[email-masked]>
Date: Sun, 28 Jul 2024 20:03:35 +0200
Subject: [PATCH] Fix eglot-server-programs for TeX modes

* lisp/progmodes/eglot.el (eglot-server-programs): Add a dedicated entry
to each TeX format, since the languageId passed to the server is derived
from it.
---
 lisp/progmodes/eglot.el | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el
index 5845aff39b7..ea60b5d9a72 100644
--- a/lisp/progmodes/eglot.el
+++ b/lisp/progmodes/eglot.el
@@ -292,8 +292,11 @@ eglot-server-programs
     (scala-mode . ,(eglot-alternatives
                     '("metals" "metals-emacs")))
     (racket-mode . ("racket" "-l" "racket-langserver"))
-    ((tex-mode context-mode texinfo-mode bibtex-mode)
-     . ,(eglot-alternatives '("digestif" "texlab")))
+    (plain-tex-mode "digestif")
+    (latex-mode . ,(eglot-alternatives '("digestif" "texlab")))
+    (context-mode "digestif")
+    (texinfo-mode "digestif")
+    (bibtex-mode . ,(eglot-alternatives '("digestif" "texlab")))
     (erlang-mode . ("erlang_ls" "--transport" "stdio"))
     ((yaml-ts-mode yaml-mode) . ("yaml-language-server" "--stdio"))
     (nix-mode . ,(eglot-alternatives '("nil" "rnix-lsp" "nixd")))
-- 
2.45.2