unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#18182: 24.3.92; C-[ does not work as ESC in viper-mode
@ 2014-08-03 12:43   ` iquiw
  2014-08-03 16:29     ` Eli Zaretskii
                       ` (2 more replies)
  0 siblings, 3 replies; 12+ messages in thread
From: iquiw @ 2014-08-03 12:43 UTC (permalink / raw)
  To: 18182

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.

Ref. http://lists.gnu.org/archive/html/help-gnu-emacs/2014-07/msg00539.html




In GNU Emacs 24.3.92.1 (i686-pc-mingw32)
 of 2014-06-27 on LEG570
Windowing system distributor `Microsoft Corp.', version 6.1.7601
Configured using:
 `configure --enable-checking 'CFLAGS=-O0 -g3' CPPFLAGS=-DGLYPH_DEBUG=1'

Important settings:
  value of $LANG: JPN
  locale-coding-system: cp932

Major mode: Lisp Interaction

Minor modes in effect:
  tooltip-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent input:
M-x v i p e r <return> n 5 n i ESC C-g <escape> M-x
r e p o r t - e m a c s - b u g <return>

Recent messages:
For information about GNU Emacs and the GNU system, type C-h C-a.
Loading viper...
Inhibit Viper startup message? (y or n) n
The last message is in buffer `Viper Startup Message'
Do you wish to make this change permanent? (y or n) n
Loading viper...done
C-M-g is undefined

Load-path shadows:
None found.

Features:
(shadow sort gnus-util mail-extr emacsbug message format-spec rfc822 mml
easymenu mml-sec mm-decode mm-bodies mm-encode mail-parse rfc2231
mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums
mm-util mail-prsvr mail-utils viper viper-ex viper-macs viper-mous
viper-cmd viper-keym ring viper-util viper-init advice help-fns
time-date japan-util tooltip electric uniquify ediff-hook vc-hooks
lisp-float-type mwheel dos-w32 ls-lisp w32-common-fns disp-table w32-win
w32-vars tool-bar dnd fontset image regexp-opt fringe tabulated-list
newcomment lisp-mode prog-mode register page menu-bar rfn-eshadow timer
select scroll-bar mouse jit-lock font-lock syntax facemenu font-core
frame cham georgian utf-8-lang misc-lang vietnamese tibetan thai
tai-viet lao korean japanese hebrew greek romanian slovak czech european
ethiopic indian cyrillic chinese case-table epa-hook jka-cmpr-hook help
simple abbrev minibuffer nadvice loaddefs button faces cus-face macroexp
files text-properties overlay sha1 md5 base64 format env code-pages mule
custom widget hashtable-print-readable backquote make-network-process
w32notify w32 multi-tty emacs)

Memory information:
((conses 8 86796 5253)
 (symbols 32 18900 0)
 (miscs 32 67 93)
 (strings 16 14303 3778)
 (string-bytes 1 380276)
 (vectors 8 11981)
 (vector-slots 4 482985 3024)
 (floats 8 69 98)
 (intervals 28 203 9)
 (buffers 508 15))





^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#18182: 24.3.92; C-[ does not work as ESC in viper-mode
  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     ` bug#18182: 24.3.92; C-[ does not work as ESC in viper-mode Stefan Monnier
  2 siblings, 0 replies; 12+ messages in thread
From: Eli Zaretskii @ 2014-08-03 16:29 UTC (permalink / raw)
  To: iquiw; +Cc: 18182

> From: iquiw <iku.iwasa@gmail.com>
> Date: 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.

FWIW, in "emacs -nw", C-[ does exit the viper insert mode.





^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#18182: bug bisection help
       [not found] <wu61hp65yr.fsf@fencepost.gnu.org>
@ 2014-08-18 18:28 ` Eli Zaretskii
  2014-08-03 12:43   ` bug#18182: 24.3.92; C-[ does not work as ESC in viper-mode iquiw
  0 siblings, 1 reply; 12+ messages in thread
From: Eli Zaretskii @ 2014-08-18 18:28 UTC (permalink / raw)
  To: Glenn Morris; +Cc: 18182

> From: Glenn Morris <rgm@gnu.org>
> Date: Mon, 18 Aug 2014 13:52:12 -0400
> 
> 
> It would be helpful if someone could bisect
> 
> http://debbugs.gnu.org/cgi/bugreport.cgi?bug=18116
> http://debbugs.gnu.org/cgi/bugreport.cgi?bug=18182
> 
> to find the causes.
> Please send any reply to the relevant bug addresses.

Crystal ball says that 18182 is due to r112692.





^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#18182: bug bisection help
  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     ` Glenn Morris
  2014-08-19  2:22     ` bug#18182: 24.3.92; C-[ does not work as ESC in viper-mode Stefan Monnier
  2 siblings, 0 replies; 12+ messages in thread
From: Glenn Morris @ 2014-08-18 18:58 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 18182

Eli Zaretskii wrote:

> Crystal ball says that 18182 is due to r112692.

Our survey says... nope.





^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#18182: 24.3.92; C-[ does not work as ESC in viper-mode
  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
  2014-08-19 13:59       ` iquiw
  2020-09-09 10:05       ` Lars Ingebrigtsen
  2 siblings, 2 replies; 12+ messages in thread
From: Stefan Monnier @ 2014-08-19  2:22 UTC (permalink / raw)
  To: iquiw; +Cc: 18182

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






^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#18182: 24.3.92; C-[ does not work as ESC in viper-mode
  2014-08-19  2:22     ` bug#18182: 24.3.92; C-[ does not work as ESC in viper-mode Stefan Monnier
