* doc/lispref/keymaps.texi (Creating Keymaps): Add :continue-only
to :repeat part of defvar-keymap.
* lisp/keymap.el (defvar-keymap): Add support for new :repeat
keyword :continue-only.
* lisp/repeat.el (repeat-post-hook): The property 'repeat-continue-only'
is handled as a list of repeat-maps.
* test/lisp/repeat-tests.el (repeat-tests-repeat-map): Use new
:repeat keyword :continue-only.
(cherry picked from commit
69e1f787528eaf2f223c53a6ff518ba4f984bc17)
This means all the commands in the keymap are repeatable, and is the
most common usage.
-@item (:enter (commands ...) :exit (commands ...) :hints ((command . "hint") ...))
+@item (:enter (commands ...) :exit (commands ...)
+@itemx :continue-only (commands ...) :hints ((command . "hint") ...))
This specifies that the commands in the @code{:enter} list enter
@code{repeat-mode}, and the commands in the @code{:exit} list exit
repeat mode.
useful if the keymap being defined contains a command that should not
have the @code{repeat-map} property.
+The @code{:continue-only'} list specifies the commands that should not
+enter @code{repeat-mode}. These command should only continue the
+already activated repeating sequence.
+
The @code{:hints} list can contain cons pairs where the @sc{car} is
a command and the @sc{cdr} is a string that is displayed alongside of
the repeatable key in the echo area.
widths can be determined. Columns widths can be set explicitly, or they
will be calculated based on the window width.
++++
** New symbol property 'repeat-continue-only' for 'repeat-mode'.
-A command with this symbol property whose value is non-nil will not
-activate the repeat map in 'repeat-mode', it will only continue the
-already activated repeating sequence.
+A command with this symbol property whose value is a list of repeat
+maps will not activate the repeat map in 'repeat-mode'. It will only
+continue the already activated repeating sequence. Also 'defvar-keymap'
+supports a new keyword ':continue-only' with a list of commands that
+only continue the active repeating sequence.
\f
* Changes in Emacs 31.1 on Non-Free Operating Systems
`: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
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.
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))
(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)
(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)
;; :continue-only
("C-M-o" . repeat-tests-bind-call-o)
:exit
- ("q" . repeat-tests-bind-call-q)
- )
+ ("q" . repeat-tests-bind-call-q))
;; TODO: it seems there is no :entry, so need to do explicitly:
(put 'repeat-tests-bind-call-a 'repeat-map 'repeat-tests-bind-keys-repeat-map)