GNU bug report logs - #1072
23.0.60; can't exit viper insert mode with ESC using emacsclient -t

Previous Next

Package: emacs;

Reported by: zack <at> upsilon.cc (Stefano Zacchiroli)

Date: Fri, 3 Oct 2008 08:35:03 UTC

Severity: normal

Done: Chong Yidong <cyd <at> stupidchicken.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 1072 in the body.
You can then email your comments to 1072 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#1072; Package emacs. Full text and rfc822 format available.

Acknowledgement sent to zack <at> upsilon.cc (Stefano Zacchiroli):
New bug report received and forwarded. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. Full text and rfc822 format available.

Message #5 received at submit <at> emacsbugs.donarmstrong.com (full text, mbox):

From: zack <at> upsilon.cc (Stefano Zacchiroli)
To: emacs-pretest-bug <at> gnu.org
Cc: rfrancoise <at> debian.org
Subject: 23.0.60; can't exit viper insert mode with ESC using emacsclient -t
Date: Fri,  3 Oct 2008 10:27:43 +0200 (CEST)
  I'm using viper mode (at expert level 5). I'm also using the Emacs
  server with emacsclients, sometimes creating new frames (emacsclient
  -c), sometimes on a console (emacsclient -t). Everything is fine
  working either in the main Emacs or in a framed emacsclient.

  However, in the console emacsclient I'm unable to exit insert mode
  using ESC. It does work fine exit insert mode using M-x
  viper-exit-insert-state (but as you can imagine it is quite
  annoying).

  The key different seems to be key binding, while in main Emacs and
  framed client "C-h k ESC" returns (viper-intercept-ESC-key), in
  console clients "C-h k ESC" hangs showing "ESC-" waiting for the
  next key in the binding.
  

In GNU Emacs 23.0.60.1 (x86_64-pc-linux-gnu, GTK+ Version 2.12.11)
 of 2008-09-28 on elegiac, modified by Debian
 (emacs-snapshot package, version 1:20080928-1)
Windowing system distributor `The X.Org Foundation', version 11.0.10402000
configured using `configure  '--build' 'x86_64-linux-gnu' '--host' 'x86_64-linux-gnu' '--prefix=/usr' '--sharedstatedir=/var/lib' '--libexecdir=/usr/lib' '--localstatedir=/var' '--infodir=/usr/share/info' '--mandir=/usr/share/man' '--with-pop=yes' '--enable-locallisppath=/etc/emacs-snapshot:/etc/emacs:/usr/local/share/emacs/23.0.60/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/23.0.60/site-lisp:/usr/share/emacs/site-lisp' '--with-x=yes' '--with-x-toolkit=gtk' 'build_alias=x86_64-linux-gnu' 'host_alias=x86_64-linux-gnu' 'CFLAGS=-DDEBIAN -DSITELOAD_PURESIZE_EXTRA=5000 -g -O2' 'LDFLAGS=-g -Wl,--as-needed' 'CPPFLAGS=''

Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: en_US.UTF-8
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: it_IT.UTF-8
  value of $XMODIFIERS: nil
  locale-coding-system: utf-8-unix
  default-enable-multibyte-characters: t

Major mode: Fundamental

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

