* emacs -nw inserts unwanted chars if user is impatient
@ 2008-12-04 19:06 Paul R
2008-12-04 19:30 ` Chong Yidong
0 siblings, 1 reply; 8+ messages in thread
From: Paul R @ 2008-12-04 19:06 UTC (permalink / raw
To: emacs-devel
Hi,
I usually work on X version of emacs 23. However, sometime, I just want
to alter a config file from the terminal. In this case I type
emacs -nw conf_file.conf
Very often I know that the line I want to go to is fairly low so before
emacs has finished to load I'm already pressing C-n waiting for the
display to show line and point. I guess a lot of user do the same and
often don't wait for the display to finish before typing what they want.
In this particular case, emacs would insert strange chars at point, for
example : 1;1704;0c
You won't be warned, and it will be saved along with your real
modifications, which is embarassing.
To reproduce, open any multiline file from the terminal, for example
.bash_history, with 'emacs -nw' and immediatly maintain C-n until the
display come up entirely. You should find at point the strange chars.
Tested with emacs23cvs with -Q on Gnu/Linux with xterm and
gnome-terminal.
--
Paul
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: emacs -nw inserts unwanted chars if user is impatient
2008-12-04 19:06 emacs -nw inserts unwanted chars if user is impatient Paul R
@ 2008-12-04 19:30 ` Chong Yidong
2008-12-04 20:30 ` Dan Nicolaescu
2008-12-04 21:52 ` Paul R
0 siblings, 2 replies; 8+ messages in thread
From: Chong Yidong @ 2008-12-04 19:30 UTC (permalink / raw
To: Paul R; +Cc: emacs-devel
Paul R <paul.r.ml@gmail.com> writes:
> I usually work on X version of emacs 23. However, sometime, I just want
> to alter a config file from the terminal. In this case I type
>
> emacs -nw conf_file.conf
>
> Very often I know that the line I want to go to is fairly low so before
> emacs has finished to load I'm already pressing C-n waiting for the
> display to show line and point. I guess a lot of user do the same and
> often don't wait for the display to finish before typing what they want.
Probably the key sequence is getting registered before the keyboard
translation is set up properly. Emacs probably needs to discard this
input instead of trying to deal with it.
Could you file a bug so that we don't forget about this?
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: emacs -nw inserts unwanted chars if user is impatient
2008-12-04 19:30 ` Chong Yidong
@ 2008-12-04 20:30 ` Dan Nicolaescu
2008-12-05 4:10 ` bug#1495: " Chong Yidong
2008-12-05 4:10 ` Chong Yidong
2008-12-04 21:52 ` Paul R
1 sibling, 2 replies; 8+ messages in thread
From: Dan Nicolaescu @ 2008-12-04 20:30 UTC (permalink / raw
To: Chong Yidong; +Cc: Paul R, emacs-devel
Chong Yidong <cyd@stupidchicken.com> writes:
> Paul R <paul.r.ml@gmail.com> writes:
>
> > I usually work on X version of emacs 23. However, sometime, I just want
> > to alter a config file from the terminal. In this case I type
> >
> > emacs -nw conf_file.conf
> >
> > Very often I know that the line I want to go to is fairly low so before
> > emacs has finished to load I'm already pressing C-n waiting for the
> > display to show line and point. I guess a lot of user do the same and
> > often don't wait for the display to finish before typing what they want.
>
> Probably the key sequence is getting registered before the keyboard
> translation is set up properly. Emacs probably needs to discard this
> input instead of trying to deal with it.
I'm fairly confident this is due to the code in xterm.el that deals with
modifyOtherKeys, the input probably comes while emacs is waiting from an
answer from xterm.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: emacs -nw inserts unwanted chars if user is impatient
2008-12-04 19:30 ` Chong Yidong
2008-12-04 20:30 ` Dan Nicolaescu
@ 2008-12-04 21:52 ` Paul R
1 sibling, 0 replies; 8+ messages in thread
From: Paul R @ 2008-12-04 21:52 UTC (permalink / raw
To: Chong Yidong; +Cc: emacs-devel
Chong> Could you file a bug so that we don't forget about this?
Done, it is #1494
--
Paul
^ permalink raw reply [flat|nested] 8+ messages in thread
* bug#1495: emacs -nw inserts unwanted chars if user is impatient
2008-12-04 20:30 ` Dan Nicolaescu
@ 2008-12-05 4:10 ` Chong Yidong
2008-12-05 4:10 ` Chong Yidong
1 sibling, 0 replies; 8+ messages in thread
From: Chong Yidong @ 2008-12-05 4:10 UTC (permalink / raw
To: Dan Nicolaescu; +Cc: 1495, Paul R, emacs-devel
Dan Nicolaescu <dann@ics.uci.edu> writes:
> I'm fairly confident this is due to the code in xterm.el that deals
> with modifyOtherKeys, the input probably comes while emacs is waiting
> from an answer from xterm.
This indeed seems to be the problem.
Discard pending input before doing the terminal query seems to fix the
bug for me. I don't know if it's possible for the user's input to come
inat exactly at the correct moment to fool the terminal query; if so, a
more complicated solution might be required.
Thoughts?
*** trunk/lisp/term/xterm.el.~1.59.~ 2008-09-30 20:01:30.000000000 -0400
--- trunk/lisp/term/xterm.el 2008-12-04 23:07:47.000000000 -0500
***************
*** 475,480 ****
--- 475,481 ----
(str nil))
;; Try to find out the type of terminal by sending a "Secondary
;; Device Attributes (DA)" query.
+ (discard-input)
(send-string-to-terminal "\e[>0c")
;; The reply should be of the form: \e [ > NUMBER1 ; NUMBER2 ; NUMBER3 c
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: emacs -nw inserts unwanted chars if user is impatient
2008-12-04 20:30 ` Dan Nicolaescu
2008-12-05 4:10 ` bug#1495: " Chong Yidong
@ 2008-12-05 4:10 ` Chong Yidong
2008-12-11 16:32 ` bug#1495: " Stefan Monnier
2008-12-11 16:32 ` Stefan Monnier
1 sibling, 2 replies; 8+ messages in thread
From: Chong Yidong @ 2008-12-05 4:10 UTC (permalink / raw
To: Dan Nicolaescu; +Cc: 1495, Paul R, emacs-devel
Dan Nicolaescu <dann@ics.uci.edu> writes:
> I'm fairly confident this is due to the code in xterm.el that deals
> with modifyOtherKeys, the input probably comes while emacs is waiting
> from an answer from xterm.
This indeed seems to be the problem.
Discard pending input before doing the terminal query seems to fix the
bug for me. I don't know if it's possible for the user's input to come
inat exactly at the correct moment to fool the terminal query; if so, a
more complicated solution might be required.
Thoughts?
*** trunk/lisp/term/xterm.el.~1.59.~ 2008-09-30 20:01:30.000000000 -0400
--- trunk/lisp/term/xterm.el 2008-12-04 23:07:47.000000000 -0500
***************
*** 475,480 ****
--- 475,481 ----
(str nil))
;; Try to find out the type of terminal by sending a "Secondary
;; Device Attributes (DA)" query.
+ (discard-input)
(send-string-to-terminal "\e[>0c")
;; The reply should be of the form: \e [ > NUMBER1 ; NUMBER2 ; NUMBER3 c
^ permalink raw reply [flat|nested] 8+ messages in thread
* bug#1495: emacs -nw inserts unwanted chars if user is impatient
2008-12-05 4:10 ` Chong Yidong
@ 2008-12-11 16:32 ` Stefan Monnier
2008-12-11 16:32 ` Stefan Monnier
1 sibling, 0 replies; 8+ messages in thread
From: Stefan Monnier @ 2008-12-11 16:32 UTC (permalink / raw
To: Chong Yidong; +Cc: 1495, Dan Nicolaescu, emacs-devel, Paul R
> Discard pending input before doing the terminal query seems to fix the
> bug for me. I don't know if it's possible for the user's input to come
> inat exactly at the correct moment to fool the terminal query; if so, a
> more complicated solution might be required.
While arguing that there's probably no way to do much better than that,
it occurred to me that "the right way" to do it might be to move the
"check for \e [ > NUMBER1 ; NUMBER2 ; NUMBER3 c and run
xterm-turn-on-modify-other-keys if applicable" into the
input-decode-map.
Stefan
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: emacs -nw inserts unwanted chars if user is impatient
2008-12-05 4:10 ` Chong Yidong
2008-12-11 16:32 ` bug#1495: " Stefan Monnier
@ 2008-12-11 16:32 ` Stefan Monnier
1 sibling, 0 replies; 8+ messages in thread
From: Stefan Monnier @ 2008-12-11 16:32 UTC (permalink / raw
To: Chong Yidong; +Cc: 1495, Dan Nicolaescu, emacs-devel, Paul R
> Discard pending input before doing the terminal query seems to fix the
> bug for me. I don't know if it's possible for the user's input to come
> inat exactly at the correct moment to fool the terminal query; if so, a
> more complicated solution might be required.
While arguing that there's probably no way to do much better than that,
it occurred to me that "the right way" to do it might be to move the
"check for \e [ > NUMBER1 ; NUMBER2 ; NUMBER3 c and run
xterm-turn-on-modify-other-keys if applicable" into the
input-decode-map.
Stefan
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2008-12-11 16:32 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-12-04 19:06 emacs -nw inserts unwanted chars if user is impatient Paul R
2008-12-04 19:30 ` Chong Yidong
2008-12-04 20:30 ` Dan Nicolaescu
2008-12-05 4:10 ` bug#1495: " Chong Yidong
2008-12-05 4:10 ` Chong Yidong
2008-12-11 16:32 ` bug#1495: " Stefan Monnier
2008-12-11 16:32 ` Stefan Monnier
2008-12-04 21:52 ` Paul R
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.