emacs-devel
[Top][All Lists]
Advanced

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

Re: 29.0.60; keymap-local-set and keymap-global-set became less strict


From: Stefan Monnier
Subject: Re: 29.0.60; keymap-local-set and keymap-global-set became less strict
Date: Tue, 31 Jan 2023 09:30:04 -0500
User-agent: Gnus/5.13 (Gnus v5.13)

> --- i/lisp/keymap.el
> +++ w/lisp/keymap.el
> @@ -76,9 +76,14 @@ keymap-global-set
>  that local binding will continue to shadow any global binding
>  that you make with this function."
>    (declare (compiler-macro (lambda (form) (keymap--compile-check key) form)))
> -  (interactive "KSet key globally:\nCSet key %s globally to command: ")
> -  (unless (stringp key)
> -    (setq key (key-description key)))
> +  (interactive
> +   (let* ((menu-prompting nil)
> +          (cursor-in-echo-area t)
> +          (key (key-description (read-key-sequence-vector "Set key 
> globally:" nil t))))
> +     (list key
> +           (let ((cursor-in-echo-area nil))
> +             (read-command (format "Set key %s to command: "
> +                                   key))))))
>    (keymap-set (current-global-map) key command))
>  
>  (defun keymap-local-set (key command)
> @@ -91,12 +96,17 @@ keymap-local-set
>  The binding goes in the current buffer's local map, which in most
>  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: ")
> +  (interactive
> +   (let* ((menu-prompting nil)
> +          (cursor-in-echo-area t)
> +          (key (key-description (read-key-sequence-vector "Set key locally:" 
> nil t))))
> +     (list key
> +           (let ((cursor-in-echo-area nil))
> +             (read-command (format "Set key %s to command: "
> +                                   key))))))

Please put that code in a separate function so as to avoid
this duplication.


        Stefan




reply via email to

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