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.
Emacs Stack Exchange is a question and answer site for those using, extending or developing Emacs. It only takes a minute to sign up.
Sign up to join this communityI 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.
set
handler is also called! Any idea why?
– AdrieanKhisbe
Sep 21 '17 at 21:11
fboundp' in one place, instead of
boundp'.
– Drew
Sep 21 '17 at 23:11