From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Troy Brown Newsgroups: gmane.emacs.bugs Subject: bug#73280: 30.0.90; Eglot: eglot-workspace-configuration might not be found in .dir-locals.el Date: Sun, 15 Sep 2024 15:54:00 -0400 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="4301"; mail-complaints-to="usenet@ciao.gmane.io" Cc: =?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?= To: 73280@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Sep 15 21:55:07 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 1spvKr-0000tR-TE for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 15 Sep 2024 21:55:06 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1spvKe-00030U-Qs; Sun, 15 Sep 2024 15:54:53 -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 1spvKc-00030C-UF for bug-gnu-emacs@gnu.org; Sun, 15 Sep 2024 15:54:51 -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 1spvKc-0004oS-LH for bug-gnu-emacs@gnu.org; Sun, 15 Sep 2024 15:54:50 -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:MIME-Version:To:Subject; bh=woLfxDnR/saDsDopAlMPwQwCjDy+3oCBnrhohvTidiE=; b=LzJaZJ2yFRUojE0UHx/KesRdpmb8bUlF08jbt3v1MwV1P76sd6kx/XfLaWWJd1XlUQyr0BJFCt8DEqwDj9rVn+VkpWRIC0LP+Xu9wSr4+hzogezSxoV3rO5Ho54oN1mJO7Gu1gKyRBn4MM3AVvwRr6F1EOFybrgOE1ZkyfNPP0HM+WGG9o8i5tUOoahoWtuycuXIc41qQMCMrmh+QKS7RgdTb5Q3rvNitkg0nvjXOTpANP9VLcgkXxlO38andKvhvE3U7VQ5AoZ+zIfvDdFB8Rehfe3Rhx6eYRbJr6VDla6r9btyHJvCZFExZuO2g28G8zgZYCnUMuRsNp4WZYnU+g==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1spvKo-0000zD-Cj for bug-gnu-emacs@gnu.org; Sun, 15 Sep 2024 15:55:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Troy Brown Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 15 Sep 2024 19:55:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 73280 X-GNU-PR-Package: emacs X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.17264300753742 (code B ref -1); Sun, 15 Sep 2024 19:55:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 15 Sep 2024 19:54:35 +0000 Original-Received: from localhost ([127.0.0.1]:50553 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1spvKM-0000yI-Pg for submit@debbugs.gnu.org; Sun, 15 Sep 2024 15:54:35 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:45422) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1spvKK-0000yA-Hp for submit@debbugs.gnu.org; Sun, 15 Sep 2024 15:54:33 -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 1spvK5-0002xb-0K for bug-gnu-emacs@gnu.org; Sun, 15 Sep 2024 15:54:18 -0400 Original-Received: from mail-ed1-f52.google.com ([209.85.208.52]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1spvK3-0004ls-5k for bug-gnu-emacs@gnu.org; Sun, 15 Sep 2024 15:54:16 -0400 Original-Received: by mail-ed1-f52.google.com with SMTP id 4fb4d7f45d1cf-5c24c92f699so3977712a12.2 for ; Sun, 15 Sep 2024 12:54:14 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726430053; x=1727034853; h=cc:to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=woLfxDnR/saDsDopAlMPwQwCjDy+3oCBnrhohvTidiE=; b=aGN3fF6srsikUg5BkjqIPVKa+6Iv8CKxojNcFOXFhjYJ48xcGVJFuxnotXlqD3yIHz HdANfxufKJkUQFpKZRZ+1Xyz0zPy160XZz+7akePhPHw9kROpobnhrw30VfLd2t1UfHV CcEe8CSZROFgIDbMwfmM8G7/vlKiW7QNuyIcoofQyCE8iDQrRWa7p8Qe0g05k0B+Dun8 zheV8gYzivmqOPFZDeU6XcNoq10mI4GUqQeI7rE+4Zdy2ZfR0J+OpOKdB4ls8oLfDJb9 U23MwaB9kMwTEXIjx9MGmj7OmsK2C6pHsL3Pd9ZTPh+ykDNx6uVD6yhseztSbUFbIKWm u3Aw== X-Gm-Message-State: AOJu0Ywj092c04YZFw/8HFxMSCqc8Us+EVRFhNJC1tJgQemyJtYibpWD lrNFe968OfDM+07/v/o311QJj1WOrhB5P1VRzFrkV0xWnaWhpretKqO8JbfLTk4= X-Google-Smtp-Source: AGHT+IFgVRb7NQjmxflJyAQG1GS0G4i00aZc6w+NN89IKO8w1RWrXopMAVmABtRGEnVP9Dj6Vy8rFA== X-Received: by 2002:a50:eac9:0:b0:5c0:aad3:c8fc with SMTP id 4fb4d7f45d1cf-5c413e57b3dmr8278067a12.30.1726430052026; Sun, 15 Sep 2024 12:54:12 -0700 (PDT) Original-Received: from mail-ed1-f52.google.com (mail-ed1-f52.google.com. [209.85.208.52]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5c42bb49770sm1907505a12.12.2024.09.15.12.54.11 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 15 Sep 2024 12:54:11 -0700 (PDT) Original-Received: by mail-ed1-f52.google.com with SMTP id 4fb4d7f45d1cf-5c24c92f699so3977689a12.2 for ; Sun, 15 Sep 2024 12:54:11 -0700 (PDT) X-Received: by 2002:a05:6402:1d53:b0:5c2:7570:3a2a with SMTP id 4fb4d7f45d1cf-5c413e1ee8cmr11872350a12.17.1726430051345; Sun, 15 Sep 2024 12:54:11 -0700 (PDT) X-Gmail-Original-Message-ID: Received-SPF: pass client-ip=209.85.208.52; envelope-from=troy.s.brown@gmail.com; helo=mail-ed1-f52.google.com X-Spam_score_int: -26 X-Spam_score: -2.7 X-Spam_bar: -- X-Spam_report: (-2.7 / 5.0 requ) BAYES_00=-1.9, FREEMAIL_FORGED_FROMDOMAIN=0.001, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.25, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-1.048, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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:291866 Archived-At: 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`.