M- commands no longer pass through

Frank Fischer frank-fischer at shadow-soft.de
Thu Mar 7 08:40:57 CET 2013

On 2013-03-03, Alessandro Piras <laynor at gmail.com> wrote:
> Hi Frank,
> Yes, I meant pressing Ctrl and [ simultaneously :-)
> I can understand what you mean about the german keyboard, it's as
> crazy on an italian keyboard, but I usually type using the US layout,
> and my laptop has a real US-ansi layout.
> This happens on X, everything works as expected on the terminal.
> As a half-baked fix, I put this in my evil configuration:
>   (define-key input-decode-map (kbd "C-[") [escape])

This is dangerous, because several meta-key-translations are contained
in `input-decode-map`. Furthermore `input-decode-map` is
'keyboard-local', so you have to ensure to modify this map on each
frame. Furthermore, evil now uses more or less the same trick, so you
could easily interfere with Evil.

Because `input-decode-map` is keyboard-local (or better
terminal-local), Evil now only modifies this map when the current
frame is in a terminal and leaves it untouched in X (the philosophy is
to tweak Emacs as less as possible, and in X not intercepting ESC
should be fine for most users). This works because in X the plain
escape key generates the 'escape event, which will eventually be
converted to ESC in `function-key-map` unless it is bound to some
command. Unfortunately C-[ generates the 'terminal' ESC event.

IMO, the easiest fix is to instruct Evil to do its ESC magic in X,
too. I've committed a change to esc24.3 that introduces the
(customization) variable `evil-intercept-esc`. Setting this variable
to 'always makes Evil intercept the ESC event in any frame, not only
in terminal frames, i.e. something like

    (setq evil-intercept-esc 'always)

should solve your problem and, hopefully, not break something else (by
default this variable is t which means 'terminal-only').

Hope this helps,

More information about the implementations-list mailing list