Subject: bug#61868: 29.0.60; Eglot: setting "workspace" configurations should be easier

From: João Távora <[email-masked]>
Date: Wed, 01 Mar 2023 02:02:00 +0000

Augusto Stoffel <[email-masked]> writes:

> I see this differently.  Emacs doesn't have deeply nested namespaces for
> variables and user options.  It's all pretty flat, so there is almost
> surely never going to be a variable that is nearly as tricky to set.

Oh but no :-) there are even scary DSLs in Emacs variables.  See
project-kill-buffer-conditions for example.  And customize-variable
groks it.

In effect you want something like customize-variable, but different UI
and with support for saving to .dir-locals.el.  I sympathize with the
idea, I really do, for two distinct reasons:

* I agree learning about dir-locals.el and its relation to a project's
configuration is confusing for newcomers

* I personally get extremely confused, even intimidated, by the Custom
  UI.

So if this UI appears elsewhere, like a separate package, Eglot can take
advantage. But I'm afraid I don't like the idea of starting this in
Eglot, so it's probably not going to happen as long as I am maintainer.

> [ Incidentally, when I suggested to allow such syntax:
>
>        ((python-mode
>        . ((eglot-workspace-configuration
>            . (("pylsp.plugins.jedi_completion.include_params" . t)
>               ("pylsp.plugins.jedi_completion.fuzzy" . t)
>               ("pylsp.plugins.pylint.enabled" . :json-false))))))
>
>    you said it was un-Lispy or something, but I really think it's rather
>    the opposite.  Emacs has flat names pretty much like the above. ]

It's indeed un-Lispy, but it's not very hard to write a helper function
to turn that into a plist, is it?

>>   (defun eglot-edit-workspace-configuration () (interactive)
>>     (find-file (expand-file-name ".dir-locals.el" (project-root (project-current)))))
>>
>> My bet is that that two-liner would go a long way.
>
> No, this is not enough.  At the very least I need a history variable to
> look at the previous configurations.  This feature has to be a thing on
> top of of `eglot-show-workspace-configuration'.

That idea is the best I can offer for now.  You'd have undo for history,
which is not bad.  And Git, since it's a file after all.

João