Subject: bug#13793: 24.3.50; M-x broken in viper and X

From: Frank Fischer <[email-masked]>
Date: Tue, 26 Feb 2013 21:17:14 +0100

On 02/26, Stefan Monnier wrote:
> 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 ,(λ (map)
>                      (if (and (not evil-inhibit-escape)
>                               (equal (this-single-command-keys) [?\e])
>                               (sit-for 0.1))
>                          [escape] map))))
> 
> So the special ESC=>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].

Sounds good to me. At least, I can't think of a problematic situation,
currently. Let's how it works in practise.

Thank you for your efforts. I would never have thought of this
solution on my own.

Best regards,
Frank