unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Philip Kaludercic <philipk@posteo.net>
To: Eli Zaretskii <eliz@gnu.org>
Cc: jporterbugs@gmail.com,  arash@gnu.org,  emacs-devel@gnu.org,
	joaotavora@gmail.com
Subject: Re: Making `eglot-server-programs' a custom variable?
Date: Wed, 16 Nov 2022 13:05:46 +0000	[thread overview]
Message-ID: <87fsejnj6d.fsf@posteo.net> (raw)
In-Reply-To: <831qq4hyo9.fsf@gnu.org> (Eli Zaretskii's message of "Tue, 15 Nov 2022 20:15:18 +0200")

Eli Zaretskii <eliz@gnu.org> writes:

>> From: Philip Kaludercic <philipk@posteo.net>
>> Cc: jporterbugs@gmail.com,  arash@gnu.org,  emacs-devel@gnu.org,
>>   joaotavora@gmail.com
>> Date: Tue, 15 Nov 2022 17:50:25 +0000
>> 
>> > The problem is only with user options that have complex structures.
>> > Letting users edit such data structures directly is wrought with
>> > unnecessary risks, and requires users to understand very well the
>> > semantics of the data structure and the effect of every change in it.
>> 
>> Where do you draw the line to what is "complex" and what isn't?
>
> Basically, anything that is not an atom is "complex" for this purpose,
> in my book.

Ok.

>> `eglot-server-programs' is complex in the trivial sense that it is made
>> up of multiple parts, but each entry is relatively independent, and
>> pretending an element to the beginning of the list shouldn't involve any
>> unexpected surprises.
>
> Let's look at this from the user's POV, okay?
>
>   (defvar eglot-server-programs `((rust-mode . ,(eglot-alternatives '("rust-analyzer" "rls")))
> 				  (cmake-mode . ("cmake-language-server"))
> 				  (vimrc-mode . ("vim-language-server" "--stdio"))
> 				  (python-mode
> 				   . ,(eglot-alternatives
> 				       '("pylsp" "pyls" ("pyright-langserver" "--stdio") "jedi-language-server")))
> 				  ((js-json-mode json-mode) . ,(eglot-alternatives '(("vscode-json-language-server" "--stdio") ("json-languageserver" "--stdio"))))
>
> Here we have:
>
>  . a multi-level list
>  . elements that are alists
>  . a "backquote construct" with evaluated parts in 
>
> How much Lisp do we require a user to know?  Imagine a user who just
> wants to add one more server, either for an existing mode or for a new
> mode not in the list.  Do we really expect him or her to understand
> all that?

For a simple modification, it appears that 

  (add-to-list 'eglot-server-programs '(foo-mode "foo-lsp" "--stdio"))

is enough.

>> > Alternatively, it requires adding infrastructure to Custom to make
>> > these aspects safer and more easily understandable (something I'm not
>> > even sure is feasible).
>> 
>> Like `setopt' does with primitive type checking?
>
> Yes, but much more complex.  Essentially, display the above list in a
> form that is easy to understand, and allow updating it in that form.

I agree that that would be a good thing to have, but that appears to be
something that would require reworking the widget framework, right?

>> FWIW I agree that user options shouldn't be too complicated, but knowing
>> how to simplify a user option is an art in itself.
>
> Yes, but IMO we should bite that bullet every time.

Do you mean "we" as in the Emacs core developers?  Then yes, but there
are plenty of packages on ELPA that don't scrutinise themselves to the
same degree.  The reality of this complexity shouldn't just be ignored.

>> > The proliferation of user options with complex values we have
>> > currently in Emacs is a bad tendency that is at least in part due to
>> > the fact that the developers have no problems dealing with such data
>> > structures.  IMNSHO, we don't think enough about our users when we
>> > introduce such options.
>> 
>> Again, I am uncertain what you mean by complex.  Is `auto-mode-alist'
>> complex?
>
> To some extent, yes.
>
>> Or `display-buffer-alist'?
>
> Definitely!



  reply	other threads:[~2022-11-16 13:05 UTC|newest]

Thread overview: 78+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-09 20:25 Making `eglot-server-programs' a custom variable? Arash Esbati
2022-11-09 20:49 ` Philip Kaludercic
2022-11-09 22:07   ` Arash Esbati
2022-11-10 17:47     ` Philip Kaludercic
2022-11-10 17:56       ` Stefan Monnier
2022-11-10 18:10         ` Philip Kaludercic
2022-11-10 18:29           ` Stefan Monnier
2022-11-10 19:36             ` Philip Kaludercic
2022-11-12  3:47       ` Jim Porter
2022-11-12  5:16         ` chad
2022-11-12  7:26           ` Philip Kaludercic
2022-11-12  7:34         ` Philip Kaludercic
2022-11-12  7:58         ` Eli Zaretskii
2022-11-12  8:03           ` Philip Kaludercic
2022-11-12  8:25             ` Eli Zaretskii
2022-11-12  8:45               ` Philip Kaludercic
2022-11-12  9:01                 ` Eli Zaretskii
2022-11-12  9:40                   ` Philip Kaludercic
2022-11-12 10:02                     ` Eli Zaretskii
2022-11-12 13:46                       ` Philip Kaludercic
2022-11-12 14:30                         ` Eli Zaretskii
2022-11-13  0:20                           ` Philip Kaludercic
2022-11-13  6:39                             ` Eli Zaretskii
2022-11-13  7:11                               ` Philip Kaludercic
2022-11-13  7:43                                 ` Eli Zaretskii
2022-11-15 17:50                                   ` Philip Kaludercic
2022-11-15 18:15                                     ` Eli Zaretskii
2022-11-16 13:05                                       ` Philip Kaludercic [this message]
2022-11-16 13:44                                         ` Eli Zaretskii
2022-11-16 14:12                                           ` Philip Kaludercic
2022-11-16 14:51                                             ` Eli Zaretskii
2022-11-16 17:05                                               ` Philip Kaludercic
2022-11-10  6:36 ` Eli Zaretskii
2022-11-10  7:56   ` Tim Cross
2022-11-10  8:24     ` Eli Zaretskii
2022-11-10  9:34       ` Tim Cross
2022-11-10 11:16         ` Eli Zaretskii
2022-11-10 13:59           ` Tim Cross
2022-11-10  9:18   ` Arash Esbati
2022-11-10  9:34     ` Eli Zaretskii
2022-11-10 10:25       ` João Távora
2022-11-10 17:04         ` Eli Zaretskii
2022-11-10 17:10         ` Eli Zaretskii
2022-11-10 21:45           ` João Távora
2022-11-11  6:12             ` Yuri Khan
2022-11-11  9:09               ` João Távora
2022-11-12  2:34               ` Brian Cully via Emacs development discussions.
2022-11-12 16:22                 ` Michael Albinus
2022-11-11  7:04             ` Eli Zaretskii
2022-11-11  9:12               ` João Távora
2022-11-11 11:53                 ` Eli Zaretskii
2022-11-12 14:44           ` Arash Esbati
2022-11-12 14:49             ` Eli Zaretskii
2022-11-12 14:58               ` Arash Esbati
2022-11-10 21:28     ` Augusto Stoffel
2022-11-11 10:05       ` Arash Esbati
2022-11-11 12:05         ` Eli Zaretskii
2022-11-11 12:22           ` Arash Esbati
2022-11-11 12:33             ` Eli Zaretskii
2022-11-11 13:26               ` Augusto Stoffel
2022-11-11 13:48               ` Arash Esbati
2022-11-11 13:54                 ` Eli Zaretskii
2022-11-10 10:15 ` João Távora
2022-11-10 11:23   ` Eli Zaretskii
2022-11-10 12:07     ` João Távora
2022-11-10 15:19       ` Eli Zaretskii
2022-11-10 15:35         ` Dmitry Gutov
2022-11-10 16:50           ` Eli Zaretskii
2022-11-10 18:22             ` Dmitry Gutov
2022-11-10 18:31               ` Eli Zaretskii
2022-11-10 15:38         ` João Távora
2022-11-10 16:52           ` Eli Zaretskii
2022-11-10 17:08           ` Eli Zaretskii
2022-11-10 21:13             ` João Távora
2022-11-10 13:57   ` Stefan Monnier
2022-11-10 15:21     ` João Távora
2022-11-10 17:43       ` Stefan Monnier
2022-11-10 22:10         ` João Távora

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87fsejnj6d.fsf@posteo.net \
    --to=philipk@posteo.net \
    --cc=arash@gnu.org \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=joaotavora@gmail.com \
    --cc=jporterbugs@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).