From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Augusto Stoffel Newsgroups: gmane.emacs.bugs Subject: bug#72343: [PATCH] Fix eglot-server-programs for TeX modes Date: Wed, 07 Aug 2024 11:17:58 +0200 Message-ID: <87y158pu7t.fsf@gmail.com> References: <87sevtz8xg.fsf@gmail.com> <86msm1z8c4.fsf@gnu.org> <87ttg8k9l6.fsf@gmail.com> <86frrszbep.fsf@gnu.org> <87o765k7ze.fsf@gmail.com> <87ed71fvy8.fsf@gmail.com> <87frrhxzbz.fsf@gmail.com> <875xscrf1z.fsf@gmail.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="3569"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: Eli Zaretskii , 72343@debbugs.gnu.org To: =?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?= Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Aug 07 11:19:57 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1sbcpp-0000iG-18 for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 07 Aug 2024 11:19:57 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sbcpY-0002v5-It; Wed, 07 Aug 2024 05:19:40 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sbcpV-0002uc-Rh for bug-gnu-emacs@gnu.org; Wed, 07 Aug 2024 05:19:38 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sbcpV-0006xw-AO for bug-gnu-emacs@gnu.org; Wed, 07 Aug 2024 05:19:37 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:Date:References:In-Reply-To:From:To:Subject; bh=WbGJewUl5f7hhZPmt0cMKjG3qhlFzY6wdJgmeR2oxDo=; b=VkKKhqgXd5F080YN1bQgXBQVjNtmenztKXJ/8SJzpfkUM6XSZfX+QbH1Gni5/p2GeH8QcDqKRdJj9j8kM2GxpGAUAY7hF1hjKNQ9ahyKneDGyARYJx0YY7V3WmVwmh6xC09z1/kp6oTIYD6+jVjn/MxB66RchJrtxgaejsoB6wPDLc4NAMGTZ1rorCGTgdspaTSHzUkCTDNNCj/36NT6Sucmvt6JUhbXd+9/6i4Po9eJ/+WqVjnDqGkKSKsKxiTRdZdzb0QcMBcRmiofWqRSwtBJjodAqN9DWsCv2WFDUhT+uoIttXgoUjWOP1FKdtLqzv9bDtDT8gJEUu5O0eXSpg==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1sbcpt-0006TY-QB for bug-gnu-emacs@gnu.org; Wed, 07 Aug 2024 05:20:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Augusto Stoffel Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 07 Aug 2024 09:20:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 72343 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 72343-submit@debbugs.gnu.org id=B72343.172302237524824 (code B ref 72343); Wed, 07 Aug 2024 09:20:01 +0000 Original-Received: (at 72343) by debbugs.gnu.org; 7 Aug 2024 09:19:35 +0000 Original-Received: from localhost ([127.0.0.1]:33683 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sbcpT-0006SK-BG for submit@debbugs.gnu.org; Wed, 07 Aug 2024 05:19:35 -0400 Original-Received: from mail-wr1-f44.google.com ([209.85.221.44]:60535) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sbcpQ-0006Rz-4E for 72343@debbugs.gnu.org; Wed, 07 Aug 2024 05:19:33 -0400 Original-Received: by mail-wr1-f44.google.com with SMTP id ffacd0b85a97d-367990aaef3so855702f8f.0 for <72343@debbugs.gnu.org>; Wed, 07 Aug 2024 02:19:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1723022281; x=1723627081; darn=debbugs.gnu.org; h=mime-version:user-agent:message-id:date:references:in-reply-to :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to; bh=WbGJewUl5f7hhZPmt0cMKjG3qhlFzY6wdJgmeR2oxDo=; b=IusQy0lg/iovzXdTka2+7dmxE8e1bED1IeYj6AYxOhGrnn32dV1In3ZzKR91fLS2c3 ajxFydss+J0vILrfdZhlru02310ObpZS5OjorS5kMzdsEHSoETGe2aUjJRWkqjV8xvpM f0PTDoCWyTrozsICFGHoymo9ng3eIvj6/h/4BTk1twdrhiWaksIEDIeyVDVH2hewwAD2 KdLGrEIGrJWX3USGBdgPJhzK7f43atbtztGAE0ZJJmRzBSwZUcxi0kTez+aHeMfS5tih QHNFu0k0QHXyEEb4Pgn9TQ0FPRgjwsdSTPkOBIYOgHCZpbbU3FXI8SZ+41oGlpZEvmBm oofA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723022281; x=1723627081; h=mime-version:user-agent:message-id:date:references:in-reply-to :subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=WbGJewUl5f7hhZPmt0cMKjG3qhlFzY6wdJgmeR2oxDo=; b=M8D2pdKwJgRosU4+enIlW41IsUtqXCiKSZJ/UNwDuokNBa7uXuJpNBKCpJ3iWsyjUi z9yDSTIGuAW5NeDuC4YJWrUvnmlQSyImKS1/eDX29KBr+mKIXw23T10mmWh1H0QNcq+Z QXAEqafWxCMc86ipvdp385X2ccLuzBNpgFP9CFndEEwK8q5Ze8cJ4qubL/N0jkB+/CHJ g+DB373uW5upEvJdfso8vijFTmtaoGzvAA8efZVMBABzOWSK3EIfMwSyjWZTXIOK4flc jpOGTTL4tEuZZHjZYhuyPEzAUcuyNWvnBYxjZuCFbIKROiUsQ6bt6GuQS9YHchCD5nL1 MIKg== X-Gm-Message-State: AOJu0YzK78h1AzVbmUyqs6ySQJ9XeRMxqLDrIhm4MSQlp7wtCMtAMLe+ dARpHpVnnDc9p3uZdC6+CymFHHRZy8iob5nVKTAMCJbhEoH4tcq0 X-Google-Smtp-Source: AGHT+IHhBz/9d1m6RkM0vzl6TyBQEY9XnfgrWs1yNS8pLKs4iqAUBOEjn7m4fq6U6edJQ9/F/dd2GQ== X-Received: by 2002:a05:6000:1246:b0:369:e72c:875f with SMTP id ffacd0b85a97d-36bbc164337mr12460536f8f.48.1723022280853; Wed, 07 Aug 2024 02:18:00 -0700 (PDT) Original-Received: from ars3 ([89.246.250.22]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-36bbd0747cfsm15328101f8f.109.2024.08.07.02.17.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Aug 2024 02:17:59 -0700 (PDT) In-Reply-To: ("=?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?="'s message of "Wed, 7 Aug 2024 09:47:59 +0100") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:289870 Archived-At: --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On Wed, 7 Aug 2024 at 09:47, Jo=C3=A3o T=C3=A1vora wrote: > On Wed, Aug 7, 2024 at 8:02=E2=80=AFAM Augusto Stoffel wrote: > >> Sure, but how is that useful information for a language server? > > Fairly useful. If someone tells me this upfront about some stream of > data they're about to send I know I can use a very simple parser. > Or I can reject it altogether if I don't like "lisp" for some reason. > If working on a language server multiplexer, for example > that information is possibly enough to know where to redirect the > didOpen. (That's a tangent, but in practice your multiplexer will be required to know what to do with more specific language ids such as "common-lisp" or "scheme". So I still see no advantage in sending less specific language ids.) >> > 3. Ignoring my advice and sending "plain-tex" from Eglot anyway >> > (i.e. installing your patch without :language-id) >> >> You're clearly against this so it is not going to happen, but I hope I >> managed to explain to you why I would have done it. > > Ultimately, I have to leave room for a pragmatic decision from > domain experts, even if it violates the spec. I'm just trying to > understand the angles and judge the probability of breakage > later on. > >> > For the _other_ orthogonal problem, I suggest: >> > (racket-mode . ("racket" "-l" "racket-langserver")) >> > - ((tex-mode context-mode texinfo-mode bibtex-mode) >> > + ((latex-mode (plain-tex-mode :language-id "tex") tex-mode >> > context-mode texinfo-mode bibtex-mode) >> >> Since you want to send "tex" language id for plain tex, the following >> suffices: >> >> ((latex-mode tex-mode context-mode texinfo-mode bibtex-mode) > > Again, I don't "want" to (see above for the reasons). This patch > is concerned with the orthogonal requirement of keeping tex-mode > (and not removing it as you proposed) > > So: > > * please make up your mind, i.e. make a (possibly overriding) decision > whether sending off-spec "plain-tex" for tex-mode is really what is > needed. > > * whatever your decision, keep 'tex-mode' in the list. > > * help me test the patch below by checking that problem X is now > solved and now new problem Z has popped up. So this is my final suggestion then: --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-Fix-eglot-server-programs-for-TeX-modes.patch >From 22b876a153e8bbede02804e374c5c234213181f2 Mon Sep 17 00:00:00 2001 From: Augusto Stoffel Date: Tue, 6 Aug 2024 16:58:06 +0200 Subject: [PATCH] Fix eglot-server-programs for TeX modes * lisp/progmodes/eglot.el (eglot-server-programs): Explicitly list modes derived from tex-mode, so that the correct language id is guessed. --- lisp/progmodes/eglot.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el index 31948a12d69..67bd26f6f02 100644 --- a/lisp/progmodes/eglot.el +++ b/lisp/progmodes/eglot.el @@ -292,7 +292,7 @@ eglot-server-programs (scala-mode . ,(eglot-alternatives '("metals" "metals-emacs"))) (racket-mode . ("racket" "-l" "racket-langserver")) - ((tex-mode context-mode texinfo-mode bibtex-mode) + ((latex-mode plain-tex-mode context-mode texinfo-mode bibtex-mode tex-mode) . ,(eglot-alternatives '("digestif" "texlab"))) (erlang-mode . ("erlang_ls" "--transport" "stdio")) ((yaml-ts-mode yaml-mode) . ("yaml-language-server" "--stdio")) -- 2.45.2 --=-=-= Content-Type: text/plain It solves problem X and my estimated breakage probability is "infinitesimally small" since it works for LaTeX, BibTeX and ConTeXt and all other dialects are very very fringe. --=-=-=--