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: Wed, 20 Oct 2010 13:55:35 -0700 Message-ID: <08402D206B354E10BD8F86D4CD5FA9E8@us.oracle.com> References: <058F2FC300154C1AB894694655B2A968@us.oracle.com><90A72397ABF34D84A3ACB3B6DE18F74A@us.oracle.com><0658C0CCC79D466BA9DE233F5980CAE5@us.oracle.com><8E5430CB43B84B91BB47DB3C0C710C44@us.oracle.com><02C729C63ABB48A898C742329EE4ADB0@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 1287609170 21013 80.91.229.12 (20 Oct 2010 21:12:50 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Wed, 20 Oct 2010 21:12:50 +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 Wed Oct 20 23:12:48 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 1P8fxm-0004A0-Ec for geb-bug-gnu-emacs@m.gmane.org; Wed, 20 Oct 2010 23:12:46 +0200 Original-Received: from localhost ([127.0.0.1]:39305 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1P8fxl-00044v-QJ for geb-bug-gnu-emacs@m.gmane.org; Wed, 20 Oct 2010 17:12:45 -0400 Original-Received: from [140.186.70.92] (port=58728 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1P8fxf-00044p-BO for bug-gnu-emacs@gnu.org; Wed, 20 Oct 2010 17:12:40 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1P8fxe-0008KG-1s for bug-gnu-emacs@gnu.org; Wed, 20 Oct 2010 17:12:39 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:38640) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1P8fxd-0008K9-V4 for bug-gnu-emacs@gnu.org; Wed, 20 Oct 2010 17:12:38 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.69) (envelope-from ) id 1P8fdi-0007Gd-Tk; Wed, 20 Oct 2010 16:52: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: Wed, 20 Oct 2010 20:52:02 +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.128760792227932 (code B ref 6256); Wed, 20 Oct 2010 20:52:02 +0000 Original-Received: (at 6256) by debbugs.gnu.org; 20 Oct 2010 20:52:02 +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 1P8fdh-0007GQ-4D for submit@debbugs.gnu.org; Wed, 20 Oct 2010 16:52:01 -0400 Original-Received: from rcsinet10.oracle.com ([148.87.113.121]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1P8fdf-0007GL-B8 for 6256@debbugs.gnu.org; Wed, 20 Oct 2010 16:52:00 -0400 Original-Received: from rcsinet13.oracle.com (rcsinet13.oracle.com [148.87.113.125]) by rcsinet10.oracle.com (Switch-3.4.2/Switch-3.4.2) with ESMTP id o9KKtkfS025694 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 20 Oct 2010 20:55:47 GMT Original-Received: from acsmt354.oracle.com (acsmt354.oracle.com [141.146.40.154]) by rcsinet13.oracle.com (Switch-3.4.2/Switch-3.4.1) with ESMTP id o9KK93km030377; Wed, 20 Oct 2010 20:55:45 GMT Original-Received: from abhmt003.oracle.com by acsmt353.oracle.com with ESMTP id 707703321287608136; Wed, 20 Oct 2010 13:55:36 -0700 Original-Received: from dradamslap1 (/130.35.178.194) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 20 Oct 2010 13:55:36 -0700 X-Mailer: Microsoft Office Outlook 11 In-Reply-To: Thread-Index: ActwbigA7lM5DnVIQhGSgAozrMGCgAAC1yKg X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5994 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list Resent-Date: Wed, 20 Oct 2010 16:52: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:41017 Archived-At: > > That tells me that it exited during `read-key', not > > because the event/key tested did not match (`while' test = nil). > > That's one possibility, indeed, tho maybe the code never gets to > read-key at all. This is what I used: (unwind-protect (while (let ((evt (read-key))) (message "EVT: %S, R-R-CHAR: %S" evt repeat-repeat-char) (eq (or (car-safe evt) evt) (or (car-safe repeat-repeat-char) repeat-repeat-char))) (repeat repeat-arg)) (setq repeat-undo-count nil)) The only time that code is not entered is if `repeat-repeat-char' is nil (since the code is inside the (when repeat-repeat-char...)). And if that code is entered then the only time `message' is not invoked is if `read-key' barfs. > > Apparently `read-key' itself exits out to the `unwind-protect' > > protection code in this scenario. > > That's only if it signals an error, which you should then see > somewhere. I saw no error messages in *Messages*. Perhaps we can conclude that `repeat-repeat-char' was nil. Since I have `repeat-on-final-keystroke'=t (the default), that in turn means that `last-command-event' was nil. Does that help you see what went wrong? `last-command-event' takes us into C code (and perhaps into your code for `read-key'?). I can't help much with that. As I suggested, this might have to do with other things such as my using a standalone minibuffer. Dunno. > > In emacs -Q, however, with just the Bookmark+ files loaded, I do not > > see the problem. That is presumably what you are seeing. > > Indeed. So it does work for you in Emacs-23, tho only for the case of > "emacs -Q"? If so, you may want to try and do the binary-search dance > on your .emacs to see what's interfering. I really don't want to try that for this, if I can avoid it. > > Perhaps you can suggest something I can do to determine what is > > happening that causes it (presumably) to exit the `while' during the > > `read-key', jumping out to the `unwind-protect'. Is there > > some debug message I can put at the beginning of the the > > `unwind-protect' protection code to see what happened? Can I > > put some debug stuff into `read-key'? > > You can start by adding various `message' calls around the > while, inside the while, around the read-key call, etc... > Using edebug in this code is sadly problematic, so we're left with > print-debugging. > > > You still have not said anything about what's wrong with > > that solution. > > It does not work for me (i.e. for X11 mouse wheel events). Ah. I see. That's the first I heard of it. I was thinking that that code would work because it remains abstract (in principle). It just decomposes the event into its components and compares those. There is (in principle) nothing platform-specific about it. But I see from what you say below that the problem is that on X (and maybe on some other platforms?) wheel events cannot be treated abstractly without some massaging first. They have a different form depending on whether they are the first of a series. That form difference might be useful for X (?), and maybe it could sometimes be useful for Emacs (?), but it is just an obstacle in this context. In general (and in particular here) I don't think that Emacs has any need to distinguish the first wheel event in a given direction from subsequent ones in the same direction. IOW, the problem is not that X uses different event names from Windows for its wheel events. The problem (here) is that X uses different event names for the _same_ wheel action (rotation in a given direction). > You could also try > (while (let ((evt (read-event))) > (message "EVT: %S, R-R-CHAR: %S" evt repeat-repeat-char) > (and (equal (event-basic-type evt) > (event-basic-type repeat-repeat-char)) > (equal (event-modifiers evt) > (event-modifiers repeat-repeat-char)))) > (repeat repeat-arg)) > > > It's pretty simple. It also seems logical, and it says just what we > > want to be done: if the event's components are all the same as before > > then repeat. Dunno why you have a problem with this. What problems > > do you see with this approach? > > That on X11, the second event is *not* the same as the first because > mouse wheel send first a down and then an up event. I see. So it sounds like we need an abstraction to deal with that - I'd think that would be useful anyway. After all, there is no good reason to distinguish the first wheel rotation (in a given direction). At least there is no good reason to _always_ do that, even if someone might find a reason why that might be useful sometimes. The modifiers that I wanted to compare in the `while' test are only the `control', `meta', `shift', `double', etc. modifiers. In the case of a wheel event we could safely abstract from any `down' or `up' modifiers (here, at least), AFAIK - they don't mean anything here. What about defining a function that maps X wheel events to "Emacs" wheel events that strip the `down' and `up' modifiers? And then using that function here? But that means being able to recognize a wheel event as such - any wheel event. We don't want to strip `down' or `up' from any non-wheel mouse events. That recognition should be possible using the vars `mouse-wheel-(up|down)-event'. Can you use something like this to make the decomposing-read-event approach work for X? (defun wheel-event (event) "Return EVENT, with modifiers `down' and `up' removed if a wheel event." (if (memq (event-basic-type event) (list mouse-wheel-up-event mouse-wheel-down-event)) event (event-convert-list (delq 'down (delq 'up (event-modifiers event))))))