[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#18729: [PATCH] subr.el (set-key): New macro making creating new bind
From: |
Stefan Monnier |
Subject: |
bug#18729: [PATCH] subr.el (set-key): New macro making creating new bindings more concise. |
Date: |
Wed, 15 Oct 2014 10:20:33 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.4.50 (gnu/linux) |
> +(defmacro set-key (keymap key &rest def)
I'm not convinced the added complexity is worth the trouble, I'm afraid.
I don't see a real benefit in
(set-key :global KEY CMD)
(set-key :local KEY CMD)
(set-key MAP KEY CMD)
over
(global-set-key KEY CMD)
(local-set-key KEY CMD)
(define-key MAP KEY CMD)
or
(define-key global-map KEY CMD)
(define-key (current-local-map) KEY CMD)
(define-key MAP KEY CMD)
I also don't see the benefit of (:args ARGS INTERACTIVE . BODY)
over (lambda ARGS (interactive INTERACTIVE) . BODY).
The only thing I think is really valuable is things like
(set-key ... KEY (dired "foo"))
For which there is also a precedent in easy-define-menu (where the CMD
can be either a symbol or an expression, in which case that expression
gets wrapped in (lambda () (interactive) ...)).
Maybe we could simply extend define-key to accept
(define-key MAP KEY '(dired "foo"))
-- Stefan