GNU bug report logs - #74334
29.4; Eglot ignores locally set configuration

Previous Next

Package: emacs;

Reported by: Acid Bong <acidbong <at> tilde.club>

Date: Wed, 13 Nov 2024 02:02:01 UTC

Severity: normal

Found in version 29.4

Done: João Távora <joaotavora <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: "Acid Bong" <acidbong <at> tilde.club>
To: 74334 <at> debbugs.gnu.org
Cc: joaotavora <at> gmail.com
Subject: bug#74334: 29.4; Eglot ignores locally set configuration
Date: Wed, 13 Nov 2024 08:03:42 +0000
Ight, Joao, you accidentally created a new report, but i'll answer your questions under the original one.

> What is the '...'preceding your excerpt of a structure?

This is short for "other files that don't matter". Here's my repo
(https://codeberg.org/acidbong/nixos/src/commit/2d0eec312d83db0c685aa6de184d0477b0bf2041),
where I pushed my current state. The Cargo project is under /pkgs/rsblocks,
including .dir-locals.el.

> Where are you executing C-h v? What file are you M-x eglot'int in?
> Where are you running M-x eglot-show-worspace-configuration?

I'll describe all my actions:

1. open Emacs, it's in *scratch* and in ~:
  - `eglot-workspace-configuration` is empty

2. `C-x p f ~/.config/nixos/pkgs/rsblocks/src/main.rs`:
  - `e-w-c` (i'm abbreviating now, if you don't mind) now follows the content
    in .dir-locals.el

3. `M-x eglot` in that exact main.rs:
  - rust-analyzer complains that it can't find the workspace:
```
[eglot] Server reports (type=1): Failed to discover workspace.
Consider adding the `Cargo.toml` of the workspace to the [`linkedProjects`](https://rust-analyzer.github.io/manual.html#rust-analyzer.linkedProjects) setting.

Failed to load workspaces.
```
  - `eglot-show-w-c` shows "null"

4. Go back to the *scratch*, type in (setq-default eglot-workspace-configuration '(that value))
   and evaluate it with `C-x C-e`. Now the config is set globally.

5. Back to main.rs and `M-x eglot` once more:
  - it launches and loads successfully
  - `eglot-show-w-c` shows the config in JSON, and the config looks correct:
```
{
  "rust-analyzer": {
    "linkedProjects": [
      "pkgs/rsblocks/Cargo.toml"
    ]
  }
}
```

> What does M-: (project-current) RET show?

(vc Git "~/.config/nixos") ;; this is where I store my NixOS config

> All these commands are highly dependent on context, so I think it's best if you
> show a full recipe from Emacs -Q to clear these doubts.

I could replicate it with `emacs -Q`.


Speaking of `project-current`: I tried to follow the advices from
https://github.com/joaotavora/eglot/discussions/687 and add "Cargo.toml"
and "Cargo.lock" to `project-vc-extra-root-markers`, but `M-: (project-current)`
still shows "~/.config/nixos". Looks like project.el can't recognize nested
projects (both 0.9.8 and 0.11.0), but that's a whole different issue I don't care about.




This bug report was last modified 269 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.