From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#73280: 30.0.90; Eglot: eglot-workspace-configuration might not be found in .dir-locals.el Date: Mon, 16 Sep 2024 14:38:22 +0300 Message-ID: <86ttefde1d.fsf@gnu.org> References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="590"; mail-complaints-to="usenet@ciao.gmane.io" Cc: joaotavora@gmail.com, 73280@debbugs.gnu.org To: Troy Brown , Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Sep 16 13:40:11 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 1sqA5T-000AVw-Fa for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 16 Sep 2024 13:40:11 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sqA5G-0007XX-G3; Mon, 16 Sep 2024 07:39:59 -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 1sqA5A-0007X6-FY for bug-gnu-emacs@gnu.org; Mon, 16 Sep 2024 07:39:53 -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 1sqA57-0004nt-LU for bug-gnu-emacs@gnu.org; Mon, 16 Sep 2024 07:39:50 -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:References:In-Reply-To:From:Date:To:Subject; bh=VLONm7aQPB+7uCOpOo5Cxnf0CChn5qRAkfGxW5BI06k=; b=QGGFJG/pl64UKOmvaEyedi9xm+4LtRn/2tFg6SKY+pk84oJNp9AZX0IKojdqMJIhEL5gmZvkNhit8D/f2Ui5HFbJ43mMpzZzw/Ye0fo+HMjsJ09p5lkUuEbDz42RvDlbI2YytepSFgvmr1IJxe39se4Z6XHzJqrqu0k1foFRTTyoYDZev5XK8VvGyU1Us2UQ7HMQuZ+tejshGCri3PnKuXVYECr4Yu+7fiPfJvZlm57T5WtegOZMtKA30TRrVwrZXwznlOU1qhVaAwtArcw3PO8ZupVrxBLAN3S69B6Z8nDcaYPE7hyzVUU/IJ+3ONuFGNi3OqAQcQVUeAs5NJv+AA==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1sqA5K-000219-Gb for bug-gnu-emacs@gnu.org; Mon, 16 Sep 2024 07:40:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 16 Sep 2024 11:40:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 73280 X-GNU-PR-Package: emacs Original-Received: via spool by 73280-submit@debbugs.gnu.org id=B73280.17264867447667 (code B ref 73280); Mon, 16 Sep 2024 11:40:02 +0000 Original-Received: (at 73280) by debbugs.gnu.org; 16 Sep 2024 11:39:04 +0000 Original-Received: from localhost ([127.0.0.1]:51183 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sqA4N-0001zZ-RK for submit@debbugs.gnu.org; Mon, 16 Sep 2024 07:39:04 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:53692) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sqA4K-0001z3-DO for 73280@debbugs.gnu.org; Mon, 16 Sep 2024 07:39:01 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sqA41-0004li-AV; Mon, 16 Sep 2024 07:38:41 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=VLONm7aQPB+7uCOpOo5Cxnf0CChn5qRAkfGxW5BI06k=; b=VcO6pJnKP5zQe8I8tosv cXFjMzFOyKcY4+UnBPNL9NMIpSZnSHd4ZB1FC2wTB22LDwYrRXG704xPydEOiwHQ9RWRef1Qv5+H4 QDTzEQSwJPaCf9kO5uGMFvLR3s+xDRAjKojWLSnoXp+NEQXuKwCPlWzJDjD/BqdpINPaF4kzdRm7Y fJOnZskxh+WEBv7go+iLbc/3eO5c3NXANNp1KLkSnrDcfi18Lp7nUvi5/7TQnV00WE8DAJWQaUEgM Xs8FS2OHv5ikd+S6i2z24uBNy2nKeEwS8xf8k+MRS5G3zzRJD94zNuDanj6MB5e2ICct5jbTrYFU6 Zs3L9inwUfjGqA==; In-Reply-To: (message from Troy Brown on Sun, 15 Sep 2024 15:54:00 -0400) 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:291882 Archived-At: > Cc: João Távora > From: Troy Brown > Date: Sun, 15 Sep 2024 15:54:00 -0400 > > I discovered that the workspace configuration specified in a > `.dir-locals.el` file was not being used if the mode is not listed > first in `eglot-server-programs`. Consider a scenario where the > current buffer's major mode is `ada-ts-mode` and Eglot is enabled in > that buffer. Also, consider the following `.dir-locals.el` in a > parent directory containing the file of the buffer. > > ```elisp > ((ada-ts-mode . ((eglot-workspace-configuration . (:ada (:projectFile > "src/gtkada.gpr")))))) > ``` > > If I then execute `M-x eglot-show-workspace-configuration RET` in that > `ada-ts-mode` buffer, the "*EGLOT workspace configuration*" buffer > opens and displays a value of "null". > > ```json > null > ``` > > However, if I change the mode in `.dir-locals.el` from `ada-ts-mode` > to `ada-mode` and repeat the "show configuration" command, I see the > configuration as expected, even though the major mode is > `ada-ts-mode`. > > ```json > { > "ada": { > "projectFile": "src/gtkada.gpr" > } > } > ``` > > I believe this is due to the following statement in > `eglot--workspace-configuration-plist`, which sets the major mode in > the temporary buffer before calling > `hack-dir-local-variables-non-file-buffer`: > > ```elisp > ;; Set the major mode to be the first of the managed > ;; modes. This is the one the user started eglot in. > (setq major-mode (car (eglot--major-modes server))) > ``` > > The comment indicates that the major mode that Eglot was started in > will be listed first, but that is not the case. If I execute `M-: > (eglot--major-modes (eglot-current-server))` from the `ada-ts-mode` > buffer, the value is `(ada-mode ada-ts-mode)`, which is the same order > they are listed in `eglot-server-programs`, and is not ordered based > on the major mode of the buffer where Eglot was started. > Additionally, `eglot--connect` which populates `eglot--languages` > doesn't change the order from how they are listed in > `eglot-server-programs`. João and Stefan, any comments? FWIW, I'd rather think this is a feature, since users don't need separate Eglot settings for ada-mode and ada-ts-mode. But maybe I'm missing something.