Subject: bug#47566: 28.0.50; diff-hl should use `repeat-mode' ... and not `smartrep'

From: Dmitry Gutov <[email-masked]>
Date: Wed, 7 Apr 2021 01:44:07 +0300

Hi Juri,

On 05.04.2021 23:43, Juri Linkov wrote:
> Could you provide a minimal test case?  I tried with:
> 
> #+begin_src emacs-lisp
> (defun hl-test ()
>    (interactive)
>    (message "OK")
>    (y-or-n-p "Yes? "))
> 
> (defvar hl-repeat-map
>    (let ((map (make-sparse-keymap)))
>      (define-key map (kbd "r") 'hl-test)
>      map)
>    "Keymap to repeat hl-test.")
> (put 'hl-test 'repeat-map 'hl-repeat-map)
> #+end_src
> 
> Then typing `M-x hl-test RET', and `y r y r y r ...' keeps the loop.

Here you go:

(defun hl-test ()
   (interactive)
   (message "OK")
   (message "result: %s"
            (y-or-n-p "Yes? ")))

(defvar hl-repeat-map
   (let ((map (make-sparse-keymap)))
     (define-key map (kbd "n") 'hl-test) ; Note the changed key binding.
     map)
   "Keymap to repeat hl-test.")

(put 'hl-test 'repeat-map 'hl-repeat-map)

To try it:

1. M-x hl-test.
2. Press 'n' a few times.

Expected behavior:

It alternates between the prompt "Yes? " and message "result: nil".

Actual behavior:

It enters some sort of recursive state, only showing the prompt. I have 
to press 'y' a bunch of times to get out of it.