Recent input:
<return> C-x k <return> y e s <return> M-x s e r <tab> 
v <tab> e <tab> s <tab> <return> n n C-n n n j j j 
C-x C-c ESC [ > 1 ; 1 6 1 4 ; 0 c j j j j j j j j j 
j j j j j j j j j j j j j j j j j l l l l l l C-z k 
k C-_ C-p C-p C-p C-z k k k I SPC SPC SPC SPC ESC j 
j j j j j DEL DEL DEL DEL DEL DEL ESC O A ESC O A ESC 
O A ESC O A ESC O A ESC O B ESC O B ESC O B ESC O B 
ESC O A ESC O A ESC O A ESC O A ESC O A ESC O A ESC 
O A i SPC C-_ ESC O A ESC ESC ESC ESC ESC ESC ESC ESC 
ESC ESC C-g C-g C-g C-g C-g ESC ESC ESC ESC x v i p 
e TAB e TAB x TAB i TAB i TAB RET j j j j k k k k k 
i SPC SPC SPC ESC j j j C-_ ESC x v i p e r - e x TAB 
i TAB i TAB TAB RET C-h k ESC <switch-frame> C-x C-f 
/ t <tab> C-x C-x C-f C-x C-f / t <tab> b a r <return> 
C-n C-n C-n C-n C-n i <escape> C-h k <escape> <switch-frame> 
ESC <switch-frame> C-x 1 j j C-x 1 j j j C-h k ESC 
C-x C-c C-x C-c n C-x 1 M-x e m a c <tab> r e <tab> 
p <tab> <M-backspace> <M-backspace> r e p o <tab> r 
<tab> <return>

Recent messages:
Undo!
Quit [4 times]
Making completion list...
Undo!
Type C-x 1 to delete the help window, C-M-v to scroll help.
mouse-2, RET: Browse http://www.gnu.org/software/emacs/tour/
exchange-point-and-mark: No mark set in this buffer
Type C-x 1 to delete the help window.
C-M-x C-c is undefined
Making completion list...




Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#1072; Package emacs. Full text and rfc822 format available.

Acknowledgement sent to Stefano Zacchiroli <zack <at> upsilon.cc>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. Full text and rfc822 format available.

Message #10 received at 1072 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Stefano Zacchiroli <zack <at> upsilon.cc>
To: Michael Kifer <kifer <at> cs.sunysb.edu>
Cc: 1072 <at> debbugs.gnu.org
Subject: Re: Viper version is 3.14 of April 06, 2008; can't exit viper
	insert mode with ESC using emacsclient -t
Date: Tue, 7 Oct 2008 15:49:50 +0100
[ Many thanks for your feedback Michael, I'm Cc-ing the bug entry in
the Emacs bug tracking system to keep track of your suggestions ]

On Mon, Oct 06, 2008 at 12:41:04PM -0400, Michael Kifer wrote:
> Emacs works fine on a console for me.

Note that that works for me to, is especially the console emacsclient
which is broken.

> emacsclient -t does not work - says that -t is an invalid option.

So maybe it's a new feature, I'm using snapshot Emacs, I was trying to
help out with feedback about it reporting this bug. Here emacsclient
-t is supported:

  $ emacsclient --help | grep -- -t
  -t, --tty               Open a new Emacs frame on the current terminal

> Are you using a slow connection or something?

Not at all, it is my laptop, Emacs is running locally under X windows,
emacsclient -t is running in a local terminal.

> On a console, ESC is time sensitive. If something is sluggish
> then it won't work. Try to play with the variable viper-fast-keyseq-timeout
> Either increase or decrease it, and see if you see any changes.

I've tried, but nothing changed.

Let me point out again that it seems that ESC is not bound at all in
the console emacsclient, quoting my bugreport:

> The key different seems to be key binding, while in main Emacs and
> framed client "C-h k ESC" returns (viper-intercept-ESC-key), in
> console clients "C-h k ESC" hangs showing "ESC-" waiting for the
> next key in the binding.

Does this blink some light? (Or maybe explains that the bug is not at
all related to Viper and need to be looked for in some emacsclient
detail?)

Thanks a lot!
Cheers.

-- 
Stefano Zacchiroli -*- PhD in Computer Science \ PostDoc @ Univ. Paris 7
zack@{upsilon.cc,pps.jussieu.fr,debian.org} -<>- http://upsilon.cc/zack/
I'm still an SGML person,this newfangled /\ All one has to do is hit the
XML stuff is so ... simplistic  -- Manoj \/ right keys at the right time




Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#1072; Package emacs. Full text and rfc822 format available.

Acknowledgement sent to "Lennart Borgman (gmail)" <lennart.borgman <at> gmail.com>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. Full text and rfc822 format available.

Message #15 received at 1072 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: "Lennart Borgman (gmail)" <lennart.borgman <at> gmail.com>
To: Stefano Zacchiroli <zack <at> upsilon.cc>, 1072 <at> debbugs.gnu.org
Cc: Michael Kifer <kifer <at> cs.sunysb.edu>
Subject: Re: bug#1072: Viper version is 3.14 of April 06, 2008;	can't exit
 viper insert mode with ESC using emacsclient -t
Date: Tue, 07 Oct 2008 18:21:40 +0200
Stefano Zacchiroli wrote:
>> The key different seems to be key binding, while in main Emacs and
>> framed client "C-h k ESC" returns (viper-intercept-ESC-key), in
>> console clients "C-h k ESC" hangs showing "ESC-" waiting for the
>> next key in the binding.
> 
> Does this blink some light? (Or maybe explains that the bug is not at
> all related to Viper and need to be looked for in some emacsclient
> detail?)

What is the value of emulation-mode-map-alists in both cases? Is
viper--intercept-key-maps there in both cases?

What is the value of this variable in both cases? It should be something
like

((viper-vi-intercept-minor-mode keymap
                                (f6 . viper-toggle-key-action)
                                (escape . viper-intercept-ESC-key)
                                (26))
 (viper-insert-intercept-minor-mode keymap
                                    (escape . viper-intercept-ESC-key))
 (viper-emacs-intercept-minor-mode keymap
                                   (f6 . viper-change-state-to-vi)
                                   (26)))

What is the values of the key variables in the association list?

> Thanks a lot!
> Cheers.
> 




Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#1072; Package emacs. Full text and rfc822 format available.

Acknowledgement sent to kifer <at> cs.sunysb.edu:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. Full text and rfc822 format available.

Message #20 received at 1072 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Michael Kifer <kifer <at> cs.sunysb.edu>
To: Stefano Zacchiroli <zack <at> upsilon.cc>
Cc: 1072 <at> debbugs.gnu.org
Subject: Re: Viper version is 3.14 of April 06, 2008; can't exit viper
 insert mode with ESC using emacsclient -t
Date: Tue, 7 Oct 2008 12:28:32 -0400

On Tue, 7 Oct 2008 15:49:50 +0100
Stefano Zacchiroli <zack <at> upsilon.cc> wrote:

> Does this blink some light? (Or maybe explains that the bug is not at
> all related to Viper and need to be looked for in some emacsclient
> detail?)

Turns out I was using an old version of emacsclient.
Something in emacsclient unbinds ESC.
I am sure it is and emacsclient problem. I don't see how
it can be a viper's problem.

My hunch is that emacsclient -t somehow ignores the minor-mode-map-alist or
does something strange with it.


michael




Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#1072; Package emacs. Full text and rfc822 format available.

Acknowledgement sent to kifer <at> cs.sunysb.edu:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. Full text and rfc822 format available.

Message #25 received at 1072 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Michael Kifer <kifer <at> cs.sunysb.edu>
To: "Lennart Borgman (gmail)" <lennart.borgman <at> gmail.com>
Cc: Stefano Zacchiroli <zack <at> upsilon.cc>, 1072 <at> debbugs.gnu.org
Subject: Re: bug#1072: Viper version is 3.14 of April 06, 2008;	can't exit
 viper insert mode with ESC using emacsclient -t
Date: Tue, 7 Oct 2008 19:06:07 -0400
It is
(viper--intercept-key-maps viper--key-maps)
but it does not look like this kicks in.

The value of  viper--intercept-key-maps  is
((viper-vi-intercept-minor-mode keymap
                                (escape . viper-intercept-ESC-key)
                                (26 . viper-toggle-key-action))
 (viper-insert-intercept-minor-mode keymap
                                    (escape . viper-intercept-ESC-key))
 (viper-emacs-intercept-minor-mode keymap
                                   (26 . viper-change-state-to-vi)))

So, the keymaps are set correctly, but they do not seem to kick in.

michael


On Tue, 07 Oct 2008 18:21:40 +0200
"Lennart Borgman (gmail)" <lennart.borgman <at> gmail.com> wrote:

> Stefano Zacchiroli wrote:
> >> The key different seems to be key binding, while in main Emacs and
> >> framed client "C-h k ESC" returns (viper-intercept-ESC-key), in
> >> console clients "C-h k ESC" hangs showing "ESC-" waiting for the
> >> next key in the binding.
> > 
> > Does this blink some light? (Or maybe explains that the bug is not at
> > all related to Viper and need to be looked for in some emacsclient
> > detail?)
> 
> What is the value of emulation-mode-map-alists in both cases? Is
> viper--intercept-key-maps there in both cases?
> 
> What is the value of this variable in both cases? It should be something
> like
> 
> ((viper-vi-intercept-minor-mode keymap
>                                 (f6 . viper-toggle-key-action)
>                                 (escape . viper-intercept-ESC-key)
>                                 (26))
>  (viper-insert-intercept-minor-mode keymap
>                                     (escape . viper-intercept-ESC-key))
>  (viper-emacs-intercept-minor-mode keymap
>                                    (f6 . viper-change-state-to-vi)
>                                    (26)))
> 
> What is the values of the key variables in the association list?
> 
> > Thanks a lot!
> > Cheers.
> > 
> 




Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#1072; Package emacs. Full text and rfc822 format available.

Acknowledgement sent to "Lennart Borgman (gmail)" <lennart.borgman <at> gmail.com>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. Full text and rfc822 format available.

Message #30 received at 1072 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: "Lennart Borgman (gmail)" <lennart.borgman <at> gmail.com>
To: kifer <at> cs.sunysb.edu
Cc: Stefano Zacchiroli <zack <at> upsilon.cc>, 1072 <at> debbugs.gnu.org
Subject: Re: bug#1072: Viper version is 3.14 of April 06, 2008;	can't exit
 viper insert mode with ESC using emacsclient -t
Date: Wed, 08 Oct 2008 01:56:46 +0200
Just to be sure: The values of the key variables?


Michael Kifer wrote:
> It is
> (viper--intercept-key-maps viper--key-maps)
> but it does not look like this kicks in.
> 
> The value of  viper--intercept-key-maps  is
> ((viper-vi-intercept-minor-mode keymap
>                                 (escape . viper-intercept-ESC-key)
>                                 (26 . viper-toggle-key-action))
>  (viper-insert-intercept-minor-mode keymap
>                                     (escape . viper-intercept-ESC-key))
>  (viper-emacs-intercept-minor-mode keymap
>                                    (26 . viper-change-state-to-vi)))
> 
> So, the keymaps are set correctly, but they do not seem to kick in.
> 
> michael
> 
> 
> On Tue, 07 Oct 2008 18:21:40 +0200
> "Lennart Borgman (gmail)" <lennart.borgman <at> gmail.com> wrote:
> 
>> Stefano Zacchiroli wrote:
>>>> The key different seems to be key binding, while in main Emacs and
>>>> framed client "C-h k ESC" returns (viper-intercept-ESC-key), in
>>>> console clients "C-h k ESC" hangs showing "ESC-" waiting for the
>>>> next key in the binding.
>>> Does this blink some light? (Or maybe explains that the bug is not at
>>> all related to Viper and need to be looked for in some emacsclient
>>> detail?)
>> What is the value of emulation-mode-map-alists in both cases? Is
>> viper--intercept-key-maps there in both cases?
>>
>> What is the value of this variable in both cases? It should be something
>> like
>>
>> ((viper-vi-intercept-minor-mode keymap
>>                                 (f6 . viper-toggle-key-action)
>>                                 (escape . viper-intercept-ESC-key)
>>                                 (26))
>>  (viper-insert-intercept-minor-mode keymap
>>                                     (escape . viper-intercept-ESC-key))
>>  (viper-emacs-intercept-minor-mode keymap
>>                                    (f6 . viper-change-state-to-vi)
>>                                    (26)))
>>
>> What is the values of the key variables in the association list?
>>
>>> Thanks a lot!
>>> Cheers.
>>>
> 




Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#1072; Package emacs. Full text and rfc822 format available.

Acknowledgement sent to Stefano Zacchiroli <zack <at> debian.org>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. Full text and rfc822 format available.

Message #35 received at 1072 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Stefano Zacchiroli <zack <at> debian.org>
To: "Lennart Borgman (gmail)" <lennart.borgman <at> gmail.com>
Cc: 1072 <at> debbugs.gnu.org, Michael Kifer <kifer <at> cs.sunysb.edu>
Subject: Re: bug#1072: Viper version is 3.14 of April 06, 2008; can't exit
	viper insert mode with ESC using emacsclient -t
Date: Thu, 9 Oct 2008 11:08:10 +0200
On Tue, Oct 07, 2008 at 06:21:40PM +0200, Lennart Borgman (gmail) wrote:
> What is the value of emulation-mode-map-alists in both cases?

in emacsclient -t: (viper--intercept-key-maps viper--key-maps)
in main emacs:     (viper--intercept-key-maps viper--key-maps)

(i.e., they are the same)

> Is viper--intercept-key-maps there in both cases?

Yes, it is there in both cases, and it appears to have the same
content.

> What is the value of this variable in both cases? It should be something
> like
> 
> ((viper-vi-intercept-minor-mode keymap
>                                 (f6 . viper-toggle-key-action)
>                                 (escape . viper-intercept-ESC-key)
>                                 (26))
>  (viper-insert-intercept-minor-mode keymap
>                                     (escape . viper-intercept-ESC-key))
>  (viper-emacs-intercept-minor-mode keymap
>                                    (f6 . viper-change-state-to-vi)
>                                    (26)))

It is similar, the only difference is that I'm missing f6. My verbatim
value is (in both cases):

((viper-vi-intercept-minor-mode keymap
				(escape . viper-intercept-ESC-key)
				(26 . viper-toggle-key-action))
 (viper-insert-intercept-minor-mode keymap
				    (escape . viper-intercept-ESC-key))
 (viper-emacs-intercept-minor-mode keymap
				   (26 . viper-change-state-to-vi)))

Do you see anything wrong with that?

Cheers.

-- 
Stefano Zacchiroli -*- PhD in Computer Science \ PostDoc @ Univ. Paris 7
zack@{upsilon.cc,pps.jussieu.fr,debian.org} -<>- http://upsilon.cc/zack/
I'm still an SGML person,this newfangled /\ All one has to do is hit the
XML stuff is so ... simplistic  -- Manoj \/ right keys at the right time




Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#1072; Package emacs. Full text and rfc822 format available.

Acknowledgement sent to "Lennart Borgman (gmail)" <lennart.borgman <at> gmail.com>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. Full text and rfc822 format available.

Message #40 received at 1072 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: "Lennart Borgman (gmail)" <lennart.borgman <at> gmail.com>
To: Stefano Zacchiroli <zack <at> debian.org>
Cc: 1072 <at> debbugs.gnu.org, Michael Kifer <kifer <at> cs.sunysb.edu>
Subject: Re: bug#1072: Viper version is 3.14 of April 06, 2008; can't exit
 viper insert mode with ESC using emacsclient -t
Date: Thu, 09 Oct 2008 16:24:19 +0200
Stefano Zacchiroli wrote:
> It is similar, the only difference is that I'm missing f6. My verbatim
> value is (in both cases):
> 
> ((viper-vi-intercept-minor-mode keymap
> 				(escape . viper-intercept-ESC-key)
> 				(26 . viper-toggle-key-action))
>  (viper-insert-intercept-minor-mode keymap
> 				    (escape . viper-intercept-ESC-key))
>  (viper-emacs-intercept-minor-mode keymap
> 				   (26 . viper-change-state-to-vi)))
> 
> Do you see anything wrong with that?

No, I forgot to remove f6. It is my custmization.




Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#1072; Package emacs. Full text and rfc822 format available.

Acknowledgement sent to Stefano Zacchiroli <zack <at> upsilon.cc>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. Full text and rfc822 format available.

Message #45 received at 1072 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Stefano Zacchiroli <zack <at> upsilon.cc>
To: Michael Kifer <kifer <at> cs.sunysb.edu>
Cc: "Lennart Borgman (gmail)" <lennart.borgman <at> gmail.com>,
        1072 <at> debbugs.gnu.org,
        Romain Francoise <rfrancoise <at> debian.org>
Subject: Re: bug#1072: Viper version is 3.14 of April 06, 2008; can't exit
	viper insert mode with ESC using emacsclient -t
Date: Fri, 14 Nov 2008 14:48:14 +0100
OK, mainly thanks to Romain Francoise, I've made some progress on the
understanding of this bug. Romain pointed me to the fact that viper
initialization depends on whether *when Emacs start* an X11
environment is in use or not.

The client/server architecture offered by emacsclient and by --daemon
defeats the soundness of this approach. To solve the problem once and
for all we need per-client initialization so that when a terminal
client is used Viper can be initialized _locally_ with terminal
settings, dually when a X11 client is used.

The workaround that Romain proposed to me is to add *before* Viper is
loaded the following line in my ~/.emacs

  (setq viper-ESC-key (kbd "ESC"))	;; workaround for #1072

I don't know why :-) , but it solves *part* of the problem.

Still, the behavior of key bindings starting with "M-" is
broken. AFAIU the reason is that viper-ESC-keyseq-timeout is either
set to 0 (which is good for X11) or to 200 (which is good for
terminals). As I typically run the main Emacs in X11, my typical value
is 0; when I spawn terminal clients attached to that Emacs they
inherit the value and stuff like "M-x" first deliver an ESC which
makes Viper quit insert mode.

A possible solution would be to use hooks that set
viper-ESC-keyseq-timeout appropriately depending on the kind of
spawned client, but there are two sub-problems inhibiting them:

0) (my ignorance, probably not really a problem) I'm aware of the hook
   after-create-frame-functions, which can be used to hook the timeout
   to 0 for X11 clients, but I'm not aware of the equivalent for
   console clients, is there one?

