unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Eval keymapp in a macros
@ 2021-08-02 12:16 Arthur Miller
  2021-08-02 20:33 ` Michael Heerdegen
  0 siblings, 1 reply; 22+ messages in thread
From: Arthur Miller @ 2021-08-02 12:16 UTC (permalink / raw)
  To: help-gnu-emacs


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



^ permalink raw reply	[flat|nested] 22+ messages in thread

end of thread, other threads:[~2021-08-12 20:28 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-08-02 12:16 Eval keymapp in a macros Arthur Miller
2021-08-02 20:33 ` Michael Heerdegen
2021-08-02 20:53   ` [External] : " Drew Adams
2021-08-03 21:20   ` Arthur Miller
2021-08-04  0:18     ` Michael Heerdegen
2021-08-04 10:52       ` Arthur Miller
2021-08-04 23:56         ` Michael Heerdegen
2021-08-05  6:03           ` Arthur Miller
2021-08-06  3:54             ` Michael Heerdegen
2021-08-12 20:28               ` Arthur Miller
2021-08-04  4:54     ` Yuri Khan
2021-08-04  9:38       ` Arthur Miller
2021-08-04 15:37         ` Stefan Monnier via Users list for the GNU Emacs text editor
2021-08-05  6:12           ` Arthur Miller
2021-08-05 13:53             ` Stefan Monnier
2021-08-05 16:04               ` Arthur Miller
2021-08-05 16:34                 ` Stefan Monnier
2021-08-06  4:17                   ` Michael Heerdegen
2021-08-12 20:21                     ` Arthur Miller
2021-08-05  0:03         ` Michael Heerdegen
2021-08-05  6:15           ` Arthur Miller
2021-08-06  3:18             ` Michael Heerdegen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).