bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#61149: 29.0.60; keymap-local-set rejects key sequences


From: Stephen Berman
Subject: bug#61149: 29.0.60; keymap-local-set rejects key sequences
Date: Sun, 29 Jan 2023 15:35:22 +0100
User-agent: Gnus/5.13 (Gnus v5.13)

On Sun, 29 Jan 2023 15:44:44 +0200 Eli Zaretskii <eliz@gnu.org> wrote:

> To reproduce:
>
>   emacs -Q
>   M-x keymap-local-set
>   C-c .
>   forward-line RET
>
> Observe the error message:
>
>   [3 46] is not a valid key definition; see ‘key-valid-p’
>
> (The error message comes from keymap--check.)
>
> To type the key sequence, I actually pressed Ctrl and typed 'c', then
> released Ctrl and typed '.'.  Isn't that what one is supposed to use?
>
> So the above basically makes keymap-local-set useless, or am I missing
> something?  The following does work:
>
>   M-: (keymap-local-set "C-c ." 'forward-line) RET
>
> However, I could find no way of typing the string "C-c ." at the
> prompt of keymap-local-set.

This patch seems to DTRT:

diff --git a/lisp/keymap.el b/lisp/keymap.el
index 791221f2459..9643dce5f9c 100644
--- a/lisp/keymap.el
+++ b/lisp/keymap.el
@@ -95,7 +95,8 @@ keymap-local-set
 cases is shared with all other buffers in the same major mode."
   (declare (compiler-macro (lambda (form) (keymap--compile-check key) form)))
   (interactive "KSet key locally: \nCSet key %s locally to command: ")
-  (let ((map (current-local-map)))
+  (let ((map (current-local-map))
+       (key (key-description key)))
     (unless map
       (use-local-map (setq map (make-sparse-keymap))))
     (keymap-set map key command)))
Steve Berman

reply via email to

[Prev in Thread] Current Thread [Next in Thread]