Subject: Re: bug#51281: 28.0.60; repeat-mode issues

From: Juri Linkov <[email-masked]>
Date: Wed, 01 Dec 2021 19:58:49 +0200

>> Actually, this too confusing feature that allows changing prefix args
>> during the repeating sequence increases code complexity enormously.
>> For posterity I'll leave here the patch that completely supports it.
>> But this feature will be removed (unless someone will ask to leave it):
>>
>>   C-x } }  C-1 C-2 } }  C-3 C-4 } }
>>
>> Only this will remain:
>>
>>   C-x } }  C-1 C-2 C-x } }  C-3 C-4 C-x } }
>
> Well, it may be slightly on the confusing side, but it does feel
> natural, I think?  So I think fixing it is better than removing it.

I hesitate to make such massive change in repeat.el on the release branch.

I have more patches for repeat.el that I'm unsure about to push.
One of them is a patch that allows kbd syntax for 'repeat-exit-key':

diff --git a/lisp/repeat.el b/lisp/repeat.el
index 7bbb398873..8199bd3287 100644
--- a/lisp/repeat.el
+++ b/lisp/repeat.el
@@ -338,6 +338,7 @@ repeat-exit-key
   "Key that stops the modal repeating of keys in sequence.
 For example, you can set it to <return> like `isearch-exit'."
   :type '(choice (const :tag "No special key to exit repeating sequence" nil)
+                 (string :tag "Kbd string that exits repeating sequence")
                  (key-sequence :tag "Key that exits repeating sequence"))
   :group 'convenience
   :version "28.1")
@@ -437,7 +455,10 @@ repeat-post-hook
 
               ;; Adding an exit key
               (when repeat-exit-key
-                (define-key map repeat-exit-key 'ignore))
+                (define-key map (if (stringp repeat-exit-key)
+                                    (kbd repeat-exit-key)
+                                  repeat-exit-key)
+                            'ignore))
 
               (when (and repeat-keep-prefix (not prefix-arg))
                 (setq prefix-arg current-prefix-arg))
@@ -476,7 +497,9 @@ repeat-echo-message-string
                                keys ", ")
                     (if repeat-exit-key
                         (format ", or exit with %s"
-                                (key-description repeat-exit-key))
+                                (if (stringp repeat-exit-key)
+                                    repeat-exit-key
+                                  (key-description repeat-exit-key)))
                       ""))))
 
 (defun repeat-echo-message (keymap)