From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Chong Yidong Newsgroups: gmane.emacs.bugs Subject: bug#1495: emacs -nw inserts unwanted chars if user is impatient Date: Thu, 04 Dec 2008 23:10:35 -0500 Message-ID: <87skp3w9c4.fsf__3761.25461557439$1228451523$gmane$org@cyd.mit.edu> References: <87ljuv92uq.fsf@gmail.com> <87d4g7d9gn.fsf@cyd.mit.edu> <200812042030.mB4KU5Jn003761@mothra.ics.uci.edu> Reply-To: Chong Yidong , 1495@emacsbugs.donarmstrong.com NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1228451451 18804 80.91.229.12 (5 Dec 2008 04:30:51 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 5 Dec 2008 04:30:51 +0000 (UTC) Cc: 1495@emacsbugs.donarmstrong.com, Paul R , emacs-devel@gnu.org To: Dan Nicolaescu Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Dec 05 05:31:54 2008 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.50) id 1L8SM5-00055e-Vx for geb-bug-gnu-emacs@m.gmane.org; Fri, 05 Dec 2008 05:31:54 +0100 Original-Received: from localhost ([127.0.0.1]:41436 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1L8SKv-0000Hk-4t for geb-bug-gnu-emacs@m.gmane.org; Thu, 04 Dec 2008 23:30:41 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1L8SKZ-000099-ET for bug-gnu-emacs@gnu.org; Thu, 04 Dec 2008 23:30:19 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1L8SKX-00008Z-MS for bug-gnu-emacs@gnu.org; Thu, 04 Dec 2008 23:30:18 -0500 Original-Received: from [199.232.76.173] (port=43572 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1L8SKX-00008I-8W for bug-gnu-emacs@gnu.org; Thu, 04 Dec 2008 23:30:17 -0500 Original-Received: from rzlab.ucr.edu ([138.23.92.77]:36819) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1L8SKW-0008Br-M0 for bug-gnu-emacs@gnu.org; Thu, 04 Dec 2008 23:30:17 -0500 Original-Received: from rzlab.ucr.edu (rzlab.ucr.edu [127.0.0.1]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id mB54UDpB023048; Thu, 4 Dec 2008 20:30:14 -0800 Original-Received: (from debbugs@localhost) by rzlab.ucr.edu (8.13.8/8.13.8/Submit) id mB54K5AA019806; Thu, 4 Dec 2008 20:20:05 -0800 X-Loop: don@donarmstrong.com Resent-From: Chong Yidong Resent-To: bug-submit-list@donarmstrong.com Resent-CC: Emacs Bugs Resent-Date: Fri, 05 Dec 2008 04:20:05 +0000 Resent-Message-ID: Resent-Sender: don@donarmstrong.com X-Emacs-PR-Message: report 1495 X-Emacs-PR-Package: emacs X-Emacs-PR-Keywords: Original-Received: via spool by 1495-submit@emacsbugs.donarmstrong.com id=B1495.122845023518072 (code B ref 1495); Fri, 05 Dec 2008 04:20:05 +0000 Original-Received: (at 1495) by emacsbugs.donarmstrong.com; 5 Dec 2008 04:10:35 +0000 Original-Received: from cyd.mit.edu (CYD.MIT.EDU [18.115.2.24]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id mB54AWqT018065 for <1495@emacsbugs.donarmstrong.com>; Thu, 4 Dec 2008 20:10:33 -0800 Original-Received: by cyd.mit.edu (Postfix, from userid 1000) id 23DFE57E1C8; Thu, 4 Dec 2008 23:10:35 -0500 (EST) In-Reply-To: <200812042030.mB4KU5Jn003761@mothra.ics.uci.edu> (Dan Nicolaescu's message of "Thu, 4 Dec 2008 12:30:05 -0800 (PST)") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3) Resent-Date: Thu, 04 Dec 2008 23:30:18 -0500 X-BeenThere: bug-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list 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:22966 Archived-At: Dan Nicolaescu 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