From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Drew Adams" Newsgroups: gmane.emacs.devel Subject: RE: keyboard-escape-quit Date: Sun, 21 Mar 2010 22:41:26 -0700 Message-ID: References: <4BA0CDF9.40707@online.de><76682E4761EA432EB929E5E199B0F92A@us.oracle.com><87wrxb57e1.fsf@lola.goethe.zz><20100317.200901.408057447.hanche@math.ntnu.no><87sk7y2gh9.fsf@lola.goethe.zz><69FB036BE1D649E0B76B257ED3D3F6EA@us.oracle.com><87vdcs13fp.fsf@mail.jurta.org><33B1AA2E77404CC694AEB05CA1D667FE@us.oracle.com><87aau2mw0a.fsf@mail.jurta.org><190DD0E028DD406C92A347871C657BDE@us.oracle.com><87ociidkh0.fsf@mail.jurta.org> <87634p2qoe.fsf@mail.jurta.org> 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 1269236580 13164 80.91.229.12 (22 Mar 2010 05:43:00 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Mon, 22 Mar 2010 05:43:00 +0000 (UTC) Cc: 'Stefan Monnier' , emacs-devel@gnu.org To: "'Juri Linkov'" Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Mar 22 06:42:50 2010 Return-path: Envelope-to: ged-emacs-devel@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 1NtaPZ-0003ki-Kb for ged-emacs-devel@m.gmane.org; Mon, 22 Mar 2010 06:42:49 +0100 Original-Received: from localhost ([127.0.0.1]:42620 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NtaPY-0002lD-6e for ged-emacs-devel@m.gmane.org; Mon, 22 Mar 2010 01:42:48 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NtaPP-0002jc-LB for emacs-devel@gnu.org; Mon, 22 Mar 2010 01:42:39 -0400 Original-Received: from [140.186.70.92] (port=45096 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NtaPN-0002i9-B1 for emacs-devel@gnu.org; Mon, 22 Mar 2010 01:42:38 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1NtaPL-0006iQ-Sk for emacs-devel@gnu.org; Mon, 22 Mar 2010 01:42:37 -0400 Original-Received: from acsinet12.oracle.com ([141.146.126.234]:28033) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1NtaPL-0006iM-NL for emacs-devel@gnu.org; Mon, 22 Mar 2010 01:42:35 -0400 Original-Received: from acsinet15.oracle.com (acsinet15.oracle.com [141.146.126.227]) by acsinet12.oracle.com (Switch-3.4.2/Switch-3.4.2) with ESMTP id o2M5gRF7001384 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 22 Mar 2010 05:42:33 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 o2M4MrNe002840; Mon, 22 Mar 2010 05:42:25 GMT Original-Received: from abhmt014.oracle.com by acsmt355.oracle.com with ESMTP id 104180581269236482; Sun, 21 Mar 2010 22:41:22 -0700 Original-Received: from dradamslap1 (/24.5.179.75) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Sun, 21 Mar 2010 22:41:21 -0700 X-Mailer: Microsoft Office Outlook 11 In-Reply-To: <87634p2qoe.fsf@mail.jurta.org> Thread-Index: AcrJWniJZWsiaU1NQtaC5xAERCzhvAAItbOw X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5579 X-Source-IP: acsmt353.oracle.com [141.146.40.153] X-Auth-Type: Internal IP X-CT-RefId: str=0001.0A0B0209.4BA70342.0118:SCFMA4539814,ss=1,fgs=0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:122450 Archived-At: > > Does it work with `query-replace' for you, or is that part > > of the doc just wrong? And again, I don't understand some of that > > q-r code. Whereas the code for deactivating the region is > > straightforward, the code for exiting `query-replace' with > > ESC ESC ESC is not (to me). > > Yes, it works with `query-replace' for me, but that's because > I've rebound `keyboard-escape-quit' to the single ESC :-) But > when I try with `emacs -Q', the first ESC exits `query-replace'. > Could you please try typing ESC with `query-replace' in Emacs 20. > Maybe some relatively recent change broke this feature. Emacs 20, 22, and 23, including pretest 23.1.92, all behave the same (emacs -Q on Windows). But actually it is not that the first ESC exits. I misspoke a bit. What I said I saw in the code is what actually happens. The first ESC is simply pushed back onto the `unread-command-events', as is any other key/char that is not recognized by query-replace. Eventually, with ESC ESC ESC (3 ESC's being pushed onto `unread-command-events'), `keyboard-escape-quit' is called, and it sees that `last-command' is `mode-exited', so it returns nil and `query-replace' exits. If you wait after hitting ESC, you'll see "ESC" appear in the echo area. If you then hit `0' (another unrecognized key), you'll see "ESC 0 ", and so on. As long as you hit an unrecognized key (e.g. `0'), it'll just be added to the echo area: "ESC 0 0 0 0".... If you hit left arrow after the first ESC, then you'll see "ESC left" in the echo area and you will really have exited, since ESC is bound. Same thing for ESC ESC ESC. But if you use `ESC ESC right' then you'll see "ESC ESC is undefined" in the echo area. (Not sure why the difference in behavior there - haven't tried to figure it out.) So I guess the doc is not totally incorrect wrt ESC ESC ESC for query-replace. But the q-r code seems more complex than it should need to be in this regard, and the behavior seems a bit inconsistent (or not obvious, let's put it that way). But as I said before, I'm probably missing something - it's not real clear to me. Seems like `keyboard-escape-quit' could just do something similar to what it does for `transient-mark-mode': have an explicit test for some `query-replace' state. Or perhaps `perform-replace' could just set `buffer-quit-function'. Dunno.