From: "Drew Adams" <drew.adams@oracle.com>
Subject: when to bind *down-mouse* vs *mouse*?
Date: Thu, 2 Dec 2004 14:28:26 -0800 [thread overview]
Message-ID: <FDELKNEBLPKKDCEBEJCBKEAECKAA.drew.adams@oracle.com> (raw)
I sent this to help-gnu-emacs a few days ago, but got no response. Can
anyone here help?
--
When is it recommended to bind *down-mouse* and when is it recommended to
bind just *mouse*? If the intention is to bind a mouse _click_ event (as
opposed to a drag), then which is generally the key sequence to bind?
I haven't been able to find any recommendations on this in the Info manuals.
If you grep the Emacs Lisp sources for "down-mouse" you will find zillions
of bindings. If you search for "down-mouse" in the Elisp Info doc you will
find that it seems to be used there too, if not explicitly recommended.
Similarly, however, if you grep or Info-search for "mouse-[123]" (and
flush/ignore hits for "down-mouse").
It would seem to make sense generally to bind *mouse* instead of
*down-mouse* for a mouse-click event, but perhaps there are considerations
having to do with multi-click or drag events that confuse the issue.
Now, this I think I can understand:
- down-mouse-1 is bound to mouse-drag-region.
- mouse-1 is bound to mouse-set-point.
If you press mouse-1 and don't follow it by a release in the same spot, you
get mouse-drag-region. (In fact, you get mouse-drag-region when you press,
and then mouse-drag-region reads another event and calls mouse-set-point.)
However, some of the standard bindings seem contradictory to me (but I'm no
doubt missing some fundamental logic behind mouse-button bindings):
- S-down-mouse-1 is bound to mouse-set-font.
- M-mouse-2 is bound to mouse-yank-secondary.
So, for instance:
- If you want to override `mouse-set-font' in, say, Dired mode, you would
presumably do something like this:
(define-key dired-mode-map [S-down-mouse-1] 'my-S-m1-cmd)
- If you want to override `mouse-yank-secondary' in Dired mode, you would
presumably do something (different) like this:
(define-key dired-mode-map [M-mouse-2] 'my-M-m2-cmd)
- If however, you did the following (for instance), then clicking
[M-mouse-2] in Dired could presumably (depending on when you released the
mouse button): 1) open the clicked file in another frame and then 2)
`mouse-yank-secondary' into that opened file - probably not what you want.
(define-key dired-mode-map [M-down-mouse-2]
'dired-mouse-find-file-other-frame)
- Note that even this additional binding wouldn't help in that situation, if
you released the button after the clicked file was opened:
(define-key dired-mode-map [M-mouse-2] 'ignore)
[This behavior is in fact what I see on Emacs 20. On Emacs 21, this problem
does not appear to arise (the `mouse-yank-secondary' does not take place) -
but I'm not sure why.]
Can someone clear this up for me? What is the recommendation? What is the
logic behind mouse bindings for click events? Are some of the standard
bindings inconsistent, or am I just missing something?
Thanks,
Drew
next reply other threads:[~2004-12-02 22:28 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-12-02 22:28 Drew Adams [this message]
2004-12-03 1:10 ` when to bind *down-mouse* vs *mouse*? Andreas Schwab
2004-12-03 1:26 ` Drew Adams
2004-12-03 10:08 ` Andreas Schwab
2004-12-03 17:22 ` Drew Adams
2004-12-03 21:22 ` Andreas Schwab
2004-12-05 14:37 ` Richard Stallman
2004-12-03 2:00 ` Luc Teirlinck
2004-12-03 17:22 ` Drew Adams
2004-12-03 18:53 ` Luc Teirlinck
2004-12-04 10:19 ` Jason Rumney
2004-12-04 17:59 ` Alex Schroeder
2004-12-04 19:06 ` Lennart Borgman
2004-12-04 21:42 ` Jan D.
2004-12-05 0:10 ` Luc Teirlinck
2004-12-07 13:20 ` Jan D.
2004-12-06 19:16 ` Drew Adams
2004-12-06 20:10 ` Stefan Monnier
2004-12-08 1:38 ` Alex Schroeder
2004-12-08 19:06 ` Drew Adams
2004-12-08 19:45 ` Stefan Monnier
2004-12-08 20:42 ` Drew Adams
2004-12-09 4:42 ` Richard Stallman
[not found] <mailman.2011.1101668442.27204.help-gnu-emacs@gnu.org>
2004-11-29 15:11 ` Stefan Monnier
-- strict thread matches above, loose matches on Subject: below --
2004-11-28 18:50 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=FDELKNEBLPKKDCEBEJCBKEAECKAA.drew.adams@oracle.com \
--to=drew.adams@oracle.com \
/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.