From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Michael Kifer Newsgroups: gmane.emacs.bugs Subject: bug#13709: bug#13793: 24.3.50; M-x broken in viper and X Date: Tue, 26 Feb 2013 02:17:44 -0500 Message-ID: <512C6198.5020305@stonybrook.edu> References: <20130223123501.43568c52@susi> <20130225201657.GA10969@susi> <76c7b8b296b248bf915de72349cfc0c9@HUBCAS2.cs.stonybrook.edu> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1361863109 5462 80.91.229.3 (26 Feb 2013 07:18:29 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 26 Feb 2013 07:18:29 +0000 (UTC) Cc: "13793@debbugs.gnu.org" <13793@debbugs.gnu.org>, "13709@debbugs.gnu.org" <13709@debbugs.gnu.org>, Frank Fischer To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Feb 26 08:18:51 2013 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1UAEoM-0003vq-HF for geb-bug-gnu-emacs@m.gmane.org; Tue, 26 Feb 2013 08:18:50 +0100 Original-Received: from localhost ([::1]:46574 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UAEo1-0003L9-9h for geb-bug-gnu-emacs@m.gmane.org; Tue, 26 Feb 2013 02:18:29 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:34054) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UAEnw-0003KW-1h for bug-gnu-emacs@gnu.org; Tue, 26 Feb 2013 02:18:27 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UAEnr-0002na-Jt for bug-gnu-emacs@gnu.org; Tue, 26 Feb 2013 02:18:23 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:44959) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UAEnr-0002nU-F7 for bug-gnu-emacs@gnu.org; Tue, 26 Feb 2013 02:18:19 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1UAEpW-0001rh-GU for bug-gnu-emacs@gnu.org; Tue, 26 Feb 2013 02:20:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Michael Kifer Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 26 Feb 2013 07:20:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 13709 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 13709-submit@debbugs.gnu.org id=B13709.13618631767131 (code B ref 13709); Tue, 26 Feb 2013 07:20:02 +0000 Original-Received: (at 13709) by debbugs.gnu.org; 26 Feb 2013 07:19:36 +0000 Original-Received: from localhost ([127.0.0.1]:50423 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UAEp5-0001qu-Id for submit@debbugs.gnu.org; Tue, 26 Feb 2013 02:19:35 -0500 Original-Received: from exprod5og115.obsmtp.com ([64.18.0.246]:50043) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UAEp2-0001qd-B1 for 13709@debbugs.gnu.org; Tue, 26 Feb 2013 02:19:34 -0500 Original-Received: from mail-qe0-f71.google.com ([209.85.128.71]) (using TLSv1) by exprod5ob115.postini.com ([64.18.4.12]) with SMTP ID DSNKUSxhm9dVmZQKHOR8QlODLVGyUwiW5/DV@postini.com; Mon, 25 Feb 2013 23:17:48 PST Original-Received: by mail-qe0-f71.google.com with SMTP id 3so7179614qea.6 for <13709@debbugs.gnu.org>; Mon, 25 Feb 2013 23:17:47 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:x-received:message-id:date:from:user-agent:mime-version :to:cc:subject:references:in-reply-to:content-type :content-transfer-encoding:x-gm-message-state; bh=kh9HsVO50M4NzNQFYV37bq/X9BKdMVdDTdkPavUINOQ=; b=ObA2C4jRJ0WzS0ZxWRR/MFZZGeojIRYmKTWKnodLRz3zpYJoBVPaHJhng7hEAqZEEE OmY3PBwdvVx9fylxx3D9UuaWeWH7frGV7CMOw4FUt3ppm1AaCogpE56PRAojaVZ8V6Tc IQhn/oXK4yUji1vRz17PGzLXIQp3fUpiPGqj6N46qAVmMjyMD+DizxyyFLZn7Qz0CvTX QuiUvwLLbiXgDoMWrX0LDPiHVyeNiWJ5hLjGNykHhW4H6LK3zx16ljPKz5KhGB+biVv3 v3xv6SM4EvDtpuZx7WBEYHO2goynVuFNugqAOzJw8mqViNXsCgTn0wDrRsr/+FpqK/WF FJvw== X-Received: by 10.229.111.145 with SMTP id s17mr3697140qcp.106.1361863067218; Mon, 25 Feb 2013 23:17:47 -0800 (PST) X-Received: by 10.229.111.145 with SMTP id s17mr3697136qcp.106.1361863066910; Mon, 25 Feb 2013 23:17:46 -0800 (PST) Original-Received: from [192.168.1.106] (ool-18bf47c9.dyn.optonline.net. [24.191.71.201]) by mx.google.com with ESMTPS id ec9sm441102qab.9.2013.02.25.23.17.45 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 25 Feb 2013 23:17:46 -0800 (PST) User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130106 Thunderbird/17.0.2 In-Reply-To: <76c7b8b296b248bf915de72349cfc0c9@HUBCAS2.cs.stonybrook.edu> X-Gm-Message-State: ALoCoQnhoQ+sG3G8ylI5ZqfiQqjhZ/d6DtouNIZIXSE1YJHWMjW7McBISQAFJVWRs4yGkLhbi0/Cem14KTV3MK6dzigVK53f+m54xRGWIOGUNBTGwgRypKdUSlLZVVnLFTJUVnSBQ76z5IkunEgEw7jdgNedQJtWFQ== X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 140.186.70.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-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:71830 Archived-At:
On 02/25/2013 04:35 PM, Stefan Monnier wrote:
The function `follow_key` has been changed by the problematic commit.
Formerly severall keymaps have been passed in an array. Each keymap
has been checked in turn for a binding. One of the keymaps is
`evil-esc-map`. If this keymap is checked no binding is found. So the
next keymap is checked an it may contain a binding for M-x so this
binding is used.
Oh, I think I see what's going on.  So the Evil code (and Viper, since
it seems to use the same gymnastics) really relies on some pretty nasty
detail of the level at which the M-x => ESC x rewriting took place,
which was subtly changed.

That could also explain why `f1 f M-x' already didn't find the binding
in the old code.

Yes, Viper uses a similar mechanism (in the sense of having a special map just for the ESC key).


Anyhow, the real problem is to "multiplex" the (kbd "ESC") event in
the terminal. Any solution that sends 'escape instead of (kbd "ESC")
if another event arrives within a short period should solve the
problem.
Now my question is: why do it with a minor-mode map rather than with
an input-decode-map (which would also save you from having to rely on
unread-command-events)?  Oh, yes, of course, that input-decode-map
binding would collide with the escape-sequence remappings.

How 'bout something like:

        (defvar evil-normal-esc-map (lookup-key input-decode-map [?\e]))
        (define-key input-decode-map
          [?\e] `(menu-item "" ,evil-normal-esc-map
                   :filter ,(lambda (map)
                              (if (sit-for evail-esc-delay) [escape] map))))

At the time there was no input-decode-map - I am pretty sure.
Viper uses a trick that relies on unread-command-events and emulation-mode-map-alist
to  distinguish between ESC key and ESC sequences on dumb terminals.
(in viper-envelop-ESC-key() in viper-cmd.el).

I must admit that the intricacies of the code are rusty in my head  now, so it is hard for me to evaluate the consequences of the change. It might  simplify things  or it might break them.

--

       --- michael




[ Modulo some dance à la evil-esc-mode to add/remove this binding so
  that code that adds escape sequences to this map never bumps into the
  [escape] mapping.  ]


        Stefan