]> git.eshelyaron.com Git - emacs.git/commitdiff
* test/lisp/repeat-tests.el: Add a command to continue but not activate.
authorJuri Linkov <juri@linkov.net>
Tue, 10 Jun 2025 06:34:28 +0000 (09:34 +0300)
committerEshel Yaron <me@eshelyaron.com>
Wed, 18 Jun 2025 08:02:44 +0000 (10:02 +0200)
(repeat-tests-call-e): New command.
(repeat-tests-global-map): Bind it to 'C-M-e'.
(repeat-tests-another-repeat-map, repeat-tests-repeat-map):
Add 'repeat-tests-call-e' to :continue.
(repeat-tests-continue, repeat-tests-continue-another):
Add 'C-M-e' that should continue but not activate.

(cherry picked from commit 073d06e34e1eca224e33b5b350645b4c4af04244)

test/lisp/repeat-tests.el

index bfa838d383b37ac082bdc137afa2c99b67c81f27..f96d8df2ebd8564d8194669d73c15d9e1c612bf1 100644 (file)
 (require 'ert)
 (require 'repeat)
 
-;; Key mnemonics: a - Activate (enter, also b, s), c - Continue (also d, t),
-;;                o - continue-Only (not activate, also u), q - Quit (exit)
+;; Key mnemonics: a - activate (enter, also b, s),
+;;                c - continue (also d, t, also o, u),
+;;                e - continue-only (not activate),
+;;                q - quit (exit)
 
 (defvar repeat-tests-calls nil)
 
   (interactive "p")
   (push `(,arg d) repeat-tests-calls))
 
+(defun repeat-tests-call-e (&optional arg)
+  (interactive "p")
+  (push `(,arg e) repeat-tests-calls))
+
 (defun repeat-tests-call-o (&optional arg)
   (interactive "p")
   (push `(,arg o) repeat-tests-calls))
@@ -71,6 +77,7 @@
   "C-x w a" 'repeat-tests-call-a
   "C-M-a"   'repeat-tests-call-a
   "C-M-b"   'repeat-tests-call-b
+  "C-M-e"   'repeat-tests-call-e
   "C-M-o"   'repeat-tests-call-o
   "C-M-s"   'repeat-tests-call-s
   "C-M-u"   'repeat-tests-call-u)
@@ -78,7 +85,8 @@
 (defvar-keymap repeat-tests-another-repeat-map
   :doc "Keymap for repeating other sequences."
   :repeat ( :enter    (repeat-tests-call-s)
-            :continue (repeat-tests-call-o
+            :continue (repeat-tests-call-e
+                       repeat-tests-call-o
                        repeat-tests-call-u))
   "s"     'ignore ;; for non-nil repeat-check-key only
   "t"     'repeat-tests-call-t
@@ -88,7 +96,8 @@
 (defvar-keymap repeat-tests-repeat-map
   :doc "Keymap for repeating sequences."
   :repeat ( :enter    (repeat-tests-call-a)
-            :continue (repeat-tests-call-o)
+            :continue (repeat-tests-call-e
+                       repeat-tests-call-o)
             :exit     (repeat-tests-call-q))
   "a"     'ignore ;; for non-nil repeat-check-key only
   "c"     'repeat-tests-call-c
   (with-repeat-mode repeat-tests-global-map
     (let ((repeat-echo-function 'ignore)
           (repeat-check-key nil))
-      ;; 'C-M-o' used as continue
+      ;; 'C-M-e' and 'C-M-o' used as continue
       (repeat-tests--check
-       "C-M-a c C-M-o c z"
-       '((1 a) (1 c) (1 o) (1 c)) "z")
-      ;; 'C-M-o' should not activate
+       "C-M-a c C-M-e C-M-o c z"
+       '((1 a) (1 c) (1 e) (1 o) (1 c)) "z")
+      ;; 'C-M-e' should not activate
       (repeat-tests--check
-       "C-M-o c z"
-       '((1 o)) "cz"))))
+       "C-M-e c z"
+       '((1 e)) "cz")
+      ;; 'C-M-o' should also activate
+      ;; (repeat-tests--check
+      ;;  "C-M-o c z"
+      ;;  '((1 o) (1 c)) "z")
+      )))
 
 (ert-deftest repeat-tests-continue-another ()
   (with-repeat-mode repeat-tests-global-map
       (repeat-tests--check
        "C-M-s t t z"
        '((1 s) (1 t) (1 t)) "z")
-      ;; 'C-M-u' used as continue
+      ;; 'C-M-e' and 'C-M-u' used as continue
       (repeat-tests--check
-       "C-M-s t C-M-u t z"
-       '((1 s) (1 t) (1 u) (1 t)) "z")
-      ;; 'C-M-u' should not activate
+       "C-M-s t C-M-e C-M-u t z"
+       '((1 s) (1 t) (1 e) (1 u) (1 t)) "z")
+      ;; 'C-M-e' should not activate
       (repeat-tests--check
-       "C-M-u t z"
-       '((1 u)) "tz")
+       "C-M-e t z"
+       '((1 e)) "tz")
+      ;; 'C-M-u' should also activate
+      ;; (repeat-tests--check
+      ;;  "C-M-u t z"
+      ;;  '((1 u) (1 t)) "z")
       ;; 'C-M-o' shared with another map should continue current map
       (repeat-tests--check
        "C-M-s t C-M-o C-M-o t z"