1

I have some defcustom variables that are for keymaps. Is there a way to set the :type in a defcustom to indicate it should be a keymap?

Is the right way to do it like this?

:type '(restricted-sexp :match-alternatives keymapp)
0

Almost right.

:match-alternatives needs to be a list of predicates:

:type '(restricted-sexp :match-alternatives (keymapp))

And consider maybe also allowing the value to be a keymap variable (depending on what you really want):

:type '(restricted-sexp
        :match-alternatives
        ((lambda (x)
           (or (keymapp x) ; Can be a keymap var.
               (and (symbolp x)
                    (boundp x)
                    (keymapp (symbol-value x)))))))

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.