bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


From: iquiw
Subject: bug#18182: 24.3.92; C-[ does not work as ESC in viper-mode
Date: Tue, 19 Aug 2014 22:59:02 +0900

Thank you for the detailed explanation.

I tried the patch, but the behavior does not changed.

After viper is enabled, function-key-map has the following value.
```
(keymap (27 . [escape]) (right-fringe keymap (mouse-3 .
mouse--strip-first-event) (mouse-2 . mouse--strip-first-event)
(mouse-1 . mouse--strip-first-event)) (left-fringe keymap (mouse-3 .
mouse--strip-first-event) (mouse-2 . mouse--strip-first-event)
(mouse-1 . mouse--strip-first-event)) (escape . [27]) (return . [13])
(clear . [12]) (linefeed . [10]) (tab . [9]) (kp-equal . [61])
(kp-separator . [44]) (kp-tab . [9]) ...)
```

Complete value is pasted in https://gist.github.com/iquiw/10c49212fd59fc795c59


On Tue, Aug 19, 2014 at 11:22 AM, Stefan Monnier
<address@hidden> wrote:
>> 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))
>





reply via email to

[Prev in Thread] Current Thread [Next in Thread]