[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#46515: Repeat mode
From: |
Juri Linkov |
Subject: |
bug#46515: Repeat mode |
Date: |
Mon, 15 Feb 2021 19:04:12 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu) |
>> repeat.el doesn't describe the key binding, but it does say a repeat
>> mode is active. Kmacro is so smart that it aranges for the repeat key to
>> be based on whatever key the command was invoked with.
>
> Unlike `indent-rigidly', `kmacro' message
>
> (Type e to repeat macro)
>
> is displayed on every keypress, so it's a good example.
> Now added in the following patch applied over the previous patch.
Here is another incremental patch that adds more messaging:
diff --git a/lisp/repeat.el b/lisp/repeat.el
index 3c8be63c84..a322afed1d 100644
--- a/lisp/repeat.el
+++ b/lisp/repeat.el
@@ -349,7 +349,16 @@ repeat-mode
:global t :group 'convenience
(if (not repeat-mode)
(remove-hook 'post-command-hook 'repeat-post-hook)
- (add-hook 'post-command-hook 'repeat-post-hook)))
+ (add-hook 'post-command-hook 'repeat-post-hook)
+ (let* ((keymaps nil)
+ (commands (all-completions
+ "" obarray (lambda (s)
+ (and (commandp s)
+ (get s 'repeat-map)
+ (push (get s 'repeat-map) keymaps))))))
+ (message "Repeat mode is enabled for %d commands and %d keymaps"
+ (length commands)
+ (length (delete-dups keymaps))))))
(defun repeat-post-hook ()
"Function run after commands to set transient keymap."
@@ -362,7 +371,10 @@ repeat-post-hook
(let ((map (copy-keymap repeat-map)))
(let (keys)
(map-keymap (lambda (key _) (push (key-description (vector key))
keys)) map)
- (message "To repeat type %s" (mapconcat #'identity keys ", ")))
+ (message "To repeat type %s%s"
+ (mapconcat #'identity keys ", ")
+ (when repeat-exit-key
+ (format ", or %s to exit" (key-description
repeat-exit-key)))))
(when repeat-exit-key
(define-key map repeat-exit-key 'ignore))
(set-transient-map map))))))