From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.bugs Subject: bug#13709: bug#13793: 24.3.50; M-x broken in viper and X Date: Tue, 26 Feb 2013 13:12:01 -0500 Message-ID: References: <20130223123501.43568c52@susi> <20130225201657.GA10969@susi> <20130226085741.GB31613@bayes.mathematik.tu-chemnitz.de> <20130226145608.GC31613@bayes.mathematik.tu-chemnitz.de> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1361902347 8495 80.91.229.3 (26 Feb 2013 18:12:27 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 26 Feb 2013 18:12:27 +0000 (UTC) Cc: 13793@debbugs.gnu.org, 13709@debbugs.gnu.org, Michael Kifer To: Frank Fischer Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Feb 26 19:12:50 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 1UAP1E-00040E-0W for geb-bug-gnu-emacs@m.gmane.org; Tue, 26 Feb 2013 19:12:48 +0100 Original-Received: from localhost ([::1]:36761 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UAP0t-0002Ac-21 for geb-bug-gnu-emacs@m.gmane.org; Tue, 26 Feb 2013 13:12:27 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:33317) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UAP0j-0001p3-UM for bug-gnu-emacs@gnu.org; Tue, 26 Feb 2013 13:12:24 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UAP0i-0003gM-Nn for bug-gnu-emacs@gnu.org; Tue, 26 Feb 2013 13:12:17 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:46107) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UAP0i-0003gE-LZ for bug-gnu-emacs@gnu.org; Tue, 26 Feb 2013 13:12:16 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1UAP2Q-000285-4T for bug-gnu-emacs@gnu.org; Tue, 26 Feb 2013 13:14:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 26 Feb 2013 18:14: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.13619024378168 (code B ref 13709); Tue, 26 Feb 2013 18:14:02 +0000 Original-Received: (at 13709) by debbugs.gnu.org; 26 Feb 2013 18:13:57 +0000 Original-Received: from localhost ([127.0.0.1]:51571 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UAP2L-00027d-20 for submit@debbugs.gnu.org; Tue, 26 Feb 2013 13:13:57 -0500 Original-Received: from chene.dit.umontreal.ca ([132.204.246.20]:38901) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UAP2G-00027K-D3; Tue, 26 Feb 2013 13:13:55 -0500 Original-Received: from faina.iro.umontreal.ca (lechon.iro.umontreal.ca [132.204.27.242]) by chene.dit.umontreal.ca (8.14.1/8.14.1) with ESMTP id r1QIC1Di010069; Tue, 26 Feb 2013 13:12:01 -0500 Original-Received: by faina.iro.umontreal.ca (Postfix, from userid 20848) id 8D4CCB40E2; Tue, 26 Feb 2013 13:12:01 -0500 (EST) In-Reply-To: <20130226145608.GC31613@bayes.mathematik.tu-chemnitz.de> (Frank Fischer's message of "Tue, 26 Feb 2013 15:56:08 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) X-NAI-Spam-Flag: NO X-NAI-Spam-Threshold: 5 X-NAI-Spam-Score: 0 X-NAI-Spam-Rules: 1 Rules triggered RV4504=0 X-NAI-Spam-Version: 2.2.0.9309 : core <4504> : streams <913962> : uri <1355830> 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:71853 Archived-At: >> Maybe "enable evil-esc-mode in post-command-hook and disable it in >> pre-command-hook" might work? > I'm a little bit afraid of situations where a new binding is defined > but pre-command-hook has not been called (to restore the original > definition of `input-decode-map`). For example if a new binding is > established in a hook or when Emacs starts. If evil is loaded before > that binding is defined, i.e. input-decode-map is already 'patched', > then it may fail. Of course one could start with an unpatched > input-decode-map and wait for the first post-command-hook. Agreed, using post/pre-command-hook is messy. Other problems come up with recursive edits (and minibuffers), where the pre-command-hook can end up run twice without intervening post-command-hook and post-command-hook can similarly be run twice without an intervening pre-command-hook. > So the question is: is it guaranteed that a post-command-hook will be > called when Emacs starts and before any user input, and that a call to > `define-key` will always be preceded by a pre-command-hook and > followed by a post-command-hook, no matter how it is called? No, basically with pre/post-command-hook, nothing is guaranteed. > This includes any possibility to call `define-key` from a hook or > so. I just do not have the overview to give a reliable judgement on > this. IMO using an advice is more direct and simpler in this > particular situation, although I really don't like it. I think what we really care about is to detect "called from read-key-sequence". How 'bout: (defvar evil-normal-esc-map (lookup-key input-decode-map [?\e])) (define-key input-decode-map [?\e] `(menu-item "" ,evil-normal-esc-map :filter ,(=CE=BB (map) (if (and (not evil-inhibit-escape) (equal (this-single-command-keys) [?\e]) (sit-for 0.1)) [escape] map)))) So the special ESC=3D>escape mapping only takes place if the whole last key-sequence so far is just [?\e], i.e. either we're still in read-key-sequence, or the last read-key-sequence only read [?\e], which should ideally never happen because it should have been mapped to [escape]. Stefan