[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
emacs-28 c840bfe: * lisp/repeat.el: Detect changes in the minibuffer sta
From: |
Juri Linkov |
Subject: |
emacs-28 c840bfe: * lisp/repeat.el: Detect changes in the minibuffer state (bug#47566) |
Date: |
Mon, 15 Nov 2021 12:46:15 -0500 (EST) |
branch: emacs-28
commit c840bfe7e13200b12e3d96eb83f3972f5d25cd0c
Author: Juri Linkov <juri@linkov.net>
Commit: Juri Linkov <juri@linkov.net>
* lisp/repeat.el: Detect changes in the minibuffer state (bug#47566)
(repeat--prev-mb): New internal variable.
(repeat-post-hook): Check the property 'repeat-map' on the symbol
from 'this-command' in addition to 'real-this-command'. Don't allow
repeatable maps in the activated minibuffer or in the minibuffer
from another command. Set 'repeat--prev-mb' at the end.
---
lisp/repeat.el | 21 ++++++++++++++++-----
1 file changed, 16 insertions(+), 5 deletions(-)
diff --git a/lisp/repeat.el b/lisp/repeat.el
index ac08952..4ad6019 100644
--- a/lisp/repeat.el
+++ b/lisp/repeat.el
@@ -402,12 +402,17 @@ See `describe-repeat-maps' for a list of all repeatable
commands."
(length commands)
(length (delete-dups keymaps))))))
+(defvar repeat--prev-mb '(0)
+ "Previous minibuffer state.")
+
(defun repeat-post-hook ()
"Function run after commands to set transient keymap for repeatable keys."
(let ((was-in-progress repeat-in-progress))
(setq repeat-in-progress nil)
(when repeat-mode
(let ((rep-map (or repeat-map
+ (and (symbolp this-command)
+ (get this-command 'repeat-map))
(and (symbolp real-this-command)
(get real-this-command 'repeat-map)))))
(when rep-map
@@ -415,11 +420,16 @@ See `describe-repeat-maps' for a list of all repeatable
commands."
(setq rep-map (symbol-value rep-map)))
(let ((map (copy-keymap rep-map)))
- ;; Exit when the last char is not among repeatable keys,
- ;; so e.g. `C-x u u' repeats undo, whereas `C-/ u' doesn't.
- (when (and (zerop (minibuffer-depth)) ; avoid remapping in prompts
- (or (lookup-key map (this-command-keys-vector))
- prefix-arg))
+ (when (and
+ ;; Detect changes in the minibuffer state to allow
repetitions
+ ;; in the same minibuffer, but not when the minibuffer is
activated
+ ;; in the middle of repeating sequence (bug#47566).
+ (or (< (minibuffer-depth) (car repeat--prev-mb))
+ (eq current-minibuffer-command (cdr repeat--prev-mb)))
+ ;; Exit when the last char is not among repeatable keys,
+ ;; so e.g. `C-x u u' repeats undo, whereas `C-/ u' doesn't.
+ (or (lookup-key map (this-command-keys-vector))
+ prefix-arg))
;; Messaging
(unless prefix-arg
@@ -449,6 +459,7 @@ See `describe-repeat-maps' for a list of all repeatable
commands."
(funcall repeat-echo-function nil)))))))))))
(setq repeat-map nil)
+ (setq repeat--prev-mb (cons (minibuffer-depth) current-minibuffer-command))
(when (and was-in-progress (not repeat-in-progress))
(when repeat-exit-timer
(cancel-timer repeat-exit-timer)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- emacs-28 c840bfe: * lisp/repeat.el: Detect changes in the minibuffer state (bug#47566),
Juri Linkov <=