From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Joost Kremers Newsgroups: gmane.emacs.help Subject: Make a defcustom dependent on another variable Date: 19 Mar 2014 23:05:21 GMT Message-ID: NNTP-Posting-Host: plane.gmane.org X-Trace: ger.gmane.org 1395270610 3294 80.91.229.3 (19 Mar 2014 23:10:10 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 19 Mar 2014 23:10:10 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Mar 20 00:10:20 2014 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1WQPco-0008MW-SB for geh-help-gnu-emacs@m.gmane.org; Thu, 20 Mar 2014 00:10:18 +0100 Original-Received: from localhost ([::1]:44165 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WQPco-0001i8-Cl for geh-help-gnu-emacs@m.gmane.org; Wed, 19 Mar 2014 19:10:18 -0400 Original-Path: usenet.stanford.edu!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 37 Original-X-Trace: individual.net EQJubIbFqd7AB5UQfJHKOQ0Rf6pzq27Bkl59ibf208uOyV//oI Cancel-Lock: sha1:9dzXH2cRUJwn2SmClYwZy4cJr2M= User-Agent: slrn/pre1.0.0-18 (Linux) Original-Xref: usenet.stanford.edu gnu.emacs.help:204368 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 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.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:96639 Archived-At: Hi all, Defining a custom variable that can have one of (e.g.,) two values is easy: (defcustom some-option 'value1 "Doc string" :group 'some-group :type '(choice (const value1) (const value2))) However, what if the possible values `some-option' can take are defined in another variable? Is it ok to do something like the following: (defcustom some-option 'value1 "Doc string" :group 'some-group :type '(choice ,@(mapcar #'(lambda (x) `(const ,x)) some-option-list))) where `some-option-list' is a variable holding a list of possible values for `some-option'. The code seems to work (the resulting customisation option works), but I was wondering a) if there are any hidden problems I'm not aware of; and b) if there is a more canonical way of doing this. TIA Joost -- Joost Kremers joostkremers@fastmail.fm Selbst in die Unterwelt dringt durch Spalten Licht EN:SiS(9)