From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Tassilo Horn Newsgroups: gmane.emacs.help Subject: Re: Customization list Date: Fri, 12 Jul 2024 13:47:08 +0200 Message-ID: <87seweessj.fsf@gnu.org> References: Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="18890"; mail-complaints-to="usenet@ciao.gmane.io" Cc: help-gnu-emacs@gnu.org To: Ergus Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Fri Jul 12 13:47:49 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 1sSEke-0004iW-6N for geh-help-gnu-emacs@m.gmane-mx.org; Fri, 12 Jul 2024 13:47:48 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sSEk8-0005J4-E5; Fri, 12 Jul 2024 07:47:16 -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 1sSEk4-0005Im-C0 for help-gnu-emacs@gnu.org; Fri, 12 Jul 2024 07:47:12 -0400 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 1sSEk3-0007bS-UO; Fri, 12 Jul 2024 07:47:12 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:Date:References:In-Reply-To:Subject:To: From; bh=MEeBi1QpQO6iDdcdmT8Yt6jObHTAeYzmi8CpVYKayfU=; b=CjXdzrgov4p9zFU37RVk eL6COja1K77tkNXjTKQBACOJoVwsDL1NJH5pZKdr/73p11zd0ietes9g3esjEWbg6XkRoX5kBia6o k9IQIAhOGPSCK8wz24H2slJgtd18jGM3G3CqZv+KUAYxq7IZhRBAOmf1vw6TdeqhQS7UE0FsH8b34 6xhtdZvg2jB43lst84s81oNoQqWOM1ZSuIIgkLY/jpXw+5f74xpbDZ4aYrWEFM8TzEuc9j7gfmqtk 2y0GtMJU7yeNQTU/Q7wKjD4XClOaJOF1x+V31ZrGrblnVkcrg32Ehhjm7lMEsE/xdTOBvKkJN7yCz tBb6QYGrFjZ36w==; X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeftddrfeeigdeflecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecunecujfgurhephffvvefujghffffkgggtsehttdertd dttddtnecuhfhrohhmpefvrghsshhilhhoucfjohhrnhcuoehtshguhhesghhnuhdrohhr gheqnecuggftrfgrthhtvghrnhepteeltdegheffhfetkeekveekkeevgfegkeetueffle eiheekhffgffeuueegieffnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehm rghilhhfrhhomhepthhhohhrnhdomhgvshhmthhprghuthhhphgvrhhsohhnrghlihhthi dqkeeijeefkeejkeegqdeifeehvdelkedqthhsughhpeepghhnuhdrohhrghesfhgrshht mhgrihhlrdhfmh X-ME-Proxy: Feedback-ID: ib2b94485:Fastmail In-Reply-To: (Ergus's message of "Fri, 12 Jul 2024 12:59:01 +0200") 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:147155 Archived-At: 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. 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