From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Ergus Newsgroups: gmane.emacs.help Subject: Re: Customization list Date: Fri, 12 Jul 2024 21:15:29 +0200 Message-ID: References: <87seweessj.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="29621"; mail-complaints-to="usenet@ciao.gmane.io" Cc: help-gnu-emacs@gnu.org To: Tassilo Horn Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Fri Jul 12 21:16:43 2024 Return-path: Envelope-to: geh-help-gnu-emacs@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 1sSLl3-0007W1-Eq for geh-help-gnu-emacs@m.gmane-mx.org; Fri, 12 Jul 2024 21:16:41 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sSLkI-0001e5-BB; Fri, 12 Jul 2024 15:15:54 -0400 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 1sSLkF-0001d6-MK for help-gnu-emacs@gnu.org; Fri, 12 Jul 2024 15:15:52 -0400 Original-Received: from sonic304-10.consmr.mail.bf2.yahoo.com ([74.6.128.33]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sSLk0-0001ZT-Cl for help-gnu-emacs@gnu.org; Fri, 12 Jul 2024 15:15:51 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aol.com; s=a2048; t=1720811734; bh=y0/4Shn9jYpRomePVs050ZphPSC8hC7sB5At1lidMBw=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From:Subject:Reply-To; b=KCxwcBNKJ01796FUD9IrtHfuHzwANBQutqq4D9/IqlkPoXoNjLJ9/8/Keh/jQPwbvABcKrl3K6+koLN28Tad6JL1gVhrTH9fB6gDpgnIeXk2kaV5/P0YAi8xLvPU2PTcN6yyu8p3VqbKaGTklIBZHFiNc33HEtGbxzXkCS4vYiUHoUwbxmXTQXNfwOTz7rKs0i5bdZWOwbcEt6ngF7LmNtFEHEX4Eg4f2TfipKnjAuTWBZwGKbPSyohSboTSMJZW7zbnRVv+cHbJU707WcnK7M/SeBugCCFSFCVdtG2VgENrSFZmdOhZJ32RoYMive4WKtYbU9rPSSksXGtL5W2NLg== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1720811734; bh=KWjdh4HqkeAU/sJbUNR3vVA1IgTQdfk330MHI3O6+bg=; h=X-Sonic-MF:Date:From:To:Subject:From:Subject; b=tmGe/oqQkaKv7jknjuOcMFFadhozBs9Py8DB5mo4V3GW6kG7wg+MSHVbCQ3MAZD3dXa0fJVLbzhnVaFk0IfUZkmKgvdZR5IRNeB6XCoYlupTIbx/0uAX09Ebgk2IzITEi80/czac6Jsiw0wAERvg4LvJHbtcYa59gv1udqORsdhCxVVYjJKkh9FyaHi8ydVPHCau8XSaqS12xvBwMGS93nSzKsDsgnhqxxfYVugqZL8EMu5xVVbndQSQ4nR0kveinUOG/LScVpqybMV+qNEUuPLSDsxQytQGTL09cmKAWJf95YmWdnoWDu48o7aYKOid3OYM8ZY2sRtGRaOfMDE28A== X-YMail-OSG: oQoANl4VM1mnFQF2be8vWquGKFfeKEhtjhFOWsyBHDS.RMWRGTBsTaoT.vzzukZ Mum2n8t6aTIotqpg.6O1nfN_itvWGHwts4PMNVv1aQxKxmTwi3tjxmQJRWVXTdbKN7iuimIKtTcu Jy2CON.s54u26GgUaYNm_Br6lMLS3z5s5FvMz70uXw3tBF0Nwx3iKpqUClSyUhIj6dBdiDPMmaUk c8lxlf3zw2v44MVbZ6Md_7XVtRqyM0gcx_LTlKiF3cr28d7sJ0dlIKHdwcKSbc7WYUjHdPIcpsw1 UEfn4MNMHniL_stAmXIeHtF6Uq3SNi6OxxtWzIWzRcAluLXWDjpQsftlbpl5eTiJgUoMWKI88aIk Zpta5wiA3Edyp36REBqPml8.UzXI6FvICyGulmBLjm2q7UkWO8cF5oVy7dQIopklONoMfGAGfk_e j2qSDnLpSUSmELbA71ltAwhbzSf0NG_UHQ2EtuZgN4VT5X.cQYzpqhTDUw5Tmndeglvsdu.g0SwA NFrAHzb9MoePMn3wJXVvtsyj0zvodHSx6Qe1O8928h3yS1g7ewY.hkiHabRhVKpI8zbmLMqoGHmk u1GV91c2pSW1wu9m4OlPuOBIH1i8vehjdqc8iS77ykyyVhl.Dx8Y7UTgGv7mu4AfDKT_JEsBWdzI oaQ6dbKE8GputYaIFYCFmjxX7JZabzkcirSs3wQnYRJEG_KrQADozWUxK2Bqh7pd2XjVhQcFdwTn .yZWNu8mTEv_Xl1mSbK7.nA66GK6BVUHWz4OJ.iYejfeXQEsaMbWoSRC.Xgl8l5.pzGP4Qc8zO6M C.E151Kuuy2zaULe_nf_nKiSGU6BqUt7arTsGartkC X-Sonic-MF: X-Sonic-ID: 75b1fca3-e4d1-4f97-b073-b848d86cf433 Original-Received: from sonic.gate.mail.ne1.yahoo.com by sonic304.consmr.mail.bf2.yahoo.com with HTTP; Fri, 12 Jul 2024 19:15:34 +0000 Original-Received: by hermes--production-ir2-57d49df6b5-mh5k6 (Yahoo Inc. Hermes SMTP Server) with ESMTPA ID 4b27ac0f3081d43a27b68d853de68b3e; Fri, 12 Jul 2024 19:15:31 +0000 (UTC) Content-Disposition: inline In-Reply-To: <87seweessj.fsf@gnu.org> X-Mailer: WebService/1.1.22501 mail.backend.jedi.jws.acl:role.jedi.acl.token.atz.jws.hermes.aol Received-SPF: pass client-ip=74.6.128.33; envelope-from=spacibba@aol.com; helo=sonic304-10.consmr.mail.bf2.yahoo.com X-Spam_score_int: -16 X-Spam_score: -1.7 X-Spam_bar: - X-Spam_report: (-1.7 / 5.0 requ) BAYES_00=-1.9, DKIM_INVALID=0.1, DKIM_SIGNED=0.1, FREEMAIL_FROM=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.help:147179 Archived-At: Hi Tassilo: On Fri, Jul 12, 2024 at 01:47:08PM GMT, Tassilo Horn wrote: >Ergus writes: > >> Hi: >> >> After some years in emacs I still have issues when creating >> customization variables: >> >> The examples in the documentation are very simple, but getting some >> typical simple behaviors is a bit hard to get from them. >> >> Suppose I have a variable: >> >> (defcustom my-features '(feature1 feature2 feature3) >> :type ???) >> >> This is a variable that may have a list of possible determined values, >> so I was expecting to get something like this in the customization menu: >> >> [x] feature1 >> [x] feature2 >> [x] feature3 >> [ ] feature4 >> [ ] feature5 > >Hm, the checkboxiest I can get is > >--8<---------------cut here---------------start------------->8--- >(defcustom th/foo nil > "My docstring." > :type '(alist :key-type symbol > :value-type boolean > :options (feature1 feature2 feature3))) >--8<---------------cut here---------------end--------------->8--- > >which looks like > >--8<---------------cut here---------------start------------->8--- >Hide Th Foo: >Alist: >[X] Key: feature1 > Boolean: Toggle on (non-nil) >[ ] Key: feature2 > Boolean: Toggle off (nil) >[X] Key: feature3 > Boolean: Toggle on (non-nil) >INS > State : EDITED, shown value does not take effect until you set or save it. > My docstring. >--8<---------------cut here---------------end--------------->8--- > >but then the value looks like > > ((feature1 . t) (feature3 . t)) > >and you must both activate each feature and toggle its value to t >(non-nil) but that might be good enough. > Indeed, this may work. I am a bit surprised that such simple and useful thing requires such extra work and doesn't exist already. Also I am not a big fan of alists, but as you said, this may be good enough, or at least what we have and have to live with. The idea of having '(feature1 feature2 feature3) was to simplify also the manual configuration in the init.el, make it intuitive, simpler to explain in the doc, but also easier to write and undertsand than an alist. Also simpler to use in the code with a simple memq. Hopefully there is something already set that could produce my desired effect. Actually I saw that there is the tab-bar-select-tab-modifiers which looks like what I want, but the code uses a set and a custom-initialize-default and a lambda in the :set key Hopefully Juri will comment something ;) Very thanks in advance, Ergus >I think what you actually want is an extension to repeat with :options, >e.g., (repeat symbol :options (feature1 feature2 feature3)). > >Another way would be: > >--8<---------------cut here---------------start------------->8--- >(defcustom th/foo nil > "My docstring." > :type '(repeat (choice (const feature1) > (const feature2) > (const feature3)))) >--8<---------------cut here---------------end--------------->8--- > >which looks like > >--8<---------------cut here---------------start------------->8--- >Hide Th Foo: >Repeat: >INS DEL Choice: Value Menu feature1 >INS DEL Choice: Value Menu feature3 >INS > State : SET for current session only. > My docstring. >--8<---------------cut here---------------end--------------->8--- > >and given the wanted value: (feature1 feature3). Of course, then you >are allowed to specify each feature many times... > >Bye, > Tassilo >