Make key-translate actually work

* lisp/keymap.el (key-translate): Use the first element of the parsed
keys rather than the whole vector.  (Bug#65735)
This commit is contained in:
Shynur 2023-09-07 09:58:59 +02:00 committed by Robert Pluim
parent 85f49a9bc8
commit 93134bb9c2

View file

@ -382,15 +382,17 @@ which is
This function creates a `keyboard-translate-table' if necessary This function creates a `keyboard-translate-table' if necessary
and then modifies one entry in it. and then modifies one entry in it.
Both KEY and TO should be specified by strings that satisfy `key-valid-p'." Both FROM and TO should be specified by strings that satisfy `key-valid-p'."
(declare (compiler-macro (declare (compiler-macro
(lambda (form) (keymap--compile-check from to) form))) (lambda (form) (keymap--compile-check from to) form)))
(keymap--check from) (keymap--check from)
(keymap--check to) (keymap--check to)
(or (char-table-p keyboard-translate-table) (or (char-table-p keyboard-translate-table)
(setq keyboard-translate-table (setq keyboard-translate-table
(make-char-table 'keyboard-translate-table nil))) (make-char-table 'keyboard-translate-table nil)))
(aset keyboard-translate-table (key-parse from) (key-parse to))) (aset keyboard-translate-table
(aref (key-parse from) 0)
(aref (key-parse to) 0)))
(defun keymap-lookup (keymap key &optional accept-default no-remap position) (defun keymap-lookup (keymap key &optional accept-default no-remap position)
"Return the binding for command KEY in KEYMAP. "Return the binding for command KEY in KEYMAP.