Subject: bug#73280: 30.0.90; Eglot: eglot-workspace-configuration might not be found in .dir-locals.el

From: Stefan Monnier <[email-masked]>
Date: Mon, 16 Sep 2024 17:34:45 -0400

>> ```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)))
>> ```

This code is indeed hackish/heuristic by nature.

I guess the reason for it is that it needs to work regardless of the
buffers that use that server (which could all use different major
modes).

Alternatives:

- Get `eglot-workspace-configuration` "once and for all" when starting
  the server, using the major mode currently active the buffer from
  which the server's launch was triggered.
- Collect all the buffers currently using that server, take the set of
  modes they currently use, fetch the corresponding
  `eglot-workspace-configuration` values, and "merge them" (and if they
  disagree, maybe emit a warning?).

But in the mean time, it seems `eglot-workspace-configuration` was
designed so that you can have a single setting shared for all modes, as
João mentions, so using nil (or `prog-mode`) instead of `ada-mode` or
`ada-ts-mode` seems like the better option.

        Stefan