From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Chong Yidong Newsgroups: gmane.emacs.devel Subject: Re: emacs -nw inserts unwanted chars if user is impatient Date: Thu, 04 Dec 2008 23:10:35 -0500 Message-ID: <87skp3w9c4.fsf@cyd.mit.edu> References: <87ljuv92uq.fsf@gmail.com> <87d4g7d9gn.fsf@cyd.mit.edu> <200812042030.mB4KU5Jn003761@mothra.ics.uci.edu> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1228450251 16419 80.91.229.12 (5 Dec 2008 04:10:51 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 5 Dec 2008 04:10:51 +0000 (UTC) Cc: 1495@emacsbugs.donarmstrong.com, Paul R , emacs-devel@gnu.org To: Dan Nicolaescu Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Dec 05 05:11:54 2008 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1L8S2i-0000bK-HM for ged-emacs-devel@m.gmane.org; Fri, 05 Dec 2008 05:11:52 +0100 Original-Received: from localhost ([127.0.0.1]:53805 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1L8S1X-0003hT-LT for ged-emacs-devel@m.gmane.org; Thu, 04 Dec 2008 23:10:39 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1L8S1S-0003hE-9g for emacs-devel@gnu.org; Thu, 04 Dec 2008 23:10:34 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1L8S1R-0003h2-48 for emacs-devel@gnu.org; Thu, 04 Dec 2008 23:10:33 -0500 Original-Received: from [199.232.76.173] (port=46424 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1L8S1Q-0003gz-Qx for emacs-devel@gnu.org; Thu, 04 Dec 2008 23:10:32 -0500 Original-Received: from cyd.mit.edu ([18.115.2.24]:45903) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1L8S1Q-0006OP-JZ for emacs-devel@gnu.org; Thu, 04 Dec 2008 23:10:32 -0500 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: Genre and OS details not recognized. X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:106591 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