Subject: bug#9146: M-x broken in console mode with viper (always gives: "viper bell"))

From: Stefan Monnier <[email-masked]>
Date: Fri, 04 Nov 2011 18:43:44 -0400

OK I can reproduce your problem and have tracked it down to a change of
mine in the keymap.c code.

The problem is that viper-intercept-ESC-key relies on a quirk of
the function key-binding which I fixed in Emacs-24.

More specifically, in Emacs-23, the following happened:

   (local-set-key "\e" 'toto)
   (key-binding "\ex")  =>  execute-extended-command

I.e. key-binding returned a binding that is not actually valid because
it's hidden by a shorter key-sequence in a keymap of higher precedence.
This has been fixed in Emacs-24 where it now returns nil in this case.

In the case of viper-intercept-ESC-key, the problematic keybinding is
not in the local-map but in a minor-mode-map installed by Viper and the
command is (of course) viper-intercept-ESC-key, but the problem is
the same.

IOW viper-intercept-ESC-key needs to be changed to call key-binding in
a context where Viper's minor-mode map(s) have been temporarily disabled
so the ESC binding to viper-intercept-ESC-key doesn't hide the thing
we're looking for.

        Stefan