@ 2014-08-19 13:59       ` iquiw
  2014-08-20 19:44         ` Stefan Monnier
  2020-09-09 10:05       ` Lars Ingebrigtsen
  1 sibling, 1 reply; 12+ messages in thread
From: iquiw @ 2014-08-19 13:59 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 18182

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
<monnier@iro.umontreal.ca> 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))
>





^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#18182: 24.3.92; C-[ does not work as ESC in viper-mode
  2014-08-19 13:59       ` iquiw
@ 2014-08-20 19:44         ` Stefan Monnier
  2014-08-21 14:08           ` iquiw
  0 siblings, 1 reply; 12+ messages in thread
From: Stefan Monnier @ 2014-08-20 19:44 UTC (permalink / raw)
  To: iquiw; +Cc: 18182

> Thank you for the detailed explanation.
> I tried the patch, but the behavior does not changed.

Hmm... yes, sorry, I forgot that many keys are bound to an ESC prefix
(all the "M-" keys).  I guess you could use

   (define-key input-decode-map [?\e] [escape])

which does seem to work.  Of course, that'll only work in the terminal
in which you start.  E.g. it won't work when you make-frame-on-display
or if you use emacs-daemon.


        Stefan





^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#18182: 24.3.92; C-[ does not work as ESC in viper-mode
  2014-08-20 19:44         ` Stefan Monnier
@ 2014-08-21 14:08           ` iquiw
  0 siblings, 0 replies; 12+ messages in thread
From: iquiw @ 2014-08-21 14:08 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 18182

On Thu, Aug 21, 2014 at 4:44 AM, Stefan Monnier
<monnier@iro.umontreal.ca> wrote:
> Hmm... yes, sorry, I forgot that many keys are bound to an ESC prefix
> (all the "M-" keys).  I guess you could use
>
>    (define-key input-decode-map [?\e] [escape])
>
> which does seem to work.

Yes, it works as expected.
I will use this configuration.

Thank you.





^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#18182: 24.3.92; C-[ does not work as ESC in viper-mode
  2014-08-19  2:22     ` bug#18182: 24.3.92; C-[ does not work as ESC in viper-mode Stefan Monnier
  2014-08-19 13:59       ` iquiw
@ 2020-09-09 10:05       ` Lars Ingebrigtsen
  2020-09-09 13:50         ` Stefan Monnier
  1 sibling, 1 reply; 12+ messages in thread
From: Lars Ingebrigtsen @ 2020-09-09 10:05 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 18182, iquiw

Stefan Monnier <monnier@iro.umontreal.ca> writes:

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

This problem is still present in Emacs 28.

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

I had a look to see what the point of the change was, but the commit
helpfully says:

            * viper-keym.el (viper-ESC-key): constant changed (Stefan Monnier's
            patch).

Stefan?  Would it make sense to change it back to ?\e again?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#18182: 24.3.92; C-[ does not work as ESC in viper-mode
  2020-09-09 10:05       ` Lars Ingebrigtsen
@ 2020-09-09 13:50         ` Stefan Monnier
  2020-09-10 12:21           ` Lars Ingebrigtsen
  0 siblings, 1 reply; 12+ messages in thread
From: Stefan Monnier @ 2020-09-09 13:50 UTC (permalink / raw)
  To: Lars Ingebrigtsen; +Cc: 18182, iquiw

>>> 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.
>
> This problem is still present in Emacs 28.
>
>> 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).
>
> I had a look to see what the point of the change was, but the commit
> helpfully says:
>
>             * viper-keym.el (viper-ESC-key): constant changed (Stefan Monnier's
>             patch).
>
> Stefan?  Would it make sense to change it back to ?\e again?

IIRC this had to do with the code that distinguishes "ESC the key" from
"ESC the prefix in escape sequences" on ttys.  The patch basically
changes input-decode-map to turn ESC into `escape` if there's no other
input after a short timeout.

But maybe we can keep using `ESC`, by relying on the function-key-map to
map `escape` back to `ESC`.


        Stefan






^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#18182: 24.3.92; C-[ does not work as ESC in viper-mode
  2020-09-09 13:50         ` Stefan Monnier
@ 2020-09-10 12:21           ` Lars Ingebrigtsen
  2021-10-20  8:07             ` Lars Ingebrigtsen
  0 siblings, 1 reply; 12+ messages in thread
From: Lars Ingebrigtsen @ 2020-09-10 12:21 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 18182, iquiw

Stefan Monnier <monnier@iro.umontreal.ca> writes:

> IIRC this had to do with the code that distinguishes "ESC the key" from
> "ESC the prefix in escape sequences" on ttys.  The patch basically
> changes input-decode-map to turn ESC into `escape` if there's no other
> input after a short timeout.
>
> But maybe we can keep using `ESC`, by relying on the function-key-map to
> map `escape` back to `ESC`.

OK; I've now done this on the trunk, and I guess we'll find out whether
that leads to any problems...

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#18182: 24.3.92; C-[ does not work as ESC in viper-mode
  2020-09-10 12:21           ` Lars Ingebrigtsen
@ 2021-10-20  8:07             ` Lars Ingebrigtsen
  0 siblings, 0 replies; 12+ messages in thread
From: Lars Ingebrigtsen @ 2021-10-20  8:07 UTC (permalink / raw)
  To: 18182

This led to problems in non-gui Emacs.  See bug#51253.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no






^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2021-10-20  8:07 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [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     ` bug#18182: 24.3.92; C-[ does not work as ESC in viper-mode Stefan Monnier
2014-08-19 13:59       ` 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

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