all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Drew Adams" <drew.adams@oracle.com>
To: <bug-gnu-emacs@gnu.org>
Subject: bug#4478: 23.1; key bindings for mouse wheel - unclear
Date: Fri, 18 Sep 2009 00:48:12 -0700	[thread overview]
Message-ID: <625E5DF5465B4A1CBF3FBB6015CBB87D@us.oracle.com> (raw)

1. Doc bug: The doc is not clear about how to bind the mouse wheel
(rotations).
 
2. Code bug / enhancement request: Have a shorter way to bind wheel
actions.
 
--
 
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 Misc 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 does it say where
they are defined?).
 
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. Is there a shorter or better way to say this and
still be portable? 
 
1. If there is not, there should be (a shorter way to do this).
 
2. Until then, whatever is the current best way 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 filed a separate bug
(#4472) about that.
 
 
 
In GNU Emacs 23.1.1 (i386-mingw-nt5.1.2600)
 of 2009-07-29 on SOFT-MJASON
Windowing system distributor `Microsoft Corp.', version 5.1.2600
configured using `configure --with-gcc (4.4)'
 







             reply	other threads:[~2009-09-18  7:48 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-18  7:48 Drew Adams [this message]
2009-09-18 13:34 ` bug#4478: 23.1; key bindings for mouse wheel - unclear Stefan Monnier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=625E5DF5465B4A1CBF3FBB6015CBB87D@us.oracle.com \
    --to=drew.adams@oracle.com \
    --cc=4478@emacsbugs.donarmstrong.com \
    --cc=bug-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.