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: Fri, 2 Aug 2024 17:13:11 +0200 Message-ID: References: <87sevtz8xg.fsf@gmail.com> <86msm1z8c4.fsf@gnu.org> <87ttg8k9l6.fsf@gmail.com> <86frrszbep.fsf@gnu.org> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="000000000000c6a906061eb4c4c6" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="38373"; mail-complaints-to="usenet@ciao.gmane.io" 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 Fri Aug 02 17:15:10 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 1sZtzp-0009mf-UK for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 02 Aug 2024 17:15:10 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sZtzS-0006kU-S9; Fri, 02 Aug 2024 11:14:46 -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 1sZtzQ-0006kD-Oo for bug-gnu-emacs@gnu.org; Fri, 02 Aug 2024 11:14:45 -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 1sZtzQ-0006QA-FS for bug-gnu-emacs@gnu.org; Fri, 02 Aug 2024 11:14:44 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=Date:From:In-Reply-To:References:MIME-Version:To:Subject; bh=s4OsW/kryTr1qWIHcRdzKMpT0Zjll6UE0hjftrqO0Oo=; b=in01EX479bmMifBL49rIKIxtvWcgfivLLVVXui+b+lHz12/JMlTAj6GLet+mevr+RbGE3FXkTqXl5TcMWYZ+pU05xPdgMH5moX4A0nzxCDqye/edAnw8IqdjK2suR0AjgNi95oe+JgIDlNPyMMcLaTaFA+IGH+LVUXwfyH4gSe0AFi60I9BuwdQsqNNfbwdulGqJhG2TBB2JkecdiL9NCtf52gOeUQp8T4MWOHpiP7A333oNMZqpD9rofhGKo5ZIrw7GZCdmkdIHqmpPFJeLM3mjtuGPvttK/UQ7pCpFbrDkdricu4vhYXKpX4/NNws0ezEtQUgNsyVzLWByjksZsA==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1sZtzi-0003SD-6r for bug-gnu-emacs@gnu.org; Fri, 02 Aug 2024 11:15:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Augusto Stoffel Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 02 Aug 2024 15:15:02 +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.172261169213241 (code B ref 72343); Fri, 02 Aug 2024 15:15:02 +0000 Original-Received: (at 72343) by debbugs.gnu.org; 2 Aug 2024 15:14:52 +0000 Original-Received: from localhost ([127.0.0.1]:53643 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sZtzX-0003RU-HX for submit@debbugs.gnu.org; Fri, 02 Aug 2024 11:14:52 -0400 Original-Received: from mail-pf1-f169.google.com ([209.85.210.169]:43490) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sZtzV-0003RJ-4e for 72343@debbugs.gnu.org; Fri, 02 Aug 2024 11:14:50 -0400 Original-Received: by mail-pf1-f169.google.com with SMTP id d2e1a72fcca58-70d316f0060so2286867b3a.1 for <72343@debbugs.gnu.org>; Fri, 02 Aug 2024 08:14:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1722611605; x=1723216405; darn=debbugs.gnu.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=s4OsW/kryTr1qWIHcRdzKMpT0Zjll6UE0hjftrqO0Oo=; b=MFuudPrJCC9naAqIvr6XVmQcgYxIh9lqtDYxF+yth03w3F9z3CYvnzUiJ8H4D0O5Mr 8dxAFsNs/x8/JI7VyRd6IUY5z9kK6QyxXEECLuuvOig/sE6SXDWi5/8MVFFh9acu7mNM y0Pt+msu5JlrtPm4yGXyJzV/TLi7gK9YZPI4FXED6veFi1840xI+hx80XGc2+lbBqgiH 0J1DA4IHxWbjOiaByY84IOVcrv5hSMgIADMB40Ntn+2oYjwhwDf3aisINUqg9vFgre8P 9mhDINvN4Ex8hqezH6ue+wHzC7PrQCK1JoDiHMo1nLjvU54OkhJVOqACzOAakvnRkSOb VTag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722611605; x=1723216405; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=s4OsW/kryTr1qWIHcRdzKMpT0Zjll6UE0hjftrqO0Oo=; b=Z1Tha5GbDrZu1WVmfTuD6TV81OsOIVXZUZ1rbl8XUj4OMb5xXvFtbLL6nw9NLL37YE i+2cevEVJNcLJ+tREmDZR+wGzwzErR8vYIFOV9Zo9e14Wtm5S7Xl8pxV/MzKxWahP8d4 xAKhoDPeCWceYtVPyxWZK0RaVwx8cQ7JNMA8CsTBvfyQKFOwc83oo16R+6O72B+AqBWE am5P12xGeKwLeem4v63HwQcrNh+4dFScbfi46tITf7XqmpNUPcHygYrDHj95NnSQaQgD X3jxt0UzwOkebJJkouL1RXQWdTL2VmHlue+R8Agn7kHeBViFu9QX9rCxS6DWVaAm04Bc 6ZNQ== X-Gm-Message-State: AOJu0Yz4+2R2vJ+zfwyBtRo3fQ0qyk41WpP7PcOjXvtzYgspEgDfsP4f ucKLpHysa5NPYvHzRzH48hb4IzDrmBw38YJ+pWelRwQ54p8bjw8Tdi+Fq5PwbjWeCzxeH7bXa0B gu6Q8L8dHh3EaDr2H5ZrMeFOO2Dw= X-Google-Smtp-Source: AGHT+IFdaSwQSPQD6gVOiBC1lmPtHsJVXQ8aTsVJO2gPu6MgLCihl53PyMnS69C6wFrIVnaM/LlnHEd65tWJX9cpRJM= X-Received: by 2002:a17:902:fa84:b0:1fd:96c7:24f5 with SMTP id d9443c01a7336-1ff523ef6f9mr61867095ad.5.1722611604560; Fri, 02 Aug 2024 08:13:24 -0700 (PDT) In-Reply-To: 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:289641 Archived-At: --000000000000c6a906061eb4c4c6 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Fri, Aug 2, 2024, 16:01 Jo=C3=A3o T=C3=A1vora wro= te: > [Did you mean to write only to me?] > Sorry, I'm copying the bug list now. > > On Fri, Aug 2, 2024 at 2:09=E2=80=AFPM Augusto Stoffel > 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 kind= s > 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 wa= s > 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=C3=A3o > --000000000000c6a906061eb4c4c6 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
On Fri, Aug 2, 2024, 16:01 Jo=C3=A3o T=C3=A1vora <joaotavora@gmail.com> wrote:
= [Did you mean to write only to me?]

Sorry, I'm copying the bug l= ist now.

On Fri, A= ug 2, 2024 at 2:09=E2=80=AFPM Augusto Stoffel <arstoffel@gmail.com&= gt; wrote:

>> Have you tried the :language-id _keyword_ as exp= lained in the documentation I linked to? It should avoid the multiple entri= es.
> 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 thi= s sentence:=C2=A0

> can be either a symbol of an Emac= s major mode or=C2=A0
> a list of the form (mode :language-id id), w= ith mode being a major-mode symbol=C2=A0
> and id a string tha= t identifies the language to the server

Would be e= nough.=C2=A0 It's very typical of Emacs variables to have these kinds o= f things.=C2=A0
But feel free to propose some better documentatio= n.=C2=A0 Maybe an example.
=C2=A0
> Still, it's unclear to me = why one would prefer a solution that requires dabbling into language ids wh= ere it could be avoided.

The problem you're trying to solve is r= elated to language-id, as far as I understand.=C2=A0=C2=A0
The &q= uot;wrong" one is being sent right now, and you want the correct one t= o be sent.
So it's not a question of dabbling, it's about= sending the correct value.=C2=A0 And there's a=C2=A0
setting= for affecting precisely that value, with no middle man, and it was designe= d
for solving exactly your problem. Guessing the language-id=C2= =A0 from the major-mode=C2=A0
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 fo= r tex-mode and the server is selected for use in a derived mode such as lat= ex-mode, the guessed language is tex and not latex.
=

Also it&= #39;s a more concise solution.=C2=A0
<= div dir=3D"auto">
For the reason noted above, th= ere is no "concise solution" to choose, all derived modes from te= x-mode need to be mentioned explicitly in one way or another (either to mak= e the guess correct, or to provide manually a language id).


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

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 pr= efer.


So if you say it works and can actually test it, pleas= e use that instead.

Jo=C3=A3o
--000000000000c6a906061eb4c4c6--