1) viper-ESC-keyseq-timeout is a global variable, shared by all Emacs
   clients, can it be made local to a buffer (actually it would be
   enough to make it local to a client, but I don't believe it is
   possible), or there is some Viper magic which would defeat this
   solution not work?

For the moment I'm stuck at exiting from Viper insert mode before
being able to type M-something ...

Cheers.

-- 
Stefano Zacchiroli -o- PhD in Computer Science \ PostDoc @ Univ. Paris 7
zack@{upsilon.cc,pps.jussieu.fr,debian.org} -<>- http://upsilon.cc/zack/
Dietro un grande uomo c'è ..|  .  |. Et ne m'en veux pas si je te tutoie
sempre uno zaino ...........| ..: |.... Je dis tu à tous ceux que j'aime




Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#1072; Package emacs. Full text and rfc822 format available.

Acknowledgement sent to kifer <at> cs.sunysb.edu:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. Full text and rfc822 format available.

Message #50 received at 1072 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Michael Kifer <kifer <at> cs.sunysb.edu>
To: Stefano Zacchiroli <zack <at> upsilon.cc>
Cc: "Lennart Borgman (gmail)" <lennart.borgman <at> gmail.com>,
        1072 <at> debbugs.gnu.org,
        Romain Francoise <rfrancoise <at> debian.org>
