From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Drew Adams" Newsgroups: gmane.emacs.bugs Subject: bug#6256: 24.0.50; read-event in `repeat' command Date: Sat, 3 Jul 2010 14:24:23 -0700 Message-ID: References: <058F2FC300154C1AB894694655B2A968@us.oracle.com><90A72397ABF34D84A3ACB3B6DE18F74A@us.oracle.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: dough.gmane.org 1278192593 27486 80.91.229.12 (3 Jul 2010 21:29:53 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sat, 3 Jul 2010 21:29:53 +0000 (UTC) Cc: 6256@debbugs.gnu.org To: "'Stefan Monnier'" Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Jul 03 23:29:49 2010 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 1OVAHT-0001lh-AD for geb-bug-gnu-emacs@m.gmane.org; Sat, 03 Jul 2010 23:29:47 +0200 Original-Received: from localhost ([127.0.0.1]:44408 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OVAHS-0008Fw-OJ for geb-bug-gnu-emacs@m.gmane.org; Sat, 03 Jul 2010 17:29:46 -0400 Original-Received: from [140.186.70.92] (port=57604 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OVAHL-0008Fh-St for bug-gnu-emacs@gnu.org; Sat, 03 Jul 2010 17:29:40 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OVAHK-0001hD-S4 for bug-gnu-emacs@gnu.org; Sat, 03 Jul 2010 17:29:39 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:34536) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OVAHK-0001h8-Qc for bug-gnu-emacs@gnu.org; Sat, 03 Jul 2010 17:29:38 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.69) (envelope-from ) id 1OVADq-0002F3-0p; Sat, 03 Jul 2010 17:26:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: "Drew Adams" Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 03 Jul 2010 21:26:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 6256 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 6256-submit@debbugs.gnu.org id=B6256.12781923368609 (code B ref 6256); Sat, 03 Jul 2010 21:26:01 +0000 Original-Received: (at 6256) by debbugs.gnu.org; 3 Jul 2010 21:25:36 +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 1OVADP-0002Eo-B3 for submit@debbugs.gnu.org; Sat, 03 Jul 2010 17:25:35 -0400 Original-Received: from rcsinet10.oracle.com ([148.87.113.121]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OVADN-0002Ei-Ej for 6256@debbugs.gnu.org; Sat, 03 Jul 2010 17:25:33 -0400 Original-Received: from acsinet15.oracle.com (acsinet15.oracle.com [141.146.126.227]) by rcsinet10.oracle.com (Switch-3.4.2/Switch-3.4.2) with ESMTP id o63LPQwe011852 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Sat, 3 Jul 2010 21:25:28 GMT Original-Received: from acsmt353.oracle.com (acsmt353.oracle.com [141.146.40.153]) by acsinet15.oracle.com (Switch-3.4.2/Switch-3.4.1) with ESMTP id o63KEV8g003046; Sat, 3 Jul 2010 21:25:25 GMT Original-Received: from abhmt002.oracle.com by acsmt354.oracle.com with ESMTP id 379958351278192259; Sat, 03 Jul 2010 14:24:19 -0700 Original-Received: from dradamslap1 (/141.144.160.41) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Sat, 03 Jul 2010 14:24:19 -0700 X-Mailer: Microsoft Office Outlook 11 In-Reply-To: Thread-Index: Acr7s8ZpR7Xtnga5STa6MhyZLb0idQfP1Bzg X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5931 X-Source-IP: acsmt353.oracle.com [141.146.40.153] X-Auth-Type: Internal IP X-CT-RefId: str=0001.0A090207.4C2FAAC6.013B:SCFMA4539814,ss=1,fgs=0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list Resent-Date: Sat, 03 Jul 2010 17:26:02 -0400 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:38217 Archived-At: > > I take it back. `read-char-exclusive' is not the right > > fix, because not all keyboard events are character events. > > Hitting the key `left', for instance, does not work. > > I think the real answer is that both read-event and > read-char-exclusive are the wrong answer. A better answer > would be to have some way to change the way the next key is > handled. Something like a `next-key-map', kind of like the > overriding maps, except that it would be automatically reset > before running a command (and it would not disable the other > keymaps, only take precedence over them). > > Basically calling read-event and friends and then putting it > back onto the unread-command-events list is almost always > wrong in one way or another (e.g. it postpones running > post-command-hook). I don't really understand the code very well, I admit. You obviously understand it and have an idea for how to improve things in a big way. It's not clear that that improvement is soon forthcoming, however. I assume that it might not be trivial or that you are busy doing other things. While waiting for the ideal fix, can we at least improve this incrementally to enable `repeat' to work as I would expect it to wrt, say, mouse events? For example, suppose I do this: (defun repeat-command (command) (let ((repeat-previous-repeated-command command) (repeat-message-function 'ignore) (last-repeatable-command 'repeat)) (repeat nil))) (defun foo-repeat (arg) (interactive "P") (repeat-command 'foo)) (define-key my-map (vector (list mouse-wheel-up-event)) 'foo-repeat) And suppose `my-map' is bound to `C-x p'. I would like for `C-x p' followed by repeated mouse-wheel-up events to repeat command `foo'. That does not happen, however, because of this restrictive `eq' test in the definition of function `repeat': (while (eq (read-event) repeat-repeat-char) (repeat repeat-arg)) The event read will be something like this, for the wheel action: (wheel-down (# 2051 (118 . 176) 158455015 nil 2051 (59 . 40) nil (26 . 2) (2 . 4))) I would think that we would want to change the test to this, or similar: (while (let ((evt (read-event))) (and (equal (event-basic-type evt) (event-basic-type repeat-repeat-char)) (equal (event-modifiers evt) (event-modifiers repeat-repeat-char)))) (repeat repeat-arg)) And that seems to work OK. What do you think - is it reasonable to do that? It seems like a win, to me (nothing lost, something gained). But perhaps I'm missing something. It seems to me that what we want is to check whether the same user event occurred, and for complex events such as mouse events we would typically just want the same event type with the same modifiers. Please let me know what you think.