unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: iquiw <iku.iwasa@gmail.com>
Cc: 18182@debbugs.gnu.org
Subject: bug#18182: 24.3.92; C-[ does not work as ESC in viper-mode
Date: Mon, 18 Aug 2014 22:22:59 -0400	[thread overview]
Message-ID: <jwvegwdgrh5.fsf-monnier+emacsbugs@gnu.org> (raw)
In-Reply-To: <CAOAV1233TTb+zFno7yqff3R2bC6Z9FGb-Lx04_vJZZyN8GSZYw@mail.gmail.com> (iquiw's message of "Sun, 3 Aug 2014 21:43:44 +0900")

> 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))






  parent reply	other threads:[~2014-08-19  2:22 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <wu61hp65yr.fsf@fencepost.gnu.org>
2014-08-18 18:28 ` bug#18182: bug bisection help Eli Zaretskii
2014-08-03 12:43   ` bug#18182: 24.3.92; C-[ does not work as ESC in viper-mode iquiw
2014-08-03 16:29     ` Eli Zaretskii
2014-08-18 18:58     ` bug#18182: bug bisection help Glenn Morris
2014-08-19  2:22     ` Stefan Monnier [this message]
2014-08-19 13:59       ` bug#18182: 24.3.92; C-[ does not work as ESC in viper-mode iquiw
2014-08-20 19:44         ` Stefan Monnier
2014-08-21 14:08           ` iquiw
2020-09-09 10:05       ` Lars Ingebrigtsen
2020-09-09 13:50         ` Stefan Monnier
2020-09-10 12:21           ` Lars Ingebrigtsen
2021-10-20  8:07             ` Lars Ingebrigtsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=jwvegwdgrh5.fsf-monnier+emacsbugs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=18182@debbugs.gnu.org \
    --cc=iku.iwasa@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).