diff --git a/lisp/repeat.el b/lisp/repeat.el index 4dcd353e34..03e5b032fe 100644 --- a/lisp/repeat.el +++ b/lisp/repeat.el @@ -360,6 +360,12 @@ repeat-keep-prefix :group 'convenience :version "28.1") +(defcustom repeat-foreign-key nil + "Whether to check if the last key exists in the repeat map." + :type 'boolean + :group 'convenience + :version "28.1") + (defcustom repeat-echo-function #'repeat-echo-message "Function to display a hint about available keys. Function is called after every repeatable command with one argument: @@ -428,7 +434,8 @@ repeat-post-hook (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)) + (or repeat-foreign-key + (lookup-key map (vector last-nonmenu-event)) prefix-arg)) ;; Messaging