diff --git a/lisp/keymap.el b/lisp/keymap.el index 9b133e1ca82..43c8d918ba7 100644 --- a/lisp/keymap.el +++ b/lisp/keymap.el @@ -687,6 +687,7 @@ defvar-keymap `:exit' and `:hints', for example: :repeat (:enter (commands ...) :exit (commands ...) + :continue-only (commands ...) :hints ((command . \"hint\") ...)) `:enter' specifies the list of additional commands that only @@ -702,6 +703,10 @@ defvar-keymap in this specific map, but should not have the `repeat-map' symbol property. +`:continue-only' specifies the list of commands that should not +enter `repeat-mode'. These command should only continue the +already activated repeating sequence. + `:hints' is a list of cons pairs where car is a command and cdr is a string that is displayed alongside of the repeatable key in the echo area. @@ -740,6 +745,10 @@ defvar-keymap def) (dolist (def (plist-get repeat :enter)) (push `(put ',def 'repeat-map ',variable-name) props)) + (dolist (def (plist-get repeat :continue-only)) + (push `(put ',def 'repeat-continue-only + (cons ',variable-name (get ',def 'repeat-continue-only))) + props)) (while defs (pop defs) (setq def (pop defs)) diff --git a/lisp/repeat.el b/lisp/repeat.el index 11d26a477b6..45888d9db08 100644 --- a/lisp/repeat.el +++ b/lisp/repeat.el @@ -505,8 +505,12 @@ repeat-post-hook (setq repeat-in-progress nil) (let ((map (repeat-get-map))) (when (and (repeat-check-map map) - (or (null (repeat--command-property 'repeat-continue-only)) - was-in-progress)) + (let ((continue-only (repeat--command-property 'repeat-continue-only))) + (or (null continue-only) + (and (or (not (consp continue-only)) + (memq (repeat--command-property 'repeat-map) + continue-only)) + was-in-progress)))) ;; Messaging (funcall repeat-echo-function map) diff --git a/test/lisp/repeat-tests.el b/test/lisp/repeat-tests.el index c560a283039..527963e3ef8 100644 --- a/test/lisp/repeat-tests.el +++ b/test/lisp/repeat-tests.el @@ -63,17 +63,15 @@ repeat-tests-map (defvar-keymap repeat-tests-repeat-map :doc "Keymap for repeating sequences." - :repeat ( :enter (repeat-tests-call-a) - :exit (repeat-tests-call-q)) + :repeat ( :enter (repeat-tests-call-a) + :continue-only (repeat-tests-call-o) + :exit (repeat-tests-call-q)) "a" 'ignore ;; for non-nil repeat-check-key only "c" 'repeat-tests-call-c "d" 'repeat-tests-call-d "C-M-o" 'repeat-tests-call-o "q" 'repeat-tests-call-q) -;; TODO: add new keyword ':continue-only (repeat-tests-call-o)' -(put 'repeat-tests-call-o 'repeat-continue-only t) - ;; Test using a variable instead of the symbol: (put 'repeat-tests-call-b 'repeat-map repeat-tests-repeat-map)