From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.bugs Subject: bug#7802: bug #7802: 24.0.50; Extraneous `mouse-3' event when do `double-mouse-3' Date: Thu, 13 Jan 2011 12:32:40 -0500 Message-ID: References: <6AF23E536D254FC88C35DA0BEC775C1A@us.oracle.com> <7EB632A3268149CA89DA1D58C8046A01@us.oracle.com> <9496EDBB00F3470E9417340D3CDBA5E1@us.oracle.com> <87tyhje666.fsf@gnu.org> <0BC7B2E648C8499CAC13F1D3D3A7A72E@us.oracle.com> <87oc7qeong.fsf@gnu.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1294942182 6024 80.91.229.12 (13 Jan 2011 18:09:42 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Thu, 13 Jan 2011 18:09:42 +0000 (UTC) Cc: 7802@debbugs.gnu.org To: Chong Yidong Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Jan 13 19:09:38 2011 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1PdRc1-0003Ix-Ta for geb-bug-gnu-emacs@m.gmane.org; Thu, 13 Jan 2011 19:09:30 +0100 Original-Received: from localhost ([127.0.0.1]:39432 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PdRc1-0004HW-6p for geb-bug-gnu-emacs@m.gmane.org; Thu, 13 Jan 2011 13:09:29 -0500 Original-Received: from [140.186.70.92] (port=39396 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PdRPU-0006Xg-SH for bug-gnu-emacs@gnu.org; Thu, 13 Jan 2011 12:56:34 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PdRNL-0004xB-Bq for bug-gnu-emacs@gnu.org; Thu, 13 Jan 2011 12:54:20 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:35269) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PdRNL-0004x7-8I for bug-gnu-emacs@gnu.org; Thu, 13 Jan 2011 12:54:19 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.69) (envelope-from ) id 1PdQvy-00038j-Ik; Thu, 13 Jan 2011 12:26:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 13 Jan 2011 17:26:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 7802 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 7802-submit@debbugs.gnu.org id=B7802.129493952412015 (code B ref 7802); Thu, 13 Jan 2011 17:26:02 +0000 Original-Received: (at 7802) by debbugs.gnu.org; 13 Jan 2011 17:25:24 +0000 Original-Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1PdQvM-00037j-7B for submit@debbugs.gnu.org; Thu, 13 Jan 2011 12:25:24 -0500 Original-Received: from tomts36.bellnexxia.net ([209.226.175.93] helo=tomts36-srv.bellnexxia.net) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1PdQvK-00037X-A3 for 7802@debbugs.gnu.org; Thu, 13 Jan 2011 12:25:22 -0500 Original-Received: from toip3.srvr.bell.ca ([209.226.175.86]) by tomts36-srv.bellnexxia.net (InterMail vM.5.01.06.13 201-253-122-130-113-20050324) with ESMTP id <20110113173242.NBAM2196.tomts36-srv.bellnexxia.net@toip3.srvr.bell.ca> for <7802@debbugs.gnu.org>; Thu, 13 Jan 2011 12:32:42 -0500 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AvsEAB/CLk1GHsfC/2dsb2JhbACkR3S9EIVMBIRo Original-Received: from bas1-montreal07-1176422338.dsl.bell.ca (HELO ceviche.home) ([70.30.199.194]) by toip3.srvr.bell.ca with ESMTP; 13 Jan 2011 12:32:41 -0500 Original-Received: by ceviche.home (Postfix, from userid 20848) id CCCA5660BB; Thu, 13 Jan 2011 12:32:40 -0500 (EST) In-Reply-To: (Chong Yidong's message of "Thu, 13 Jan 2011 00:35:24 -0500") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list Resent-Date: Thu, 13 Jan 2011 12:26:02 -0500 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:43333 Archived-At: > It's cleaner to let the calling Elisp code worry about this. That is to > say, the caller can bind the first click to a command that starts up a > timer to execute the "single click" action after a short period, and > bind the double click to a command that cancels that timer. Admittedly, this is pretty delicate to do right: - if nothing happens during those 500ms, run the timer. O, that's the easy case. - if a second clicks comes in before those 500ms cancel the timer. First difficulty: where do you put the code that cancels the timer? - if another event like a click on another mouse button, or a keyboard key comes in before the 500ms, we should be careful to run the click command immediately (i.e. neither let the timer finish, not just cancel it outright). And don't wait for this second event to complete to a key-sequence bound to a command (i.e. run the click command as soon as a C-x comes in, for example). - but if that second event is a mouse-movement, we should not do anything. I think the best place to put such code is somewhere around function-key-map. Just like down-mouse-N can be dropped and double-mouse-N can be demoted to just mouse-N, we could turn mouse-N events that aren't bound to new single-mouse-N events. I guess we could do it with code along the lines of: [Check that there's no mouse-N binding, but there is a single-mouse-N binding in the active key maps] (let ((event (catch 'timeout (let ((timer (run-with-timer 0.5 nil (lambda () (throw 'timeout 'timeout))))) (unwind-protect (let (event) (while (progn (setq event (read-event)) (not (memq event '(mouse-movement))))) ; Any other? event) (cancel timer)))))) (cond ((eq event 'timeout) [single-mouse-N]) ((eq event 'down-mouse-N) (push event unread-command-events) []) (t (push event unread-command-events) [single-mouse-N]))) -- Stefan