[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: |
Robert Pluim |
Subject: |
Re: 29.0.60; keymap-local-set and keymap-global-set became less strict |
Date: |
Tue, 31 Jan 2023 16:02:21 +0100 |
>>>>> On Tue, 31 Jan 2023 09:30:04 -0500, Stefan Monnier
>>>>> <monnier@iro.umontreal.ca> said:
>> --- 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))))))
Stefan> Please put that code in a separate function so as to avoid
Stefan> this duplication.
MoooooM, Stefan is making me clean up *before* Iʼve finished! 😀
Robert
--