all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Drew Adams" <drew.adams@oracle.com>
To: <emacs-devel@gnu.org>
Subject: mouse wheel events - why an extra <nil>?
Date: Wed, 6 Oct 2010 08:55:04 -0700	[thread overview]
Message-ID: <A56EC828017146E189E2D10C91A8DBA1@us.oracle.com> (raw)

This is about mouse wheel events, on Windows at least.  (Dunno if it is
platform-dependent, but Emacs on Windows does handle wheel events differently.)

Consider this:

(defcustom foo-keys (list [nil (control wheel-up)] ; A
                          [(control wheel-up)])    ; B
  "..." :type '(repeat sexp))

(dolist (key  foo-keys)
  (define-key minibuffer-local-must-match-map key 'toto))

It seems to be the case that both A and B are needed in order to bind the wheel
action to `toto'.  (And this is so regardless of whether modifiers such as
`control' are present.)

I would have expected only B to be needed.  That is, I would expect the wheel
event/key to always be <C-wheel-up>, but it seems to be the case that: (a) first
it is <nil> <C-wheel-up> and thereafter just <C-wheel-up>.  I don't understand
why.

That is, if only B is defined then the wheel action never calls `toto' - a
message says that <nil> <C-wheel-up> is undefined.  (What is that <nil>?  Where
is it from?)

And if only A is defined then only the first C-wheel-up of a sequence calls
`toto'.  Subsequent C-wheel-ups do nothing - a message says that <C-wheel-up> is
undefined.

This is most clearly seen if <C-wheel-up> is bound in the `global-map' to some
other command, say `titi'.  If B is removed, so the only minibuffer binding for
a C-wheel-up action is (define-key minibuffer-local-must-match-map [nil (control
wheel-up)] 'toto)), then the first C-wheel-up calls `toto' and the second and
subsequent C-wheel-ups call `titi' (the `global-map' binding).

I'd like to understand this.  I don't notice this behavior for a global wheel
binding (i.e., outside the minibuffer).  For instance, repeated C-wheel-ups
always call `titi', and there is no need for an additional global binding to
`titi' of [nil (control wheel-up)] - just binding [(control wheel-up)] suffices.

Is there a bug here perhaps?  If not, can someone please enlighten me as to what
is going on?  The doc regarding mouse events, and wheel events in particular,
does not cover this at all, and the code in mwheel.el is likewise no help here.

(One other bit of info that might be relevant, though I doubt it, is that I'm
using a standalone minibuffer frame.)




             reply	other threads:[~2010-10-06 15:55 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-06 15:55 Drew Adams [this message]
2010-10-06 21:25 ` mouse wheel events - why an extra <nil>? Drew Adams
2010-10-07 23:03   ` Juri Linkov
2010-10-08  0:30     ` Drew Adams

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=A56EC828017146E189E2D10C91A8DBA1@us.oracle.com \
    --to=drew.adams@oracle.com \
    --cc=emacs-devel@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.