From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Jim Paris Newsgroups: gmane.emacs.bugs Subject: bug#6758: 23.2; xterm.el: please provide an option to not discard input in terminal-init-xterm Date: Thu, 29 Jul 2010 16:15:42 -0400 Message-ID: <87r5im11u9.fsf@psychosis.jim.sh> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: dough.gmane.org 1280437190 2553 80.91.229.12 (29 Jul 2010 20:59:50 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Thu, 29 Jul 2010 20:59:50 +0000 (UTC) Cc: jim@jtan.com To: 6758@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Jul 29 22:59:49 2010 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1OeaCi-0003DD-Ge for geb-bug-gnu-emacs@m.gmane.org; Thu, 29 Jul 2010 22:59:48 +0200 Original-Received: from localhost ([127.0.0.1]:45443 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OeZtg-0001jj-P5 for geb-bug-gnu-emacs@m.gmane.org; Thu, 29 Jul 2010 16:40:08 -0400 Original-Received: from [140.186.70.92] (port=35661 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OeZrl-00009L-Cx for bug-gnu-emacs@gnu.org; Thu, 29 Jul 2010 16:38:24 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OeZrP-0002H7-KY for bug-gnu-emacs@gnu.org; Thu, 29 Jul 2010 16:37:48 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:39420) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OeZrP-0002H3-ID for bug-gnu-emacs@gnu.org; Thu, 29 Jul 2010 16:37:47 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.69) (envelope-from ) id 1OeZlq-0006Uz-CD; Thu, 29 Jul 2010 16:32:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Jim Paris Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 29 Jul 2010 20:32:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 6758 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.128043546924967 (code B ref -1); Thu, 29 Jul 2010 20:32:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 29 Jul 2010 20:31:09 +0000 Original-Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OeZky-0006Ue-Ul for submit@debbugs.gnu.org; Thu, 29 Jul 2010 16:31:09 -0400 Original-Received: from mx10.gnu.org ([199.232.76.166]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OeZkw-0006UH-A1 for submit@debbugs.gnu.org; Thu, 29 Jul 2010 16:31:07 -0400 Original-Received: from lists.gnu.org ([199.232.76.165]:36149) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1OeZlA-0002yn-3c for submit@debbugs.gnu.org; Thu, 29 Jul 2010 16:31:20 -0400 Original-Received: from [140.186.70.92] (port=33644 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OeZl7-0004Re-U1 for bug-gnu-emacs@gnu.org; Thu, 29 Jul 2010 16:31:19 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OeZW5-0007bp-5J for bug-gnu-emacs@gnu.org; Thu, 29 Jul 2010 16:15:46 -0400 Original-Received: from jim.sh ([75.150.123.25]:52820 helo=psychosis.jim.sh) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OeZW5-0007bd-1w for bug-gnu-emacs@gnu.org; Thu, 29 Jul 2010 16:15:45 -0400 Original-Received: from psychosis.jim.sh (localhost [127.0.0.1]) by psychosis.jim.sh (8.14.3/8.14.3/Debian-5+lenny1) with ESMTP id o6TKFgEY031590 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 29 Jul 2010 16:15:42 -0400 Original-Received: (from jim@localhost) by psychosis.jim.sh (8.14.3/8.14.3/Submit) id o6TKFgPB031588; Thu, 29 Jul 2010 16:15:42 -0400 X-Virus-Scanned: clamav-milter 0.96 at psychosis X-Virus-Status: Clean X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list Resent-Date: Thu, 29 Jul 2010 16:32:02 -0400 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) 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: , Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:39061 Archived-At: This bug report will be sent to the Free Software Foundation, not to your local site managers! Please write in English if possible, because the Emacs maintainers usually do not have translators to read other languages for them. Your bug report will be posted to the bug-gnu-emacs@gnu.org mailing list, and to the gnu.emacs.bug news group. Please describe exactly what actions triggered the bug and the precise symptoms of the bug. If you can, give a recipe starting from `emacs -Q': Since upgrading to emacs-23, the terminal-init-xterm function in term/xterm.el performs a "discard-input" followed by a couple of xterm queries. You can see the effect of this in the "recent input" line below -- all I did was start emacs and do M-x report-bug, the preceding input was generated by the xterm in response to terminal-init-xterm's queries. This causes several problems when I start emacs in a terminal: - Everything that I type while emacs is still loading gets discarded. This problem is more common than you might initially think, because I very frequently load emacs and immediately hit C-s to search for something. Now, the C-s gets lost and my search terms go into the buffer instead. To reproduce this, just start emacs (preferably on a slow machine, or one with delays in ~/.emacs, for example) and start typing before emacs has finished loading. Everything typed is lost. - There are race conditions here. If I'm typing when this query-response happens, my typing is discarded by terminal-init-xterm, and the actual xterm response gets inserted directly into my buffer as if I had typed it. Since I type quickly, I see this quite frequently: I load emacs, start typing, and the buffer ends up with "0;251;0c" rather than what I had typed. This one is harder to reproduce, but it is not difficult for me if I just run "emacs -nw" from the commandline and quickly hit "asdfasdf" while it's loading. I understand that the modify-other-keys feature is useful, but this makes emacs-23 difficult to use. Can an option be provided to disable these probes? Maybe we can just skip the discard-input and query/response if the user provides, say, predetermined "xterm-version" and "xterm-background-color" variables in their ~/.emacs? That seems to be the quickest and easiest approach, although it requires user intervention to work around the issue. I can also imagine a more complete fix that would involve not flushing the input buffer, and interpreting the Xterm responses in a more asynchronous fashion: - Don't discard input - Send the \e[>0c probe - Allow input into the buffer as usual, but for the next few seconds, interpret \e[>0;251;0c responses and perform (xterm-turn-on-modify-other-keys) etc. as necessary. -jim If Emacs crashed, and you have the Emacs process in the gdb debugger, please include the output from the following gdb commands: `bt full' and `xbacktrace'. For information about debugging Emacs, please read the file /usr/share/emacs/23.2/etc/DEBUG. In GNU Emacs 23.2.1 (x86_64-pc-linux-gnu, GTK+ Version 2.20.1) of 2010-05-16 on barber, modified by Debian configured using `configure '--build' 'x86_64-linux-gnu' '--build' 'x86_64-linux-gnu' '--prefix=/usr' '--sharedstatedir=/var/lib' '--libexecdir=/usr/lib' '--localstatedir=/var/lib' '--infodir=/usr/share/info' '--mandir=/usr/share/man' '--with-pop=yes' '--enable-locallisppath=/etc/emacs23:/etc/emacs:/usr/local/share/emacs/23.2/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/23.2/site-lisp:/usr/share/emacs/site-lisp:/usr/share/emacs/23.2/leim' '--with-x=yes' '--with-x-toolkit=gtk' '--with-toolkit-scroll-bars' 'build_alias=x86_64-linux-gnu' 'CFLAGS=-DDEBIAN -g -O2' 'LDFLAGS=-g' 'CPPFLAGS='' Important settings: value of $LC_ALL: nil value of $LC_COLLATE: nil value of $LC_CTYPE: en_US.UTF-8 value of $LC_MESSAGES: en_US value of $LC_MONETARY: nil value of $LC_NUMERIC: nil value of $LC_TIME: nil value of $LANG: POSIX value of $XMODIFIERS: nil locale-coding-system: utf-8-unix default enable-multibyte-characters: t Major mode: Text Minor modes in effect: tooltip-mode: t mouse-wheel-mode: t tool-bar-mode: t file-name-shadow-mode: t global-font-lock-mode: t font-lock-mode: t auto-encryption-mode: t auto-compression-mode: t column-number-mode: t line-number-mode: t transient-mark-mode: t Recent input: ESC [ > 0 ; 2 5 1 ; 0 c ESC ] 1 1 ; r g b : 0 0 0 0 / 0 0 0 0 / 0 0 0 0 ESC \ ESC x r e p o r t TAB RE T Recent messages: Loading /etc/emacs/site-start.d/50namazu2.el (source)...done Loading /etc/emacs/site-start.d/50php-elisp.el (source)...done Loading /etc/emacs/site-start.d/50psvn.el (source)...done Loading /etc/emacs/site-start.d/51debian-el.el (source)...done Loading /etc/emacs/site-start.d/70jim.el (source)... Toggling menu-bar-mode off; better pass an explicit argument. Ready. Loading /etc/emacs/site-start.d/70jim.el (source)...done Loading quail/latin-ltx...done Ready. Load-path shadows: /usr/share/emacs/23.2/site-lisp/debian-startup hides /usr/share/emacs/site-lisp/debian-startup /usr/share/emacs23/site-lisp/easypg/epg hides /usr/share/emacs/23.2/lisp/epg /usr/share/emacs23/site-lisp/easypg/epa-mail hides /usr/share/emacs/23.2/lisp/epa-mail /usr/share/emacs23/site-lisp/easypg/epa-dired hides /usr/share/emacs/23.2/lisp/epa-dired /usr/share/emacs23/site-lisp/flim/sha1 hides /usr/share/emacs/23.2/lisp/sha1 /usr/share/emacs23/site-lisp/easypg/epa-file hides /usr/share/emacs/23.2/lisp/epa-file /usr/share/emacs23/site-lisp/emacs-goodies-el/ido hides /usr/share/emacs/23.2/lisp/ido /usr/share/emacs23/site-lisp/flim/md4 hides /usr/share/emacs/23.2/lisp/md4 /usr/share/emacs23/site-lisp/emacs-goodies-el/ibuffer hides /usr/share/emacs/23.2/lisp/ibuffer /usr/share/emacs23/site-lisp/emacs-goodies-el/wdired hides /usr/share/emacs/23.2/lisp/wdired /usr/share/emacs23/site-lisp/flim/hex-util hides /usr/share/emacs/23.2/lisp/hex-util /usr/share/emacs23/site-lisp/easypg/epg-config hides /usr/share/emacs/23.2/lisp/epg-config /usr/share/emacs23/site-lisp/easypg/epa hides /usr/share/emacs/23.2/lisp/epa /usr/share/emacs23/site-lisp/dictionaries-common/ispell hides /usr/share/emacs/23.2/lisp/textmodes/ispell /usr/share/emacs23/site-lisp/emacs-goodies-el/table hides /usr/share/emacs/23.2/lisp/textmodes/table /usr/share/emacs23/site-lisp/dictionaries-common/flyspell hides /usr/share/emacs/23.2/lisp/textmodes/flyspell /usr/share/emacs23/site-lisp/emacs-goodies-el/cfengine hides /usr/share/emacs/23.2/lisp/progmodes/cfengine /usr/share/emacs23/site-lisp/flim/ntlm hides /usr/share/emacs/23.2/lisp/net/ntlm /usr/share/emacs23/site-lisp/flim/hmac-def hides /usr/share/emacs/23.2/lisp/net/hmac-def /usr/share/emacs23/site-lisp/flim/sasl hides /usr/share/emacs/23.2/lisp/net/sasl /usr/share/emacs23/site-lisp/emacs-goodies-el/newsticker hides /usr/share/emacs/23.2/lisp/net/newsticker /usr/share/emacs23/site-lisp/flim/sasl-digest hides /usr/share/emacs/23.2/lisp/net/sasl-digest /usr/share/emacs23/site-lisp/flim/hmac-md5 hides /usr/share/emacs/23.2/lisp/net/hmac-md5 /usr/share/emacs23/site-lisp/flim/sasl-ntlm hides /usr/share/emacs/23.2/lisp/net/sasl-ntlm /usr/share/emacs23/site-lisp/flim/sasl-cram hides /usr/share/emacs/23.2/lisp/net/sasl-cram /usr/share/emacs23/site-lisp/latex-cjk-thai/thai-word hides /usr/share/emacs/23.2/lisp/language/thai-word Features: (shadow sort mail-extr message sendmail regexp-opt ecomplete rfc822 mml mml-sec password-cache mm-decode mm-bodies mm-encode mailcap mail-parse rfc2231 rfc2047 rfc2045 qp ietf-drums mailabbrev nnheader gnus-util netrc time-date mm-util mail-prsvr gmm-utils wid-edit mailheader canlock sha1 sha1-el hex-util hashcash mail-utils warnings emacsbug quail help-mode easymenu view debian-el debian-el-loaddefs path-util byte-opt bytecomp byte-compile advice help-fns advice-preload poe pym static apel-ver product emacs-goodies-el emacs-goodies-custom emacs-goodies-loaddefs epa-setup epa-file epa derived epg epg-config epg-package-info dpkg-dev-el dpkg-dev-el-loaddefs tooltip ediff-hook vc-hooks lisp-float-type mwheel x-win x-dnd font-setting tool-bar dnd fontset image fringe lisp-mode register page menu-bar rfn-eshadow timer select scroll-bar mldrag 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 loaddefs button minibuffer faces cus-face files text-properties overlay md5 base64 format env code-pages mule custom widget hashtable-print-readable backquote make-network-process dbusbind system-font-setting font-render-setting gtk x-toolkit x multi-tty emacs)