From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Alan Mackenzie 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 21:04:07 +0000 Message-ID: <20171223210407.GC6618@ACM> References: <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; charset=us-ascii X-Trace: blaine.gmane.org 1514063125 20100 195.159.176.226 (23 Dec 2017 21:05:25 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sat, 23 Dec 2017 21:05:25 +0000 (UTC) User-Agent: Mutt/1.7.2 (2016-11-26) Cc: 29478@debbugs.gnu.org, npostavs@users.sourceforge.net To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Dec 23 22:05:20 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 1eSqys-0004ld-2j for geb-bug-gnu-emacs@m.gmane.org; Sat, 23 Dec 2017 22:05:18 +0100 Original-Received: from localhost ([::1]:49804 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eSr0q-0002Bf-O4 for geb-bug-gnu-emacs@m.gmane.org; Sat, 23 Dec 2017 16:07:20 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:51566) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eSr0d-0002B8-3T for bug-gnu-emacs@gnu.org; Sat, 23 Dec 2017 16:07:08 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eSr0Z-0003ls-48 for bug-gnu-emacs@gnu.org; Sat, 23 Dec 2017 16:07:07 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:40923) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eSr0Z-0003lk-08 for bug-gnu-emacs@gnu.org; Sat, 23 Dec 2017 16:07:03 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1eSr0Y-0003T1-PB for bug-gnu-emacs@gnu.org; Sat, 23 Dec 2017 16:07:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Alan Mackenzie Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 23 Dec 2017 21:07:02 +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.151406317313265 (code B ref 29478); Sat, 23 Dec 2017 21:07:02 +0000 Original-Received: (at 29478) by debbugs.gnu.org; 23 Dec 2017 21:06:13 +0000 Original-Received: from localhost ([127.0.0.1]:49604 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eSqzk-0003Rt-Ti for submit@debbugs.gnu.org; Sat, 23 Dec 2017 16:06:13 -0500 Original-Received: from colin.muc.de ([193.149.48.1]:50879 helo=mail.muc.de) by debbugs.gnu.org with smtp (Exim 4.84_2) (envelope-from ) id 1eSqzi-0003Rk-V8 for 29478@debbugs.gnu.org; Sat, 23 Dec 2017 16:06:11 -0500 Original-Received: (qmail 35367 invoked by uid 3782); 23 Dec 2017 21:06:06 -0000 Original-Received: from acm.muc.de (p548C7AB5.dip0.t-ipconnect.de [84.140.122.181]) by colin.muc.de (tmda-ofmipd) with ESMTP; Sat, 23 Dec 2017 22:06:04 +0100 Original-Received: (qmail 7492 invoked by uid 1000); 23 Dec 2017 21:04:07 -0000 Content-Disposition: inline In-Reply-To: X-Delivery-Agent: TMDA/1.1.12 (Macallan) X-Primary-Address: acm@muc.de 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:141433 Archived-At: Hello, Stefan. On Sat, Dec 23, 2017 at 11:33:11 -0500, Stefan Monnier wrote: [ .... ] > > 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). To make C-h c/k display "mouse-appearance-menu" rather than "key sequence unbound". The idea behind the code is to return the last key sequence which is bound, rather than the very last one, which may not be. > 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"). Out of all these key sequences, some code somewhere has to select the one for which the help message will be displayed. Perhaps arbitrarily, this is now in help-read-key-sequence. > 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? Lack of knowledge on the part of the person who wrote it (me). > > (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? No, it's a filter. Things like , which otherwise triggered the sit-for are now discarded, so that only user events are processed. I know of nobody who can press mouse buttons as fast as 100 times a second. All this was diagnosed in the early stages of another bug report, bug #29272. > Stefan -- Alan Mackenzie (Nuremberg, Germany).