Subject: Re: bug#1072: Viper version is 3.14 of April 06, 2008; can't exit
 viper insert mode with ESC using emacsclient -t
Date: Fri, 14 Nov 2008 14:50:28 -0500

On Fri, 14 Nov 2008 14:48:14 +0100
Stefano Zacchiroli <zack <at> upsilon.cc> wrote:

> 1) viper-ESC-keyseq-timeout is a global variable, shared by all Emacs
>    clients, can it be made local to a buffer (actually it would be
>    enough to make it local to a client, but I don't believe it is
>    possible), or there is some Viper magic which would defeat this
>    solution not work?

I don't see a reason why this variable cannot be buffer-local.




Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#1072; Package emacs. Full text and rfc822 format available.

Message #53 received at 1072 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Dan Nicolaescu <dann <at> ics.uci.edu>
To: kifer <at> cs.sunysb.edu
Cc: 1072 <at> debbugs.gnu.org, Stefano Zacchiroli <zack <at> upsilon.cc>,
        Romain Francoise <rfrancoise <at> debian.org>
Subject: Re: bug#1072: Viper version is 3.14 of April 06, 2008; can't exit viper insert mode with ESC using emacsclient -t
Date: Fri, 14 Nov 2008 12:40:21 -0800 (PST)
Michael Kifer <kifer <at> cs.sunysb.edu> writes:

  > On Fri, 14 Nov 2008 14:48:14 +0100
  > Stefano Zacchiroli <zack <at> upsilon.cc> wrote:
  > 
  > > 1) viper-ESC-keyseq-timeout is a global variable, shared by all Emacs
  > >    clients, can it be made local to a buffer (actually it would be
  > >    enough to make it local to a client, but I don't believe it is
  > >    possible), or there is some Viper magic which would defeat this
  > >    solution not work?
  > 
  > I don't see a reason why this variable cannot be buffer-local.

