From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: "Drew Adams" Newsgroups: gmane.emacs.help Subject: when to bind *down-mouse* vs *mouse*? Date: Sun, 28 Nov 2004 10:50:51 -0800 Message-ID: NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1101667878 32651 80.91.229.6 (28 Nov 2004 18:51:18 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sun, 28 Nov 2004 18:51:18 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sun Nov 28 19:51:09 2004 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1CYU8a-0000LY-00 for ; Sun, 28 Nov 2004 19:51:09 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1CYUHw-0005OC-Ss for geh-help-gnu-emacs@m.gmane.org; Sun, 28 Nov 2004 14:00:48 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.33) id 1CYUHo-0005Mz-IY for help-gnu-emacs@gnu.org; Sun, 28 Nov 2004 14:00:40 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.33) id 1CYUHo-0005Mm-3h for help-gnu-emacs@gnu.org; Sun, 28 Nov 2004 14:00:40 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1CYUHo-0005Mj-0j for help-gnu-emacs@gnu.org; Sun, 28 Nov 2004 14:00:40 -0500 Original-Received: from [141.146.126.231] (helo=agminet04.oracle.com) by monty-python.gnu.org with esmtp (TLSv1:DES-CBC3-SHA:168) (Exim 4.34) id 1CYU8M-00075r-NP for help-gnu-emacs@gnu.org; Sun, 28 Nov 2004 13:50:54 -0500 Original-Received: from rgmgw2.us.oracle.com (rgmgw2.us.oracle.com [138.1.191.11]) by agminet04.oracle.com (Switch-3.1.4/Switch-3.1.0) with ESMTP id iASIoq5O001685 for ; Sun, 28 Nov 2004 10:50:53 -0800 Original-Received: from rgmgw2.us.oracle.com (localhost [127.0.0.1]) by rgmgw2.us.oracle.com (Switch-3.1.4/Switch-3.1.0) with ESMTP id iASIoqDg019551 for ; Sun, 28 Nov 2004 11:50:52 -0700 Original-Received: from dradamslap (dhcp-amer-csvpn-gw2-141-144-81-55.vpn.oracle.com [141.144.81.55]) by rgmgw2.us.oracle.com (Switch-3.1.4/Switch-3.1.0) with SMTP id iASIoqT9019546 for ; Sun, 28 Nov 2004 11:50:52 -0700 Original-To: "Help-Gnu-Emacs" X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.6604 (9.0.2911.0) X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441 Importance: Normal X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.help:22402 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:22402 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