From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: Making `eglot-server-programs' a custom variable? Date: Sat, 12 Nov 2022 16:30:19 +0200 Message-ID: <83r0y8meis.fsf@gnu.org> References: <86fservpri.fsf@gnu.org> <87cz9v97lo.fsf@posteo.net> <86r0yb234t.fsf@gnu.org> <87o7te7lc7.fsf@posteo.net> <83sfioob7s.fsf@gnu.org> <87wn80zjiw.fsf@posteo.net> <83leogo9yw.fsf@gnu.org> <87r0y8zhl9.fsf@posteo.net> <83k040o8an.fsf@gnu.org> <87mt8wzf20.fsf@posteo.net> <83edu8o5gw.fsf@gnu.org> <878rkgz3nj.fsf@posteo.net> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="33378"; mail-complaints-to="usenet@ciao.gmane.io" Cc: jporterbugs@gmail.com, arash@gnu.org, emacs-devel@gnu.org, joaotavora@gmail.com To: Philip Kaludercic Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sat Nov 12 15:30:58 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 1otrX7-0008X0-Bv for ged-emacs-devel@m.gmane-mx.org; Sat, 12 Nov 2022 15:30:57 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1otrWY-0001w9-8K; Sat, 12 Nov 2022 09:30:22 -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 1otrWW-0001tt-Nb for emacs-devel@gnu.org; Sat, 12 Nov 2022 09:30:20 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1otrWW-0004Xn-Dx; Sat, 12 Nov 2022 09:30:20 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=JsBuahI3IhkJQy0fbSL/yg/juWGYStultTyNgtm5h18=; b=JvsbAMO0so69 msFBXQJMLez7QnnSMpcjr61jxJSR2LB9C2xmUvlQvGiA5DmO7UZTsSvsjG9R453dkCiP5zLmmKatx J+uydpXO3ypuSIq8O/8BWMY01ksKZWv91jVQ4spgfcltvUG/LWVSFYUAT1yS2W9Kim82M8s88zHP0 Fs6oqloQJQJyT4N+uBm7vAEdZ1nACY7vH+/W279RqjU7xGxSWdj4nLr3wxFrGEkAs4zrSeBylN2U3 tqIH1o4iI49tEGW4RIvE6PhLtU6E+rcfVeIMuw0hf5pydGc0/Y6toaxchIa6/yWtxtJjDJJrnWCMj 5T0+HbXJxTGs1nBLTLS4FQ==; Original-Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1otrWR-0002d2-UH; Sat, 12 Nov 2022 09:30:17 -0500 In-Reply-To: <878rkgz3nj.fsf@posteo.net> (message from Philip Kaludercic on Sat, 12 Nov 2022 13:46:40 +0000) 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:299655 Archived-At: > From: Philip Kaludercic > Cc: jporterbugs@gmail.com, arash@gnu.org, emacs-devel@gnu.org, > joaotavora@gmail.com > Date: Sat, 12 Nov 2022 13:46:40 +0000 > > >> (I'm not just talking about Eglot right now) If the default value is > >> defined in an non-autoloaded variable, you have to load the library to > >> access the value -- otherwise it simply wasn't loaded. > >> > >> The "issue" here is just that loading everything you want to modify > >> during initialisation can get slow. > > > > Whether or not it is necessary to load the library depends on how the > > :set function of the defcustom is implemented. I can see several ways > > of implementing it that won't require loading the library right away, > > and I'm sure you can see those ways as well. > > Actually no, I am not sure I do. Any way that stored the changes of the variable's value in a data structure whose execution is deferred to when the library is first loaded. This includes ` backquoted forms, eval-after-load, mode hooks, etc. > > To me, this says that storing the value in a defcustom hits that > > "issue" to which you were alluding, and for which I proposed a > > solution of having the defcustom be an add-on to the baseline value. > > I see. The issue is that if I just set the user option directly, say > even before loading the library I overwrite the default value. Once again, I'm talking about the user option being used to _augment_ the default value of a variable. Such a user option should by default have a nil value, so setting the value of the option doesn't overwrite the baseline value of the variable which the option will augment. I feel there's a misunderstanding here, because I don't see why these obvious aspects need to be explained. So let me provide an example as a possible clarification. Under my proposal, the variable eglot-server-programs remains a defvar, and contains the baseline list of the servers. To customize the list, users change the value of a separate user option, say, eglot-user-server-programs. This user option's value is nil by default, and it allows users to specify both additions of servers to the baseline value of eglot-server-programs and removal of servers from that value. The :set function of eglot-user-server-programs then takes care of doing whatever is needed to make sure that the value of eglot-server-programs is modified according to eglot-user-server-programs's value when Eglot is started. > >> Maybe I have missed something, if a user option has a `repeat' or > >> `alist' type, you can't just say "append this and that value to the end > >> of some other value". All you get to modify is the entire list, and all > >> you get to store is the entire list. > > > > That's a job for the :set function of the defcustom. > > I am not sure I know what you are thinking of, but wouldn't this mean > all user options that have already been marked as having a `repeat' or > `alist' type, that these would now require an additional :set function? No, of course not. I didn't mean any changes to the infrastructure that we use for Customize and user options in general. See above, I hope I now explained what I had in mind.