Disclaimer: I don't know anything about viper.

But the above does not sound right: a buffer can be used in both an X11
frame and a tty frame at the same time, so a buffer-local value won't
work.




Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#1072; Package emacs. Full text and rfc822 format available.

Acknowledgement sent to kifer <at> cs.sunysb.edu:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. Full text and rfc822 format available.

Message #58 received at 1072 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Michael Kifer <kifer <at> cs.sunysb.edu>
To: Dan Nicolaescu <dann <at> ics.uci.edu>
Cc: 1072 <at> debbugs.gnu.org, Stefano Zacchiroli <zack <at> upsilon.cc>,
        Romain Francoise <rfrancoise <at> debian.org>
Subject: Re: bug#1072: Viper version is 3.14 of April 06, 2008; can't exit
 viper insert mode with ESC using emacsclient -t
Date: Fri, 14 Nov 2008 15:55:20 -0500

On Fri, 14 Nov 2008 12:40:21 -0800 (PST)
Dan Nicolaescu <dann <at> ics.uci.edu> wrote:

> Michael Kifer <kifer <at> cs.sunysb.edu> writes:
> 
>   > On Fri, 14 Nov 2008 14:48:14 +0100
>   > Stefano Zacchiroli <zack <at> upsilon.cc> wrote:
>   > 
>   > > 1) viper-ESC-keyseq-timeout is a global variable, shared by all Emacs
>   > >    clients, can it be made local to a buffer (actually it would be
>   > >    enough to make it local to a client, but I don't believe it is
>   > >    possible), or there is some Viper magic which would defeat this
>   > >    solution not work?
>   > 
>   > I don't see a reason why this variable cannot be buffer-local.
> 
> Disclaimer: I don't know anything about viper.
> 
> But the above does not sound right: a buffer can be used in both an X11
> frame and a tty frame at the same time, so a buffer-local value won't
> work.

