help-gnu-emacs
[Top][All Lists]
Advanced

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

Eval keymapp in a macros


From: Arthur Miller
Subject: Eval keymapp in a macros
Date: Mon, 02 Aug 2021 14:16:56 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

I am not sure what I missunderstand here, but something I do. I am
trying to test if an object is a keymap, with keymapp in a
macro. Nothing fancy, just a small wrapper around define-key function.

However, I have to use eval to actually get keymapp to do something,
while I don't need to use eval with a listp or functionp predicate.
I am not so happy about using eval in there, so I would appreciate if
someone can enlighten me what I do wrong here (probably everything :)):

#+begin_src emacs-lisp

(defmacro with-key-map (mapname &rest body)
  `(let ((map ,mapname))
     (dolist (def '(,@body))
        (define-key map
      (if (vectorp (car def)) (car def)
        (read-kbd-macro (car def)))
      (if (or (listp (cdr def))
              (functionp (cdr def)))
          (cdr def)
        (if (eval `(keymapp ,(cdr def)))
            (eval (cdr def))))))))

#+end_src



reply via email to

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