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

From: "Drew Adams" <[email-masked]>
Date: Mon, 18 Oct 2010 14:12:30 -0700

> >>  With the code I sent it does work.
> >> This is the `while' condition I sent (again):
> 
> >> (while (let ((evt  (read-event)))
> >> (and (equal (event-basic-type evt)
> >> (event-basic-type repeat-repeat-char))
> >> (equal (event-modifiers evt)
> >> (event-modifiers repeat-repeat-char))))
> 
> But that doesn't work either in my tests: the problem is that the
> last-command-event was `mouse-4' (i.e. the up event) whereas 
> read-event returns `down-mouse-4' (a subsequent read-event would
> return the `mouse-4').

No doubt that is a difference between Emacs on Windows and Emacs on GNU.

BTW, the behavior you describe doesn't really seem very right for a mouse wheel:
Why should the first wheel event be `down-'?  I would think that `down-' would
only be called for when you press the mouse wheel (as in mouse-2 clicking using
the wheel).  Whatever.

Seems like the Emacs mouse-wheel behavior on Windows (the events) is generally
superior to that on GNU.  What about fixing the latter so that it comes up to
speed?  Another problem is that it precludes having `mouse-4' and `mouse-5'
correspond to actual mouse buttons.  On Windows I can make good use of those
mouse buttons when I use a mouse that has them.  Using `mouse-4' and 5 as
stand-ins for the mouse wheel on GNU seems like an ugly workaround/hack.  But I
don't know the details/history.

BTW - Don't know if this is related - if not, ignore for this thread, but you
might want to compare my question in emacs-devel wrt an added `<nil>' when using
the wheel in a standalone minibuffer (thread "mouse wheel events - why an extra
<nil>?").

> For my case, replacing the read-event by `read-key' happens to make
> it work (see patch below).  Please confirm whether or not it fixes it
> for you, and if it doesn't, please show me the values of
> `repeat-repeat-char' and `evt' in the above test.
> +	    (while (let ((evt (read-key)))
>                       ;; For clicks, we need to strip the meta-data to
>                       ;; check the underlying event name.
>                       (eq (or (car-safe evt) evt)

Yes, that works for me too.  Please install it if you see no problems with it.
Thx.