[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

From: Drew Adams
Subject: bug#6256: 24.0.50; read-event in `repeat' command
Date: Sat, 11 Sep 2010 15:34:36 -0700

Thanks for trying, but no, unfortunately it does not work.
I tested your patch using this release:
GNU Emacs 23.2.1 (i386-mingw-nt5.1.2600)
 of 2010-05-08 on G41R2F1 

And I can confirm that the code I suggested does work.

> From: Stefan Monnier Sent: Saturday, September 11, 2010 11:26 AM
> > 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,
> +         (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)))

If you want to test for yourself, then:

1. Load the Bookmark+ files (see below).

2. Use C-x p RET at several places in a file to create some bookmarks.

3. Use C-x p <up> <up> <up>... (or <down> <down>...) to cycle among the
bookmarks.  You will see a message showing the position at each bookmark

4. Now try C-x p followed by repeated mouse-wheel down or up movements.  You
should see the same movement to each bookmark in turn, and the same position
messages.  With your code the wheel repetition does not work.  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))))

The Bookmark+ files are these (load in this order, after loading std library


You can find the Bookmark+ files here (Emacs Wiki Elisp area):

reply via email to

[Prev in Thread] Current Thread [Next in Thread]