Subject: bug#6256: 24.0.50; read-event in `repeat' command

From: Stefan Monnier <[email-masked]>
Date: Sat, 11 Sep 2010 20:25:30 +0200

> And suppose `my-map' is bound to `C-x p'.  I would like for `C-x p'
> followed by repeated mouse-wheel-up events to repeat command `foo'.

> That does not happen, however, because of this restrictive `eq' test in the
> definition of function `repeat':

> (while (eq (read-event) repeat-repeat-char)
>   (repeat repeat-arg))

> The event read will be something like this, for the wheel action:

> (wheel-down (#<window 8 on foo.el> 2051 (118 . 176) 158455015 nil
>             2051 (59 . 40) nil (26 . 2) (2 . 4)))

I installed the patch below in the emacs-23 branch (it seemed slightly
safer than your version of the code).
Please confirm that it fixes your problem,

        Stefan

=== modified file 'lisp/repeat.el'
--- lisp/repeat.el	2010-01-13 08:35:10 +0000
+++ lisp/repeat.el	2010-09-11 18:20:32 +0000
@@ -335,7 +335,12 @@
 	(setq real-last-command 'repeat)
 	(setq repeat-undo-count 1)
 	(unwind-protect
-	    (while (eq (read-event) repeat-repeat-char)
+	    (while (let ((evt (read-event))) ;FIXME: read-key maybe?
+                     ;; For clicks, we need to strip the meta-data to
+                     ;; check the underlying event name.
+                     (eq (or (car-safe evt) evt)
+                         (or (car-safe repeat-repeat-char)
+                             repeat-repeat-char)))
 	      (repeat repeat-arg))
 	  ;; Make sure `repeat-undo-count' is reset.
 	  (setq repeat-undo-count nil))