* FW: key bindings for mouse wheel
@ 2009-09-17 22:48 Drew Adams
0 siblings, 0 replies; only message in thread
From: Drew Adams @ 2009-09-17 22:48 UTC (permalink / raw
To: emacs-devel
Resending.
-----------8<-----------
From: Drew Adams Sent: Friday, August 22, 2008 9:41 AM
Resending. Does no one know whether `wheel-down' is platform independent and
what the proper, portable way to bind mouse wheel events is?
> From: Drew Adams Sent: Sunday, August 17, 2008 5:47 PM
> I've been using bindings such as this:
>
> (define-key map [wheel-down] 'aaa)
> (define-key map [wheel-down] 'bbb)
> (define-key map [C-wheel-down] 'ccc)
> (define-key map [C-wheel-down] 'ddd)
>
> Reading some mail on (I think) help-gnu-emacs got me a bit
> confused however. It gave me the impression that such
> bindings were only for MS Windows and that on
> GNU/Linux `mouse-4' and `mouse-5' must be used instead of
> `wheel-down' and `wheel-up'. (That sounds odd; I'd expect
> `mouse-4' and `mouse-5' to be a fourth
> and fifth mouse button, as they are on Windows.)
>
> I looked in the Elisp manual, but I didn't find anything specifically
> recommending how one should bind mouse wheel events. I was
> assuming that `wheel-down' was platform independent, but now
> I have a doubt.
>
> The Elisp doc (node Misce Events) speaks about events such as
> (wheel-up POSITION), but it doesn't speak about just what to
> use when binding such keys. Further, it says that events such
> as (wheel-up POSITION) are not generated on some systems and
> that on those systems "`mouse-4' and `mouse-5' are used
> instead". (Why is that?)
>
> It does say this, however: "For portable code, use the variables
> `mouse-wheel-up-event' and `mouse-wheel-down-event'", and
> then it goes on to say where those variables are defined (why?).
>
> So after a bit of fiddling I switched to this:
>
> (define-key map (vector mouse-wheel-down-event) 'aaa)
> (define-key map (vector mouse-wheel-up-event) 'bbb)
> (define-key map
> (vector (list 'control mouse-wheel-down-event)) 'ccc)
> (define-key map
> (vector (list 'control mouse-wheel-up-event)) 'ddd)
>
> I haven't tested on GNU/Linux, but I'm assuming this is what
> to use for portable code. Am I missing something? Is there a
> shorter or better way to say this and still be portable?
>
> Does anyone else think:
>
> 1. There should be a shorter way to do this?
>
> 2. Or, if not, this should at least be documented clearly as
> the way to bind mouse wheel events?
>
> [I would even expect the Emacs manual to tell you how to bind
> mouse-wheel key sequences... But AFAICT the Emacs manual isn't
> too helpful for even the basics about key binding. I'm
> sending a separate mail about that.]
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2009-09-17 22:48 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-09-17 22:48 FW: key bindings for mouse wheel Drew Adams
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.