1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-05 22:20:24 -08:00

Improve error message for invalid key syntax

* lisp/keymap.el: (keymap--compile-check, define-keymap--compile):
Mention 'key-valid-p' rather than 'kbd'.
This commit is contained in:
Robert Pluim 2025-11-06 14:23:42 +01:00
parent 8b241f93b7
commit 3035e44b9a

View file

@ -39,7 +39,7 @@
(dolist (key keys)
(when (or (vectorp key)
(and (stringp key) (not (key-valid-p key))))
(byte-compile-warn "Invalid `kbd' syntax: %S" key))))
(byte-compile-warn "Invalid `key-valid-p' syntax: %S" key))))
(defun keymap-set (keymap key definition)
"Set KEY to DEFINITION in KEYMAP.
@ -585,7 +585,7 @@ If MESSAGE (and interactively), message the result."
(let* ((wargs args)
(key (pop args)))
(when (and (stringp key) (not (key-valid-p key)))
(byte-compile-warn-x wargs "Invalid `kbd' syntax: %S" key)))
(byte-compile-warn-x wargs "Invalid `key-valid-p' syntax: %S" key)))
(when (null args)
(byte-compile-warn-x form "Uneven number of key bindings in %S" form))
(setq args (cdr args)))