Yes, you are right. If there is a way to find out whether the selected window
is in a terminal frame or X frame then viper-ESC-keyseq-timeout can be made
into a function.




Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#1072; Package emacs. Full text and rfc822 format available.

Message #61 received at 1072 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Dan Nicolaescu <dann <at> ics.uci.edu>
To: kifer <at> cs.sunysb.edu
Cc: 1072 <at> debbugs.gnu.org, Stefano Zacchiroli <zack <at> upsilon.cc>,
        Romain Francoise <rfrancoise <at> debian.org>
Subject: Re: bug#1072: Viper version is 3.14 of April 06, 2008; can't exit viper insert mode with ESC using emacsclient -t
Date: Fri, 14 Nov 2008 13:22:44 -0800 (PST)
Michael Kifer <kifer <at> cs.sunysb.edu> writes:

  > On Fri, 14 Nov 2008 12:40:21 -0800 (PST)
  > Dan Nicolaescu <dann <at> ics.uci.edu> wrote:
  > 
  > > Michael Kifer <kifer <at> cs.sunysb.edu> writes:
  > > 
  > >   > On Fri, 14 Nov 2008 14:48:14 +0100
  > >   > Stefano Zacchiroli <zack <at> upsilon.cc> wrote:
  > >   > 
  > >   > > 1) viper-ESC-keyseq-timeout is a global variable, shared by all Emacs
  > >   > >    clients, can it be made local to a buffer (actually it would be
  > >   > >    enough to make it local to a client, but I don't believe it is
  > >   > >    possible), or there is some Viper magic which would defeat this
  > >   > >    solution not work?
  > >   > 
  > >   > I don't see a reason why this variable cannot be buffer-local.
  > > 
  > > Disclaimer: I don't know anything about viper.
  > > 
  > > But the above does not sound right: a buffer can be used in both an X11
  > > frame and a tty frame at the same time, so a buffer-local value won't
  > > work.
  > 
  > Yes, you are right. If there is a way to find out whether the selected window
  > is in a terminal frame or X frame then viper-ESC-keyseq-timeout can be made
  > into a function.

If (window-system) is nil, you are using a terminal frame.




Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#1072; Package emacs. Full text and rfc822 format available.

Acknowledgement sent to Stefan Monnier <monnier <at> iro.umontreal.ca>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. Full text and rfc822 format available.

Message #66 received at 1072 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Dan Nicolaescu <dann <at> ics.uci.edu>
Cc: 1072 <at> debbugs.gnu.org, kifer <at> cs.sunysb.edu,
        Romain Francoise <rfrancoise <at> debian.org>,
        Stefano Zacchiroli <zack <at> upsilon.cc>
Subject: Re: bug#1072: Viper version is 3.14 of April 06, 2008; can't exit viper insert mode with ESC using emacsclient -t
Date: Fri, 14 Nov 2008 17:39:30 -0500
>> Yes, you are right. If there is a way to find out whether the selected window
>> is in a terminal frame or X frame then viper-ESC-keyseq-timeout can be made
>> into a function.

> If (window-system) is nil, you are using a terminal frame.

Or if you want code that also works with Emacs-22 (don't know about
XEmacs), you can use (framep (selected-frame)) which also returns info
about the kind of terminal used.


        Stefan




Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#1072; Package emacs. Full text and rfc822 format available.

Acknowledgement sent to kifer <at> cs.sunysb.edu:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. Full text and rfc822 format available.

Message #71 received at 1072 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Michael Kifer <kifer <at> cs.sunysb.edu>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: Dan Nicolaescu <dann <at> ics.uci.edu>, 1072 <at> debbugs.gnu.org,
        Romain Francoise <rfrancoise <at> debian.org>,
        Stefano Zacchiroli
 <zack <at> upsilon.cc>
Subject: Re: bug#1072: Viper version is 3.14 of April 06, 2008; can't exit
 viper insert mode with ESC using emacsclient -t
Date: Fri, 14 Nov 2008 17:46:55 -0500

On Fri, 14 Nov 2008 17:39:30 -0500
Stefan Monnier <monnier <at> iro.umontreal.ca> wrote:

> >> Yes, you are right. If there is a way to find out whether the selected window
> >> is in a terminal frame or X frame then viper-ESC-keyseq-timeout can be made
> >> into a function.
> 
> > If (window-system) is nil, you are using a terminal frame.
> 
> Or if you want code that also works with Emacs-22 (don't know about
> XEmacs), you can use (framep (selected-frame)) which also returns info
> about the kind of terminal used.

Actually, viper has the code for this, which works everywhere.
I forgot about it. All that is needed is to convert viper-ESC-keyseq-timeout
from a var to a function.




Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#1072; Package emacs. Full text and rfc822 format available.

