From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: "Drew Adams" Newsgroups: gmane.emacs.devel Subject: when to bind *down-mouse* vs *mouse*? Date: Thu, 2 Dec 2004 14:28:26 -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 1102026568 14989 80.91.229.6 (2 Dec 2004 22:29:28 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 2 Dec 2004 22:29:28 +0000 (UTC) Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Dec 02 23:29:19 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 1CZzRv-0003Fj-00 for ; Thu, 02 Dec 2004 23:29:19 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1CZzbU-0004Uf-RH for ged-emacs-devel@m.gmane.org; Thu, 02 Dec 2004 17:39:12 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.33) id 1CZzb9-0004TO-Vs for emacs-devel@gnu.org; Thu, 02 Dec 2004 17:38:52 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.33) id 1CZzb9-0004Sw-3Z for emacs-devel@gnu.org; Thu, 02 Dec 2004 17:38:51 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1CZzb8-0004Sf-UE for emacs-devel@gnu.org; Thu, 02 Dec 2004 17:38:50 -0500 Original-Received: from [141.146.126.228] (helo=agminet01.oracle.com) by monty-python.gnu.org with esmtp (TLSv1:DES-CBC3-SHA:168) (Exim 4.34) id 1CZzRD-0007aX-9u for emacs-devel@gnu.org; Thu, 02 Dec 2004 17:28:35 -0500 Original-Received: from rgmgw2.us.oracle.com (rgmgw2.us.oracle.com [138.1.191.11]) by agminet01.oracle.com (Switch-3.1.4/Switch-3.1.0) with ESMTP id iB2MSSjI031917 for ; Thu, 2 Dec 2004 14:28:28 -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 iB2MSS1a025765 for ; Thu, 2 Dec 2004 15:28:28 -0700 Original-Received: from dradamslap (dradams-lap.us.oracle.com [130.35.177.126]) by rgmgw2.us.oracle.com (Switch-3.1.4/Switch-3.1.0) with SMTP id iB2MSSv1025753 for ; Thu, 2 Dec 2004 15:28:28 -0700 Original-To: "Emacs-Devel" 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: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.devel:30616 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:30616 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