[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Repeat lambda
From: |
Juri Linkov |
Subject: |
Re: Repeat lambda |
Date: |
Mon, 29 Mar 2021 22:28:43 +0300 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu) |
>> diff --git a/lisp/repeat.el b/lisp/repeat.el
>> index 84a613da0c..4be4f766ef 100644
>> --- a/lisp/repeat.el
>> +++ b/lisp/repeat.el
>> @@ -398,7 +398,7 @@ repeat-post-hook
>> (when repeat-exit-key
>> (define-key map repeat-exit-key 'ignore))
>> - (set-transient-map map)))))))
>> + (set-transient-map map t)))))))
>
> So there is no help message “[Repeat with o, O, ...]” displayed when use 'C-x
> o O’.
Also I noticed another problem with using `t' for KEEP-PRED in
set-transient-map:
it doesn't handle `repeat-exit-key' after every command. So `t' can't be used.
> Maybe we can wrap all commands in `repeat-map’ and show the help
> message first, then invoke the bound function?
The problem is that currently we get `repeat-map' only from command symbol:
(get this-command 'repeat-map)
But maybe we could allow the command to set its next repeat-map explicitly:
(define-key map "O" (lambda ()
(interactive)
(setq repeat-map 'other-window-repeat-map)
(other-window -1)))
with such patch:
diff --git a/lisp/repeat.el b/lisp/repeat.el
index a2b04b81b0..5ae2ec2967 100644
--- a/lisp/repeat.el
+++ b/lisp/repeat.el
@@ -342,6 +342,8 @@ repeat-exit-key
:group 'convenience
:version "28.1")
+;;;###autoload (defvar repeat-map nil)
+
;;;###autoload
(define-minor-mode repeat-mode
"Toggle Repeat mode.
@@ -364,8 +366,9 @@ repeat-mode
(defun repeat-post-hook ()
"Function run after commands to set transient keymap for repeatable keys."
(when repeat-mode
- (let ((repeat-map (and (symbolp this-command)
- (get this-command 'repeat-map))))
+ (let ((repeat-map (or (and (symbolp this-command)
+ (get this-command 'repeat-map))
+ repeat-map)))
(when repeat-map
(when (boundp repeat-map)
(setq repeat-map (symbol-value repeat-map)))
@@ -398,7 +401,8 @@ repeat-post-hook
(when repeat-exit-key
(define-key map repeat-exit-key 'ignore))
- (set-transient-map map)))))))
+ (set-transient-map map))))))
+ (setq repeat-map nil))
(provide 'repeat)
- Re: Some minor suggestions to Tab Bar, (continued)
Re: Some minor suggestions to Tab Bar, Juri Linkov, 2021/03/24