From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.bugs Subject: bug#29478: [Patch] bug#29478: 26.0.90; `C-h k' followed by mouse clicks no longer shows down event Date: Sat, 23 Dec 2017 11:33:11 -0500 Message-ID: References: <1b3879d6-f14e-47b0-970f-baf09598fcfd@default> <871skjnpd8.fsf@users.sourceforge.net> <20171128221036.GC14868@ACM> <83o9ni3l3i.fsf@gnu.org> <83bmji2xye.fsf@gnu.org> <83tvwzubez.fsf@gnu.org> <20171222220549.GC8072@ACM> <833741lr0t.fsf@gnu.org> <20171223111726.GA6618@ACM> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1514046737 11211 195.159.176.226 (23 Dec 2017 16:32:17 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sat, 23 Dec 2017 16:32:17 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) Cc: 29478@debbugs.gnu.org, npostavs@users.sourceforge.net To: Alan Mackenzie Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Dec 23 17:32:12 2017 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eSmiZ-0002as-RR for geb-bug-gnu-emacs@m.gmane.org; Sat, 23 Dec 2017 17:32:11 +0100 Original-Received: from localhost ([::1]:51205 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eSmkY-0002Qq-Db for geb-bug-gnu-emacs@m.gmane.org; Sat, 23 Dec 2017 11:34:14 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:48099) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eSmkO-0002Oz-Lo for bug-gnu-emacs@gnu.org; Sat, 23 Dec 2017 11:34:05 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eSmkM-00086e-26 for bug-gnu-emacs@gnu.org; Sat, 23 Dec 2017 11:34:04 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:40846) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eSmkL-00086R-Uu for bug-gnu-emacs@gnu.org; Sat, 23 Dec 2017 11:34:01 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1eSmkL-0004y7-Ku for bug-gnu-emacs@gnu.org; Sat, 23 Dec 2017 11:34:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 23 Dec 2017 16:34:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 29478 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: confirmed Original-Received: via spool by 29478-submit@debbugs.gnu.org id=B29478.151404679719050 (code B ref 29478); Sat, 23 Dec 2017 16:34:01 +0000 Original-Received: (at 29478) by debbugs.gnu.org; 23 Dec 2017 16:33:17 +0000 Original-Received: from localhost ([127.0.0.1]:49527 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eSmjc-0004xC-NS for submit@debbugs.gnu.org; Sat, 23 Dec 2017 11:33:16 -0500 Original-Received: from pruche.dit.umontreal.ca ([132.204.246.22]:53438) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eSmjb-0004x3-27 for 29478@debbugs.gnu.org; Sat, 23 Dec 2017 11:33:15 -0500 Original-Received: from ceviche.home (lechon.iro.umontreal.ca [132.204.27.242]) by pruche.dit.umontreal.ca (8.14.7/8.14.1) with ESMTP id vBNGXCZY021870; Sat, 23 Dec 2017 11:33:13 -0500 Original-Received: by ceviche.home (Postfix, from userid 20848) id C4C746634E; Sat, 23 Dec 2017 11:33:11 -0500 (EST) In-Reply-To: <20171223111726.GA6618@ACM> (Alan Mackenzie's message of "Sat, 23 Dec 2017 11:17:26 +0000") X-NAI-Spam-Flag: NO X-NAI-Spam-Threshold: 5 X-NAI-Spam-Score: 0 X-NAI-Spam-Rules: 2 Rules triggered EDT_SA_DN_PASS=0, RV6186=0 X-NAI-Spam-Version: 2.3.0.9418 : core <6186> : inlines <6281> : streams <1773956> : uri <2556144> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 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: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:141430 Archived-At: > Of course! read-key-sequence consumes all the events up to the > S-down-mouse-1, leaving the following S-mouse-1 in the event buffer. > This is read at the next iteration of the command loop. Exactly. >> CC'ing Stefan in the hope that he could have some insights. > > OK, I have a provisional fix. The problem was that the double-click-time > loop in help-read-key-sequence was discarding all events but the last > one. I have amended the loop so that _all_ these events are stored in a > list, and we then discard the most recent events till we find one with a > binding. I must say after reading the whole thread and looking at the code, I still don't really understand what's the idea behind this patch (nor exactly which problems we're trying to solve). The way I understand the problem (which may be naive because I haven't tried to play with the code yet, so I'm probably missing some subtlety), the code should "simply" read events until the event read is not a down event (and skipping pseudo events like mouse-movements and help-echo). And then return all those events (it's probably not going to be more than 2, but I don't see any benefit in hard-coding the fact that we return either 1 or 2 events, we could just say "returns a list of events"). BTW, here are some comments about the current code: > (and no-mouse-movement > (string-match "mouse-movement" keyname)) > + (progn (push key keys) nil) > (and (string-match "\\(mouse\\|down\\|click\\|drag\\)" > keyname) Why string-match on event names rather than use things like event-basic-type, and event-modifiers? > (progn > @@ -739,13 +740,31 @@ help-read-key-sequence > (sleep-for 0.01) > (while (read-event nil nil 0.01)) We're blindly throwing away events here, right? Isn't that a problem? Stefan