From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: =?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?= Newsgroups: gmane.emacs.bugs Subject: bug#72343: [PATCH] Fix eglot-server-programs for TeX modes Date: Tue, 6 Aug 2024 17:27:28 +0100 Message-ID: References: <87sevtz8xg.fsf@gmail.com> <86msm1z8c4.fsf@gnu.org> <87ttg8k9l6.fsf@gmail.com> <86frrszbep.fsf@gnu.org> <87o765k7ze.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="8336"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Eli Zaretskii , 72343@debbugs.gnu.org To: Augusto Stoffel Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Aug 06 18:29:58 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 1sbN4P-00023V-DW for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 06 Aug 2024 18:29:57 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sbN4A-0000fN-A1; Tue, 06 Aug 2024 12:29:42 -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 1sbN47-0000f6-En for bug-gnu-emacs@gnu.org; Tue, 06 Aug 2024 12:29:39 -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 1sbN47-0005xE-2z for bug-gnu-emacs@gnu.org; Tue, 06 Aug 2024 12:29:39 -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=5YMi/e0y4UW1wDU5cPjaYuKTUPVIZ4Q8iCkElUJrK0w=; b=TdwvC5mCd0ZHDy6xBqWpwDXsFtD1Y0g4qs62pmEnqNBj8YrV3Bh21Q8/hewDCJ2X4MIqYAtrX/JD0ecD+oVfmWlNhfUIpGipLvY2WzQUM0HF4/qb1E4UWLyRah5IJuZN0LfEGv2JCOuMHkF3OMk6Hfx1oTv+UmvgaVkbKA1jWVdm1Hrgd3q3+9LsvJOxoSpKLT7ra8BQOq7P74H6pWSAaxqlTHknEAnzLgf6UtPUtuYe+Y89xJP5/uWlbloMEsoRf9Elp6sWHLdMP9N6BFVAVn3FCoYL4++kYKTTn6Mjc+nTy33kIl5Ny7RnPZYLqkbVw32cXJ8Uhgs5YCbHIMiGNw==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1sbN4U-00030p-LQ for bug-gnu-emacs@gnu.org; Tue, 06 Aug 2024 12:30:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: =?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 06 Aug 2024 16:30: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.172296175111492 (code B ref 72343); Tue, 06 Aug 2024 16:30:02 +0000 Original-Received: (at 72343) by debbugs.gnu.org; 6 Aug 2024 16:29:11 +0000 Original-Received: from localhost ([127.0.0.1]:32951 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sbN3f-0002zI-1G for submit@debbugs.gnu.org; Tue, 06 Aug 2024 12:29:11 -0400 Original-Received: from mail-oa1-f43.google.com ([209.85.160.43]:47429) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sbN3d-0002yz-RF for 72343@debbugs.gnu.org; Tue, 06 Aug 2024 12:29:10 -0400 Original-Received: by mail-oa1-f43.google.com with SMTP id 586e51a60fabf-2689e7a941fso585203fac.3 for <72343@debbugs.gnu.org>; Tue, 06 Aug 2024 09:28:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1722961660; x=1723566460; darn=debbugs.gnu.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=5YMi/e0y4UW1wDU5cPjaYuKTUPVIZ4Q8iCkElUJrK0w=; b=hZNghLnyUJp00+yPu0WzzIyqo/an6V+Miu6+y7fmFc9IvkWAcvCf5T8zxOCXrtfg17 FOIlEzwiizi/ZITQI/GNMFSy/t6XndYN2up7cHzVib70dcoLyM7LHLVY4UwcV8q8pXF1 ikW4RxJLOk40fROsYv8ThvxpeOvUMKYxxIgbLk01o1kNpCGSTs+R3j4OAfRttgHYWgrX jDwJX48FXrKS8bPW7kHi0ozd8lN7Xq8SCLmq9oOKuLlZdAMloedrzv6e2HSQZ2W0EoC8 EYVltmjWdSlAaEeTIVemQeRr6M1Sp4g1/2wBbfdEMeFuQ0Hpua4C8Cf+A1GwqZ6cotLr 2mIg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722961660; x=1723566460; h=content-transfer-encoding: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=5YMi/e0y4UW1wDU5cPjaYuKTUPVIZ4Q8iCkElUJrK0w=; b=GQEHfRHZ37Nk4zHx14+krVLad8NPgLGHoPm5nyVaxkYzr479VAsE/ciTjdqBSBWUjk EbeWsjmkp9zGI3uO9usX9egoMNjj38gIEh3XIXeQfNVrQuIGbagnp3P+hfdEY9JAfhpw h5AbcN9P9LFD29FGQRkcT4kTS1iT1RW55W3JhuUqVvXCxBAvNdXEs7I09CKAN6oO9Z/7 OyxnY8rFv13i1hB5hiAkim7+VHjMAHgp8QbcOrU3BhpYxRNO5Mzk3GmfRLBGsZLT4Szz sh4WUIF/BB6uNMVE6/s5z2McHKtOI/W/aK0XuFV2HnqNbzf72o4V5JnPWgpFFBzESf8n dQJw== X-Gm-Message-State: AOJu0YwUW8uetqSrCFyr51bNb6A9D3EpqpYE6Ghwnh+95aJIg/N5Y5mN 0RAvORhLvqxXqjCb95EYKn9VOsBXlrGfpMf799VALO4guSIOrCCdpjYGpd7iiydOSL81IaaNRqc J/IT5UORCwbUOJ1W9Vmk8uSFKQro= X-Google-Smtp-Source: AGHT+IEneo1/BDO2eTTBKsqF120RRV0BFFBRVlX3hu+BdeNUgz+pSbtS8kbiMPTmeRs71m5gDJ4avdUon9U8NaugG1I= X-Received: by 2002:a05:6870:970c:b0:261:236c:2bb8 with SMTP id 586e51a60fabf-26891d1f9ddmr20740417fac.12.1722961660002; Tue, 06 Aug 2024 09:27:40 -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:289842 Archived-At: On Tue, Aug 6, 2024 at 4:45=E2=80=AFPM Augusto Stoffel wrote: > > On Tue, Aug 6, 2024, 17:34 Jo=C3=A3o T=C3=A1vora w= rote: >> >> * 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 server= s. No but it might represent a language that does! servers don't care modes, they know about languages. Furthermore, the same server, even the same server connection might serve multiple documents in multiple different languages. > That doesn't work, because apparently Eglot picks the language id Eglot pairs language ids with modes (plural). This is what the internal function eglot--lookup does. In the same session, multiple language-id maybe be picked depending on the LSP document being "opened". So there's no "single pick" in general. > of the first mode in the listing that applies, which previously was the g= eneric tex-mode. That doesn't allow distinguishing latex and plain TeX. Aga= in, the issue is not guessing the language id string from the mode name, bu= t rather choosing the right mode symbol to guess from. Previously, you suggested :language-id would work, but you didn't want to "dabble" with it. Now you seem to be saying it can't work at all. This may be an "XY Problem". Can you state what exactly is the end result you're trying to achieve (short of "writing thesis" or "fulfill life goals") as someone who has never seen Eglot source code before or has looked at LSP event logs to check what is being sent. Tell me which server is installed and what file(s) in which major modes you are visiting just before typing `M-x eglot`. Then tell me what happens to said server invocation (if any). Focusing on the goal rather than the means may help me understand what you want to achieve. Thanks