GNU bug report logs - #18182
24.3.92; C-[ does not work as ESC in viper-mode

Previous Next

Package: emacs;

Reported by: iquiw <iku.iwasa <at> gmail.com>

Date: Sun, 3 Aug 2014 15:24:02 UTC

Severity: normal

Found in version 24.3.92

Full log


Message #17 received at 18182 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: iquiw <iku.iwasa <at> gmail.com>
Cc: 18182 <at> debbugs.gnu.org
Subject: Re: bug#18182: 24.3.92; C-[ does not work as ESC in viper-mode
Date: Mon, 18 Aug 2014 22:22:59 -0400
> The following steps reproduce the problem.
> 1. Run "emacs -Q".
> 2. Type "M-x viper" to enable viper-mode.
> 3. Type "i" to enter viper insert mode.
> 4. Type "C-[".

> On Emacs 24.3, it exits from viper insert mode as well as ESC key does.
> On Emacs 24.3.92, it displays "ESC-" in minibuffer and does not exit
> from viper insert mode.

In Emacs-24.4, Viper's escape key sequence (in viper-ESC-key) was
changed from [?\e] to [escape], i.e. from the ASCII escape char (usually
called ESC in Emacs) to the `escape' key (usually called `escape' in
Emacs).

When `escape' has no specific binding, Emacs remaps it to ESC (via
function-key-map), so previously the `escape' key worked to trigger the
ESC binding of Viper.

The C-[ key is an alias (at a lower level) for the ESC char, so indeed
now it doesn't work any more to trigger the "viper-ESC-key" behavior.

Actually it still works under a tty, since under a tty Viper receives
ESC (rather than `escape') when you hit the escape key, so it has
special code that maps this ESC to an `escape' (but only for tty frames,
not in GUI frames).

I think the hack below should work.  Can you confirm it works for you?


        Stefan


=== modified file 'lisp/emulation/viper.el'
--- lisp/emulation/viper.el	2014-06-29 02:33:50 +0000
+++ lisp/emulation/viper.el	2014-08-19 02:22:11 +0000
@@ -600,6 +600,9 @@
 		    ))
 	      (viper-set-expert-level 'dont-change-unless)))
 
+        (if (equal viper-ESC-key [escape])
+            (define-key function-key-map [?\e] [escape]))
+
 	(or (memq major-mode viper-emacs-state-mode-list) ; don't switch to Vi
 	    (memq major-mode viper-insert-state-mode-list) ; don't switch
 	    (viper-change-state-to-vi))





This bug report was last modified 3 years and 237 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.