summaryrefslogtreecommitdiff
path: root/lisp/keymap.el
diff options
context:
space:
mode:
authorLars Ingebrigtsen <larsi@gnus.org>2021-11-30 00:13:47 +0100
committerLars Ingebrigtsen <larsi@gnus.org>2021-11-30 00:13:47 +0100
commit1bd7b5dd5165d8ac70870b1c69701183befa868a (patch)
treeb16ac98f94c785762664a9a3cead08e249f1de0b /lisp/keymap.el
parent1efc14561d6ec735cd35ac5e8124c4c244b1f1a2 (diff)
downloademacs-1bd7b5dd5165d8ac70870b1c69701183befa868a.tar.gz
Fix some of the argument handling in keymap-set and keymap-substitute
* lisp/keymap.el (keymap-set): Fix handling of binding one key to another key. (keymap-substitute): Fix confusion in implementation -- the args are definitions, not keys.
Diffstat (limited to 'lisp/keymap.el')
-rw-r--r--lisp/keymap.el11
1 files changed, 5 insertions, 6 deletions
diff --git a/lisp/keymap.el b/lisp/keymap.el
index 770a6ed20d1..07e43c37b36 100644
--- a/lisp/keymap.el
+++ b/lisp/keymap.el
@@ -58,6 +58,11 @@ DEFINITION is anything that can be a key's definition:
(See info node `(elisp)Extended Menu Items'.)"
(declare (compiler-macro (lambda (form) (keymap--compile-check key) form)))
(keymap--check key)
+ ;; If we're binding this key to another key, then parse that other
+ ;; key, too.
+ (when (stringp definition)
+ (keymap--check definition)
+ (setq definition (key-parse definition)))
(define-key keymap (key-parse key) definition))
(defun keymap-global-set (key command)
@@ -143,8 +148,6 @@ If you don't specify OLDMAP, you can usually get the same results
in a cleaner way with command remapping, like this:
(define-key KEYMAP [remap OLDDEF] NEWDEF)
\n(fn OLDDEF NEWDEF KEYMAP &optional OLDMAP)"
- (declare (compiler-macro
- (lambda (form) (keymap--compile-check olddef newdef) form)))
;; Don't document PREFIX in the doc string because we don't want to
;; advertise it. It's meant for recursive calls only. Here's its
;; meaning
@@ -154,10 +157,6 @@ in a cleaner way with command remapping, like this:
;; original key, with PREFIX added at the front.
(unless prefix
(setq prefix ""))
- (keymap--check olddef)
- (keymap--check newdef)
- (setq olddef (key-parse olddef))
- (setq newdef (key-parse newdef))
(let* ((scan (or oldmap keymap))
(prefix1 (vconcat prefix [nil]))
(key-substitution-in-progress