From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: iquiw Newsgroups: gmane.emacs.bugs Subject: bug#18182: 24.3.92; C-[ does not work as ESC in viper-mode Date: Tue, 19 Aug 2014 22:59:02 +0900 Message-ID: References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: ger.gmane.org 1408456838 15890 80.91.229.3 (19 Aug 2014 14:00:38 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 19 Aug 2014 14:00:38 +0000 (UTC) Cc: 18182@debbugs.gnu.org To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Aug 19 16:00:31 2014 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1XJjxZ-0007I5-1H for geb-bug-gnu-emacs@m.gmane.org; Tue, 19 Aug 2014 16:00:25 +0200 Original-Received: from localhost ([::1]:51277 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XJjxY-0004l3-FC for geb-bug-gnu-emacs@m.gmane.org; Tue, 19 Aug 2014 10:00:24 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:48890) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XJjxR-0004jy-3U for bug-gnu-emacs@gnu.org; Tue, 19 Aug 2014 10:00:21 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XJjxD-0002zy-Sz for bug-gnu-emacs@gnu.org; Tue, 19 Aug 2014 10:00:17 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:40499) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XJjxD-0002yv-PW for bug-gnu-emacs@gnu.org; Tue, 19 Aug 2014 10:00:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1XJjxC-0008W3-QZ for bug-gnu-emacs@gnu.org; Tue, 19 Aug 2014 10:00:03 -0400 X-Loop: help-debbugs@gnu.org Resent-From: iquiw Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 19 Aug 2014 14:00:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 18182 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 18182-submit@debbugs.gnu.org id=B18182.140845677332657 (code B ref 18182); Tue, 19 Aug 2014 14:00:02 +0000 Original-Received: (at 18182) by debbugs.gnu.org; 19 Aug 2014 13:59:33 +0000 Original-Received: from localhost ([127.0.0.1]:47442 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XJjwi-0008Uf-80 for submit@debbugs.gnu.org; Tue, 19 Aug 2014 09:59:32 -0400 Original-Received: from mail-yh0-f45.google.com ([209.85.213.45]:45741) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XJjwe-0008UP-P0 for 18182@debbugs.gnu.org; Tue, 19 Aug 2014 09:59:29 -0400 Original-Received: by mail-yh0-f45.google.com with SMTP id 29so5745199yhl.32 for <18182@debbugs.gnu.org>; Tue, 19 Aug 2014 06:59:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; bh=9NtvPkksdwuUhPex0mZT9WjDsr6cAFqJKPeXEYKIqLg=; b=mR9NQIvOAdbU0sD/Cd4hyeHOSqhzOHeda3XGK8Qs+BtJJYiNO62ql41XAX+8qF6scR ocH5YloH4zHpuK4NElcC34SYr7g3O07unCXetunBsmaeqNlxPUsAE2FtUAH+SRDBREa2 Q5y8etVIylhcJV7bPsVguTahciw03jH7T5Bq6PQq3oSXlYCfezjpkARYbb/y0rD0cAEO pWSYFP5gUkUaMdpYxfGWz2e3v2uGaKWOYPoRYLYRiZ2m1tDh6XNFq6CKTod8EciyyC5Y 8TrBEcn8bkVokRK9uJf+MtFVwmIl2Nnhvxej/7e0exdNsg4HFqlJ1ZyO1b3s4mlDiC4S 88/w== X-Received: by 10.236.14.34 with SMTP id c22mr64403785yhc.97.1408456762911; Tue, 19 Aug 2014 06:59:22 -0700 (PDT) Original-Received: by 10.170.159.135 with HTTP; Tue, 19 Aug 2014 06:59:02 -0700 (PDT) In-Reply-To: X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:92529 Archived-At: 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 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)) >