I have a defcustom
with :type
variable
,
and I would like to constrain the variable name to comply to a pattern.
How would I do that?
for instance let say I want the custom to only accept a variable name starting with some prefix.
I have a defcustom
with :type
variable
,
and I would like to constrain the variable name to comply to a pattern.
How would I do that?
for instance let say I want the custom to only accept a variable name starting with some prefix.
Don't use type variable
. Use type restricted-sexp
.
The predicate checks for a symbolp
that is boundp
(i.e., a variable) and whose symbol-name
is matched by your chosen prefix.
See the Elisp manual, node Composite Types.