[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Make a defcustom dependent on another variable

From: Joost Kremers
Subject: Make a defcustom dependent on another variable
Date: 19 Mar 2014 23:05:21 GMT
User-agent: slrn/pre1.0.0-18 (Linux)

Hi all,

Defining a custom variable that can have one of (e.g.,) two values is

(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))

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.



Joost Kremers                                   address@hidden
Selbst in die Unterwelt dringt durch Spalten Licht

reply via email to

[Prev in Thread] Current Thread [Next in Thread]