From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: =?utf-8?B?Sm/Do28gVMOhdm9yYQ==?= Newsgroups: gmane.emacs.devel Subject: Re: Making `eglot-server-programs' a custom variable? Date: Thu, 10 Nov 2022 15:38:32 +0000 Message-ID: <874jv6akg7.fsf@gmail.com> References: <86fservpri.fsf@gnu.org> <83v8nnqchr.fsf@gnu.org> <83sfiqrg5g.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="22820"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: arash@gnu.org, theophilusx@gmail.com, emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu Nov 10 16:37:54 2022 Return-path: Envelope-to: ged-emacs-devel@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 1ot9cn-0005lX-RT for ged-emacs-devel@m.gmane-mx.org; Thu, 10 Nov 2022 16:37:53 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ot9cV-0003jv-Ed; Thu, 10 Nov 2022 10:37:36 -0500 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 1ot9cH-0003h4-E4 for emacs-devel@gnu.org; Thu, 10 Nov 2022 10:37:24 -0500 Original-Received: from mail-wr1-x433.google.com ([2a00:1450:4864:20::433]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ot9cF-0008S3-Pw; Thu, 10 Nov 2022 10:37:21 -0500 Original-Received: by mail-wr1-x433.google.com with SMTP id bk15so2779292wrb.13; Thu, 10 Nov 2022 07:37:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:user-agent:message-id:date :references:in-reply-to:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=MSlHaBt48AwuNUIXk2N/cam84szX+yEMZpzut1QZW9I=; b=gNn1xbQ5rIKk8mSgwH5tIXzHMr1J+WF4MzVcbkEkVQ2IJdNpaev19Fx72PWGwvqOao hWCwpwfeWOKhFD3zrdnRTuEISEtqjRdddjtGEOJclNlFxmPPNQd5na959xM3/UDUCfQx LoOJdAR/qaOqQn88ASPlZpAXVRTA+/j0kC8jV0sjEw/QisFCT/8cutR/NH4j858qqO0A MP2qVkK/aR9rPSAQOk7JhpZrDnRjRFcYcNz7FpMajyDf3WDke5Fqi7itCEUO+CwM8U3F imv0diVZCL+UC5Oj7wJFQemierCrJY2rxMFZQuiJM7gsCiuIv5uvLsgOOoEiN+iuF3ua rMvg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:user-agent:message-id:date :references:in-reply-to:subject:cc:to:from:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=MSlHaBt48AwuNUIXk2N/cam84szX+yEMZpzut1QZW9I=; b=gZAfs337FedJJmbjT/mC50qEkwtMeGBzD9grPzC2pj07xis+6jGIoRMTRgv9EB9kxi tbNaOCNZF80Ihms9lYQWAYPkYR39TMHMPFQ07ZwlQgkTArYhNANmTeOgnylaJanI8Ur0 Ncnnol6ht4/XoVEY2sAJt5uhIM5cz/cTgXFNovXiY/GlfQL8Icr2sv4Al3drpeWKof+N LdQuxXAjgq7jwMUiSjkIhf7GCm6Iy4M6kyazME3r7kEka+s3mCYcOnpR1/P0AKJS2mHO kzwiBUgZFZfMBjulZrISNNwpv2h5CkKHZjMgrsQKjLAa6Z9l2t5VRY5Uwuexpz1KG36X Vagg== X-Gm-Message-State: ACrzQf1De4Bty+SYd8G67R2xLmzRpiBeTa7K7XNO57IcbOU/iiOFy+U4 +H0dhmGhcfqLhn+DbKGsWCKec2AAnKY= X-Google-Smtp-Source: AMsMyM6RuhHzKZqt6+fmDxZcMWKMG9qMAqdQPUc7kpnuKeOLVYahSHos13H6hOm1Tlu2rE/m0wyRIA== X-Received: by 2002:a5d:4604:0:b0:236:cfce:879d with SMTP id t4-20020a5d4604000000b00236cfce879dmr34194104wrq.152.1668094636963; Thu, 10 Nov 2022 07:37:16 -0800 (PST) Original-Received: from krug ([87.196.81.1]) by smtp.gmail.com with ESMTPSA id u18-20020a05600c19d200b003c6f8d30e40sm6091996wmq.31.2022.11.10.07.37.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Nov 2022 07:37:16 -0800 (PST) In-Reply-To: <83sfiqrg5g.fsf@gnu.org> (Eli Zaretskii's message of "Thu, 10 Nov 2022 17:19:23 +0200") Received-SPF: pass client-ip=2a00:1450:4864:20::433; envelope-from=joaotavora@gmail.com; helo=mail-wr1-x433.google.com X-Spam_score_int: -10 X-Spam_score: -1.1 X-Spam_bar: - X-Spam_report: (-1.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, FREEMAIL_REPLY=1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:299495 Archived-At: Eli Zaretskii writes: >> From: Jo=C3=A3o T=C3=A1vora >> Date: Thu, 10 Nov 2022 12:07:30 +0000 >> Cc: arash@gnu.org, theophilusx@gmail.com, emacs-devel@gnu.org >>=20 >> > That said, I have no objection to converting eglot-server-programs in= to >> > a defcustom, if someone will commit to translating and maintaining all >> > the complex combination of options into "widget" form. I don't have = the=20 >> > time or inclination for this task, but maybe someone has. >>=20 >> It is not a good idea to have a defcustom whose value should be such a >> complex data structure.=20 >>=20 >> I agree, but a command is a not a solution IMO: this belongs in the=20 >> user's configuration file.=20 > > ??? The user init file can call the command, cannot it? Yeah, but then why make it a command, i.e. an interactive function? If whatever you're proposing is going to be called interactively, it won't persist through sessions. So if you're proposing a simple function, I think there's no need to for a function that simply calls add-to-list. > And adding a command is not a replacement for having a variable: > people who know enough Lisp can do what they want with the variable. > The command is proposed as a replacement for a defcustom, because > interactively customizing such a complex variable with a very long > value is problematic at best. Again I cannot see the point of a interactive command. If you mean a simple non-interactive function to be called from the user's init file, I can't see much advantage of using that over using add-to-list, other than auto-loading. And auto-loading isn't necessarily an advantage: I break out many Emacs sessions where I don't M-x eglot at all. with-eval-after-load is the tool for the job here. >> A good docstring (can it be improved?) containing good descriptions=20 >> and some ready-made recipes is the current and best approach to these=20 >> things. > > Sorry, but I disagree. No doc string can reasonably teach users > advanced Lisp. That's a non-starter. Funny, that's how I learned all my Elisp until I learned of the Elisp manual a few years ago. And this is not "advanced" stuff at all. This is all that's needed: diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el index 204121045a0..a6df8371425 100644 --- a/lisp/progmodes/eglot.el +++ b/lisp/progmodes/eglot.el @@ -298,7 +298,10 @@ eglot-server-programs the call is interactive, the function can ask the user for hints on finding the required programs, etc. Otherwise, it should not ask the user for any input, and return nil or signal - an error if it can't produce a valid CONTACT.") + an error if it can't produce a valid CONTACT. This option can + be combined with the helper function + `eglot-alternatives' (which see) to define more than one + alternative server for a given MAJOR-MODE.") =20 (defface eglot-highlight-symbol-face '((t (:inherit bold))) Throwing in an example 3-line snippet in the manual for eglot-alternatives is also fine: (with-eval-after-load 'eglot (add-to-list 'eglot-server-programs `(foo-mode . ,(eglot-alternatives '("fools" ("bazls" "--foo"))))))