From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Chong Yidong Newsgroups: gmane.emacs.devel Subject: Re: Difficulty with mouse-1-click-follows-link Date: Thu, 13 Oct 2005 11:33:09 -0400 Message-ID: <87fyr5e8ju.fsf@stupidchicken.com> References: <877jcmlgig.fsf@stupidchicken.com> <87vf06ttgd.fsf@pacem.orebokech.com> <87mzlh48wt.fsf@stupidchicken.com> <873bn8j7ok.fsf@pacem.orebokech.com> <87achf7ntw.fsf@stupidchicken.com> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1129218007 11600 80.91.229.2 (13 Oct 2005 15:40:07 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 13 Oct 2005 15:40:07 +0000 (UTC) Cc: romain@orebokech.com, emacs-devel@gnu.org, "Kim F. Storm" Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Oct 13 17:40:04 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1EQ55K-0001Ki-QQ for ged-emacs-devel@m.gmane.org; Thu, 13 Oct 2005 17:33:35 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EQ55K-0000Tr-9z for ged-emacs-devel@m.gmane.org; Thu, 13 Oct 2005 11:33:34 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EQ558-0000Tb-WC for emacs-devel@gnu.org; Thu, 13 Oct 2005 11:33:23 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EQ558-0000TP-D2 for emacs-devel@gnu.org; Thu, 13 Oct 2005 11:33:22 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EQ558-0000TM-96 for emacs-devel@gnu.org; Thu, 13 Oct 2005 11:33:22 -0400 Original-Received: from [18.95.6.216] (helo=localhost.localdomain) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EQ556-0007hz-AG; Thu, 13 Oct 2005 11:33:20 -0400 Original-Received: by localhost.localdomain (Postfix, from userid 1000) id C76AC1E4448; Thu, 13 Oct 2005 11:33:09 -0400 (EDT) Original-To: rms@gnu.org In-Reply-To: (Richard M. Stallman's message of "Thu, 13 Oct 2005 00:52:48 -0400") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) 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: news.gmane.org gmane.emacs.devel:43989 Archived-At: > That is important. Double-click of mouse-1 has a standard meaning, > and the link-following feature is not supposed to interfere with it. > > Whether the old code succeeded in keeping double-click working right, > I don't know. But if it doesn't work correctly now, it needs to be > fixed. This patch should fix the problem. I think `mouse-drag-region-1' was failing to call double-click bindings because it assumed that double-mouse-1 was bound to `mouse-set-point'. By the way, there's no need to drop the mouse-1 event if the user double-clicks (which is what the sit-for was trying to do). The Elisp manual says that When the user performs a double click, Emacs generates first an ordinary click event, and then a double-click event. Therefore, you must design the command binding of the double click event to assume that the single-click command has already run. It must produce the desired results of a double click, starting from the results of a single click. This patch should make mouse-1 and double-mouse-1 work as stated. Could people test it out? *** emacs/lisp/mouse.el.~1.281.~ 2005-10-09 13:59:03.000000000 -0400 --- emacs/lisp/mouse.el 2005-10-13 11:19:30.000000000 -0400 *************** *** 958,969 **** (mouse-move-drag-overlay mouse-drag-overlay start-point end-point click-count)) (if (consp event) ! (let ((fun (key-binding (vector (car event))))) ;; Run the binding of the terminating up-event, if possible. ;; In the case of a multiple click, it gives the wrong results, ;; because it would fail to set up a region. ! (if (not (= (overlay-start mouse-drag-overlay) ! (overlay-end mouse-drag-overlay))) (let* ((stop-point (if (numberp (posn-point (event-end event))) (posn-point (event-end event)) --- 958,973 ---- (mouse-move-drag-overlay mouse-drag-overlay start-point end-point click-count)) (if (consp event) ! (let* ((fun (key-binding (vector (car event)))) ! (do-multi-click (and (> (event-click-count event) 0) ! (functionp fun) ! (not (eq fun 'mouse-set-point))))) ;; Run the binding of the terminating up-event, if possible. ;; In the case of a multiple click, it gives the wrong results, ;; because it would fail to set up a region. ! (if (and (not (= (overlay-start mouse-drag-overlay) ! (overlay-end mouse-drag-overlay))) ! (not do-multi-click)) (let* ((stop-point (if (numberp (posn-point (event-end event))) (posn-point (event-end event)) *************** *** 996,1001 **** --- 1000,1006 ---- (and (mark t) mark-active (eq buffer (current-buffer)) (mouse-set-region-1)))) + (if do-multi-click (goto-char start-point)) (delete-overlay mouse-drag-overlay) ;; Run the binding of the terminating up-event. (when (and (functionp fun)