Acknowledgement sent to Stefano Zacchiroli <zack <at> upsilon.cc>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. Full text and rfc822 format available.

Message #76 received at 1072 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Stefano Zacchiroli <zack <at> upsilon.cc>
To: Michael Kifer <kifer <at> cs.sunysb.edu>
Cc: Stefan Monnier <monnier <at> iro.umontreal.ca>,
        Dan Nicolaescu <dann <at> ics.uci.edu>, 1072 <at> debbugs.gnu.org,
        Romain Francoise <rfrancoise <at> debian.org>
Subject: Re: bug#1072: Viper version is 3.14 of April 06, 2008; can't exit
	viper insert mode with ESC using emacsclient -t
Date: Sat, 15 Nov 2008 02:32:41 +0100
On Fri, Nov 14, 2008 at 05:46:55PM -0500, Michael Kifer wrote:
> Actually, viper has the code for this, which works everywhere.
> I forgot about it. All that is needed is to convert viper-ESC-keyseq-timeout
> from a var to a function.

With the risk of looking naive, I'm asking: who will invoke the
function then? Of course we do want the thing to work even when
switching from one X11 frame to a console frame containing the very
same buffer (OK, it is extreme, but still ...). In that case who will
trigger the function execution upon switching from frame to frame?

BTW, if/when you have some proof of concept code I can test it, to
ensure that nothing else remains to be nailed down.

Cheers.

-- 
Stefano Zacchiroli -o- PhD in Computer Science \ PostDoc @ Univ. Paris 7
zack@{upsilon.cc,pps.jussieu.fr,debian.org} -<>- http://upsilon.cc/zack/
Dietro un grande uomo c'è ..|  .  |. Et ne m'en veux pas si je te tutoie
sempre uno zaino ...........| ..: |.... Je dis tu à tous ceux que j'aime




Information forwarded to bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#1072; Package emacs. Full text and rfc822 format available.

Acknowledgement sent to Stefano Zacchiroli <zack <at> upsilon.cc>:
Extra info received and forwarded to list. Copy sent to Emacs Bugs <bug-gnu-emacs <at> gnu.org>. Full text and rfc822 format available.

Message #81 received at 1072 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Stefano Zacchiroli <zack <at> upsilon.cc>
To: Michael Kifer <kifer <at> cs.sunysb.edu>
Cc: 1072 <at> debbugs.gnu.org
Subject: Re: bug#1072: Viper version is 3.14 of April 06, 2008; can't exit
	viper insert mode with ESC using emacsclient -t
Date: Sun, 16 Nov 2008 17:18:47 +0100
On Sun, Nov 16, 2008 at 12:02:52AM -0500, Michael Kifer wrote:
> I committed the changes to cvs.
> Pls see if it solves the problem.

First of all many thanks for the quick feedback!

I took the following 5 files from Emacs CVS:

  viper-cmd.el
  viper.el
  viper-init.el
  viper-keym.el
  viper-util.el

AFAICT they are the only files you touched to implement the fix, is
that correct?

Using those files part of the problem is solved, but not its
entirety. In particular, exiting from insert mode in console clients
works out of the box without needing the hack:

  (setq viper-ESC-key (kbd "ESC"))	;; workaround for #1072

before loading Viper. And that's already great!

Still, typing M-x (or other M-something) does not work appropriately,
i.e. it stills makes Viper exit insert mode. I double checked and in
a freshly run "emacs -nw" it does work as expected.

Nevertheless, the timeout is visibly set properly, I assume via the
new introduced function. Indeed typing ESC in a X11 frame immediately
exits insert mode, while doing that in console has some delay, I guess
the 200 ms which the function correctly return. Evaluating
(viper-ESC-keyseq-timeout) in the two cases confirms that it is the
case.

My best guess at an explanation for the remaining problem is that
there is some additional setting which deserves the same treatment,
but I've no idea about which one ...

Let me know how can I debug this any further.

TIA,
Cheers.

-- 
Stefano Zacchiroli -o- PhD in Computer Science \ PostDoc @ Univ. Paris 7
zack@{upsilon.cc,pps.jussieu.fr,debian.org} -<>- http://upsilon.cc/zack/
Dietro un grande uomo c'è ..|  .  |. Et ne m'en veux pas si je te tutoie
sempre uno zaino ...........| ..: |.... Je dis tu à tous ceux que j'aime




Information stored:
bug#1072; Package emacs. Full text and rfc822 format available.

Acknowledgement sent to Stefano Zacchiroli <zack <at> upsilon.cc>:
Extra info received and filed, but not forwarded. Full text and rfc822 format available.

Message #86 received at 1072-quiet <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Stefano Zacchiroli <zack <at> upsilon.cc>
To: Michael Kifer <kifer <at> cs.sunysb.edu>
Cc: 1072-quiet <at> debbugs.gnu.org
Subject: Re: bug#1072: Viper version is 3.14 of April 06, 2008; can't exit
	viper insert mode with ESC using emacsclient -t
Date: Thu, 20 Nov 2008 14:18:48 +0100
On Sun, Nov 16, 2008 at 08:31:56PM -0500, Michael Kifer wrote:
> Can you give me the exact sequence of steps?

Yes, see below.

> I tried
> emacs -q --daemon -f server-start
> then
> emacsclient -t
> M-x viper-mode
> then I went into the insert mode and did M-x. It didn't leave the insert
> mode.

Correct, the sequence you mention does *not* exhibit the problem. Even
thought that is not surprising, given that the server you are
attaching your client to started as a daemon, and not as a X11 frame,
so I guess it gets the "correct" (wrt console) viper initialization
environment.

The following sequence does exhibit the bug:

  emacs -q -f server-start    # starts an X11 emacs
  M-x viper-mode	      # enable Viper _in the X11_ emacs
  emacsclient -t
  # now M-something leaves insert mode

Note that it is important that it is relevant to enable viper from the
X11 emacs. If you enable viper-mode in the console client everything
is fine.

This is not surprising either, as we've already settled that the
relevant point is where viper gets initialized.

Cheers.

-- 
Stefano Zacchiroli -o- PhD in Computer Science \ PostDoc @ Univ. Paris 7
zack@{upsilon.cc,pps.jussieu.fr,debian.org} -<>- http://upsilon.cc/zack/
Dietro un grande uomo c'è ..|  .  |. Et ne m'en veux pas si je te tutoie
sempre uno zaino ...........| ..: |.... Je dis tu à tous ceux que j'aime




Information stored:
bug#1072; Package emacs. Full text and rfc822 format available.

Acknowledgement sent to kifer <at> cs.sunysb.edu:
Extra info received and filed, but not forwarded. Full text and rfc822 format available.

Message #91 received at 1072-quiet <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Michael Kifer <kifer <at> cs.sunysb.edu>
To: Stefano Zacchiroli <zack <at> upsilon.cc>
Cc: 1072-quiet <at> debbugs.gnu.org
Subject: Re: bug#1072: Viper version is 3.14 of April 06, 2008; can't exit
 viper insert mode with ESC using emacsclient -t
Date: Sat, 22 Nov 2008 01:35:24 -0500
ok, it looks like I fixed that one also in CVS. Pls try.

On Thu, 20 Nov 2008 14:18:48 +0100
Stefano Zacchiroli <zack <at> upsilon.cc> wrote:

> On Sun, Nov 16, 2008 at 08:31:56PM -0500, Michael Kifer wrote:
> > Can you give me the exact sequence of steps?
> 
> Yes, see below.
> 
> > I tried
> > emacs -q --daemon -f server-start
> > then
> > emacsclient -t
> > M-x viper-mode
> > then I went into the insert mode and did M-x. It didn't leave the insert
> > mode.
> 
> Correct, the sequence you mention does *not* exhibit the problem. Even
> thought that is not surprising, given that the server you are
> attaching your client to started as a daemon, and not as a X11 frame,
> so I guess it gets the "correct" (wrt console) viper initialization
> environment.
> 
> The following sequence does exhibit the bug:
> 
>   emacs -q -f server-start    # starts an X11 emacs
>   M-x viper-mode	      # enable Viper _in the X11_ emacs
>   emacsclient -t
>   # now M-something leaves insert mode
> 
> Note that it is important that it is relevant to enable viper from the
> X11 emacs. If you enable viper-mode in the console client everything
> is fine.
> 
> This is not surprising either, as we've already settled that the
> relevant point is where viper gets initialized.
> 
> Cheers.
> 




Tags added: Request was from Stefano Zacchiroli <zack <at> upsilon.cc> to control <at> emacsbugs.donarmstrong.com. (Sat, 22 Nov 2008 16:30:02 GMT) Full text and rfc822 format available.

Information stored:
bug#1072; Package emacs. Full text and rfc822 format available.

Acknowledgement sent to Stefano Zacchiroli <zack <at> upsilon.cc>:
Extra info received and filed, but not forwarded. Full text and rfc822 format available.

Message #98 received at 1072-quiet <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Stefano Zacchiroli <zack <at> upsilon.cc>
To: Michael Kifer <kifer <at> cs.sunysb.edu>
Cc: 1072-quiet <at> debbugs.gnu.org
Subject: Re: bug#1072: Viper version is 3.14 of April 06, 2008; can't exit
	viper insert mode with ESC using emacsclient -t
Date: Sat, 22 Nov 2008 17:21:40 +0100
tags 1072 + pending
thanks

On Sat, Nov 22, 2008 at 01:35:24AM -0500, Michael Kifer wrote:
> ok, it looks like I fixed that one also in CVS. Pls try.

Works as a charm!

Thanks a lot for all your help with this bug.

Cheers.


PS tagging the bug as pending, I've no idea what is the policy in the
   Emacs BTS for actually closing bug reports.

-- 
Stefano Zacchiroli -o- PhD in Computer Science \ PostDoc @ Univ. Paris 7
zack@{upsilon.cc,pps.jussieu.fr,debian.org} -<>- http://upsilon.cc/zack/
Dietro un grande uomo c'è ..|  .  |. Et ne m'en veux pas si je te tutoie
sempre uno zaino ...........| ..: |.... Je dis tu à tous ceux que j'aime




bug closed, send any further explanations to zack <at> upsilon.cc (Stefano Zacchiroli) Request was from Chong Yidong <cyd <at> stupidchicken.com> to control <at> emacsbugs.donarmstrong.com. (Wed, 26 Nov 2008 22:15:05 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> emacsbugs.donarmstrong.com. (Thu, 25 Dec 2008 15:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 16 years and 182 days ago.

Previous Next


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