From unknown Wed Jun 25 00:22:45 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#12354 <12354@debbugs.gnu.org> To: bug#12354 <12354@debbugs.gnu.org> Subject: Status: 24.2; garbage inserted at the beginning of the buffer even when xterm-extra-capabilities is t Reply-To: bug#12354 <12354@debbugs.gnu.org> Date: Wed, 25 Jun 2025 07:22:45 +0000 retitle 12354 24.2; garbage inserted at the beginning of the buffer even wh= en xterm-extra-capabilities is t reassign 12354 emacs submitter 12354 Vincent Lefevre severity 12354 normal tag 12354 fixed thanks From debbugs-submit-bounces@debbugs.gnu.org Wed Sep 05 07:17:10 2012 Received: (at submit) by debbugs.gnu.org; 5 Sep 2012 11:17:10 +0000 Received: from localhost ([127.0.0.1]:39638 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1T9DbZ-0003Hr-Oj for submit@debbugs.gnu.org; Wed, 05 Sep 2012 07:17:10 -0400 Received: from eggs.gnu.org ([208.118.235.92]:39836) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1T9DbX-0003Hi-2w for submit@debbugs.gnu.org; Wed, 05 Sep 2012 07:17:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1T9DbL-0000RK-CK for submit@debbugs.gnu.org; Wed, 05 Sep 2012 07:17:01 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.2 Received: from lists.gnu.org ([208.118.235.17]:41045) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T9DbL-0000RG-8k for submit@debbugs.gnu.org; Wed, 05 Sep 2012 07:16:55 -0400 Received: from eggs.gnu.org ([208.118.235.92]:60227) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T9DbF-0003PW-E9 for bug-gnu-emacs@gnu.org; Wed, 05 Sep 2012 07:16:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1T9DbE-0000P1-2x for bug-gnu-emacs@gnu.org; Wed, 05 Sep 2012 07:16:49 -0400 Received: from vinc17.pck.nerim.net ([213.41.242.187]:53426 helo=smtp-xvii.vinc17.net) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T9DbD-0000Oj-OK for bug-gnu-emacs@gnu.org; Wed, 05 Sep 2012 07:16:48 -0400 Received: by xvii.vinc17.org (Postfix, from userid 1000) id 2F7C138C006; Wed, 5 Sep 2012 13:16:45 +0200 (CEST) From: Vincent Lefevre To: bug-gnu-emacs@gnu.org Subject: 24.2; garbage inserted at the beginning of the buffer even when xterm-extra-capabilities is t Date: Wed, 05 Sep 2012 13:16:45 +0200 Message-ID: <87txvcen36.fsf@xvii.vinc17.org> MIME-Version: 1.0 Content-Type: text/plain X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 208.118.235.17 X-Spam-Score: -6.9 (------) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -6.9 (------) When I run emacs -Q -eval '(setq xterm-extra-capabilities t)' tst.c on a remote machine via SSH in an xterm, garbage is sometimes inserted at the beginning of the buffer. Typing "C-h v xterm-extra-capabilities" confirms that xterm-extra-capabilities is set to t. The comments in the following bugs http://debbugs.gnu.org/cgi/bugreport.cgi?bug=6758 http://debbugs.gnu.org/cgi/bugreport.cgi?bug=11129 say that setting xterm-extra-capabilities to t should be a way to avoid the bug (and that's the reason why these bugs have been closed). So, the problem is not solved... or has reappeared. In GNU Emacs 24.2.1 (x86_64-unknown-linux-gnu, GTK+ Version 2.24.10) of 2012-09-05 on xvii Configured using: `configure '--prefix=/usr/local/emacs-24.2' '--enable-asserts'' Important settings: value of $LC_ALL: nil value of $LC_COLLATE: POSIX value of $LC_CTYPE: en_US.UTF-8 value of $LC_MESSAGES: nil value of $LC_MONETARY: nil value of $LC_NUMERIC: nil value of $LC_TIME: en_DK value of $LANG: POSIX value of $XMODIFIERS: nil locale-coding-system: utf-8-unix default enable-multibyte-characters: t Major mode: C/l Minor modes in effect: tooltip-mode: t mouse-wheel-mode: t tool-bar-mode: t menu-bar-mode: t file-name-shadow-mode: t global-font-lock-mode: t font-lock-mode: t auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t line-number-mode: t transient-mark-mode: t abbrev-mode: t Recent input: ESC [ > 0 ; 2 7 8 ; 0 c ESC x r e p o r t - e m TAB RET Recent messages: ("emacs" "-eval" "(setq xterm-extra-capabilities t)" "tst.c") For information about GNU Emacs and the GNU system, type C-h C-a. tst.c has auto save data; consider M-x recover-this-file Auto-saving...done Load-path shadows: None found. Features: (shadow sort gnus-util mail-extr emacsbug message format-spec rfc822 mml mml-sec mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils cc-mode cc-fonts easymenu cc-guess cc-menus cc-cmds cc-styles cc-align cc-engine cc-vars cc-defs regexp-opt time-date tooltip ediff-hook vc-hooks lisp-float-type mwheel x-win x-dnd tool-bar dnd fontset image fringe lisp-mode register page menu-bar rfn-eshadow timer select scroll-bar 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 minibuffer loaddefs button faces cus-face files text-properties overlay sha1 md5 base64 format env code-pages mule custom widget hashtable-print-readable backquote make-network-process dbusbind dynamic-setting system-font-setting font-render-setting move-toolbar gtk x-toolkit x multi-tty emacs) From debbugs-submit-bounces@debbugs.gnu.org Wed Sep 05 12:59:40 2012 Received: (at 12354) by debbugs.gnu.org; 5 Sep 2012 16:59:40 +0000 Received: from localhost ([127.0.0.1]:40695 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1T9Ix2-0004Zl-8N for submit@debbugs.gnu.org; Wed, 05 Sep 2012 12:59:40 -0400 Received: from fencepost.gnu.org ([208.118.235.10]:57464) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1T9Ix0-0004Ze-CT for 12354@debbugs.gnu.org; Wed, 05 Sep 2012 12:59:38 -0400 Received: from rgm by fencepost.gnu.org with local (Exim 4.71) (envelope-from ) id 1T9Iws-00031I-Bx; Wed, 05 Sep 2012 12:59:30 -0400 From: Glenn Morris To: Vincent Lefevre Subject: Re: bug#12354: 24.2; garbage inserted at the beginning of the buffer even when xterm-extra-capabilities is t References: <87txvcen36.fsf@xvii.vinc17.org> X-Spook: Crowell Agfa government 22nd SAS Mena Telex counter X-Ran: *c)A~Q{a^H(LM6YL$-6r;KPy>fh;'9;DtJ~@bQxCn[>nH&m"znh6z^3--Z_nRk>$95"N2r X-Hue: blue X-Debbugs-No-Ack: yes X-Attribution: GM Date: Wed, 05 Sep 2012 12:59:30 -0400 In-Reply-To: <87txvcen36.fsf@xvii.vinc17.org> (Vincent Lefevre's message of "Wed, 05 Sep 2012 13:16:45 +0200") Message-ID: User-Agent: Gnus (www.gnus.org), GNU Emacs (www.gnu.org/software/emacs/) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Spam-Score: -6.9 (------) X-Debbugs-Envelope-To: 12354 Cc: 12354@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -6.9 (------) Vincent Lefevre wrote: > emacs -Q -eval '(setq xterm-extra-capabilities t)' tst.c By experiment, -eval is processed too late to affect the relevant portion of start-up. Try putting the setting in .emacs. From debbugs-submit-bounces@debbugs.gnu.org Wed Sep 05 14:44:36 2012 Received: (at 12354) by debbugs.gnu.org; 5 Sep 2012 18:44:36 +0000 Received: from localhost ([127.0.0.1]:40998 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1T9Kaa-0004HQ-11 for submit@debbugs.gnu.org; Wed, 05 Sep 2012 14:44:36 -0400 Received: from vinc17.pck.nerim.net ([213.41.242.187]:53902 helo=smtp-xvii.vinc17.net) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1T9KaY-0004HI-3x for 12354@debbugs.gnu.org; Wed, 05 Sep 2012 14:44:34 -0400 Received: by xvii.vinc17.org (Postfix, from userid 1000) id D7AF234C004; Wed, 5 Sep 2012 20:44:24 +0200 (CEST) Date: Wed, 5 Sep 2012 20:44:24 +0200 From: Vincent Lefevre To: Glenn Morris Subject: Re: bug#12354: 24.2; garbage inserted at the beginning of the buffer even when xterm-extra-capabilities is t Message-ID: <20120905184424.GQ4846@xvii.vinc17.org> References: <87txvcen36.fsf@xvii.vinc17.org> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline In-Reply-To: X-Mailer-Info: http://www.vinc17.net/mutt/ User-Agent: Mutt/1.5.21-6215-vl-r53514 (2012-07-22) Content-Transfer-Encoding: quoted-printable X-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: 12354 Cc: 12354@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) On 2012-09-05 12:59:30 -0400, Glenn Morris wrote: > Vincent Lefevre wrote: >=20 > > emacs -Q -eval '(setq xterm-extra-capabilities t)' tst.c >=20 > By experiment, -eval is processed too late to affect the relevant > portion of start-up. Try putting the setting in .emacs I had '(xterm-extra-capabilities (quote (modifyOtherKeys reportBackground))) in the custom variables, but got the same problem. --=20 Vincent Lef=E8vre - Web: 100% accessible validated (X)HTML - Blog: Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon) From debbugs-submit-bounces@debbugs.gnu.org Sat Sep 08 05:58:23 2012 Received: (at 12354) by debbugs.gnu.org; 8 Sep 2012 09:58:23 +0000 Received: from localhost ([127.0.0.1]:47832 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TAHny-0003ha-Bb for submit@debbugs.gnu.org; Sat, 08 Sep 2012 05:58:22 -0400 Received: from mail-out.m-online.net ([212.18.0.10]:43889) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TAHnv-0003hS-AL for 12354@debbugs.gnu.org; Sat, 08 Sep 2012 05:58:20 -0400 Received: from frontend1.mail.m-online.net (frontend1.mail.intern.m-online.net [192.168.8.180]) by mail-out.m-online.net (Postfix) with ESMTP id 3XDWD34DXsz3hhVN; Sat, 8 Sep 2012 11:57:55 +0200 (CEST) X-Auth-Info: sOUrn9J5TSGc6//8Yzy60nc7I5L9PFtT84CHM23Tg7U= Received: from linux.local (ppp-93-104-158-104.dynamic.mnet-online.de [93.104.158.104]) by mail.mnet-online.de (Postfix) with ESMTPA id 3XDWD303KZzbbhD; Sat, 8 Sep 2012 11:57:54 +0200 (CEST) Received: by linux.local (Postfix, from userid 501) id 1EFDD1E52FB; Sat, 8 Sep 2012 11:57:51 +0200 (CEST) From: Andreas Schwab To: Vincent Lefevre Subject: Re: bug#12354: 24.2; garbage inserted at the beginning of the buffer even when xterm-extra-capabilities is t References: <87txvcen36.fsf@xvii.vinc17.org> X-Yow: I know things about TROY DONAHUE that can't even be PRINTED!! Date: Sat, 08 Sep 2012 11:57:50 +0200 In-Reply-To: <87txvcen36.fsf@xvii.vinc17.org> (Vincent Lefevre's message of "Wed, 05 Sep 2012 13:16:45 +0200") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: 12354 Cc: 12354@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) Does this help? Andreas. diff --git a/lisp/term/xterm.el b/lisp/term/xterm.el index 28fb9da..b93bc5e 100644 --- a/lisp/term/xterm.el +++ b/lisp/term/xterm.el @@ -519,6 +519,9 @@ The relevant features are: ;; Device Attributes (DA)" query. (send-string-to-terminal "\e[>0c") + ;; Wait a bit before trying to read the answer + (sleep-for 0.1) + ;; The reply should be: \e [ > NUMBER1 ; NUMBER2 ; NUMBER3 c ;; If the timeout is completely removed for read-event, this ;; might hang for terminals that pretend to be xterm, but don't @@ -541,6 +544,7 @@ The relevant features are: (>= version 242))) (discard-input) (send-string-to-terminal "\e]11;?\e\\") + (sleep-for 0.1) (when (and (equal (read-event nil nil 2) ?\e) (equal (read-event nil nil 2) ?\])) (setq str "") -- Andreas Schwab, schwab@linux-m68k.org GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5 "And now for something completely different." From debbugs-submit-bounces@debbugs.gnu.org Sat Sep 08 07:01:08 2012 Received: (at 12354) by debbugs.gnu.org; 8 Sep 2012 11:01:08 +0000 Received: from localhost ([127.0.0.1]:47887 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TAImf-0005Bo-Tv for submit@debbugs.gnu.org; Sat, 08 Sep 2012 07:01:07 -0400 Received: from vinc17.pck.nerim.net ([213.41.242.187]:58314 helo=smtp-xvii.vinc17.net) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TAImc-0005Bd-Ml for 12354@debbugs.gnu.org; Sat, 08 Sep 2012 07:01:04 -0400 Received: by xvii.vinc17.org (Postfix, from userid 1000) id 4D6FA34C004; Sat, 8 Sep 2012 13:00:38 +0200 (CEST) Date: Sat, 8 Sep 2012 13:00:38 +0200 From: Vincent Lefevre To: Andreas Schwab Subject: Re: bug#12354: 24.2; garbage inserted at the beginning of the buffer even when xterm-extra-capabilities is t Message-ID: <20120908110038.GX4846@xvii.vinc17.org> References: <87txvcen36.fsf@xvii.vinc17.org> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline In-Reply-To: X-Mailer-Info: http://www.vinc17.net/mutt/ User-Agent: Mutt/1.5.21-6215-vl-r53514 (2012-07-22) Content-Transfer-Encoding: quoted-printable X-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: 12354 Cc: 12354@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) On 2012-09-08 11:57:50 +0200, Andreas Schwab wrote: > Does this help? Not tried yet, but due to high-latency connection, several seconds may be needed. I can see 2 solutions: * Have a way to disable this check (early enough, of course), letting the user to provide information in another way if he wants to benefit from additional features. For instance, how about checking an environment variable first, which could hold the data Emacs is looking for or just tell Emacs not to do the check? An environment variable would be fine, as it could be set by the terminal (or the initial shell) and transmitted by SSH (if the variable name starts with LC_, it wouldn't require specific config in practice). * Wait *until* the string is sent back by the terminal. Because of race condition (due to a possibly high-latency connection), Emacs needs to separate user input from the string in question (this would be a heuristic, but may work). --=20 Vincent Lef=E8vre - Web: 100% accessible validated (X)HTML - Blog: Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon) From debbugs-submit-bounces@debbugs.gnu.org Wed May 27 07:27:28 2015 Received: (at 12354) by debbugs.gnu.org; 27 May 2015 11:27:28 +0000 Received: from localhost ([127.0.0.1]:57972 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YxZUd-0003vL-QR for submit@debbugs.gnu.org; Wed, 27 May 2015 07:27:28 -0400 Received: from ypig.lip.ens-lyon.fr ([140.77.13.48]:47483) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YxZUb-0003v8-5a for 12354@debbugs.gnu.org; Wed, 27 May 2015 07:27:26 -0400 Received: from vlefevre by ypig.lip.ens-lyon.fr with local (Exim 4.85) (envelope-from ) id 1YxZUZ-0002Yo-QX; Wed, 27 May 2015 13:27:23 +0200 Date: Wed, 27 May 2015 13:27:23 +0200 From: Vincent Lefevre To: Glenn Morris Subject: Re: bug#12354: 24.2; garbage inserted at the beginning of the buffer even when xterm-extra-capabilities is t Message-ID: <20150527112723.GA23516@ypig.lip.ens-lyon.fr> References: <87txvcen36.fsf@xvii.vinc17.org> <20120905184424.GQ4846@xvii.vinc17.org> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20120905184424.GQ4846@xvii.vinc17.org> X-Mailer-Info: https://www.vinc17.net/mutt/ User-Agent: Mutt/1.5.23-6449-vl-r76280 (2015-05-18) X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 12354 Cc: 12354@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.0 (/) On 2012-09-05 20:44:24 +0200, Vincent Lefevre wrote: > On 2012-09-05 12:59:30 -0400, Glenn Morris wrote: > > Vincent Lefevre wrote: > > > > > emacs -Q -eval '(setq xterm-extra-capabilities t)' tst.c > > > > By experiment, -eval is processed too late to affect the relevant > > portion of start-up. Try putting the setting in .emacs > > I had > > '(xterm-extra-capabilities (quote (modifyOtherKeys reportBackground))) > > in the custom variables, but got the same problem. The .emacs is executed too late as well: if I introduce an error in the code below (e.g. zzz before the first when), I can see it reported. In xterm.el, the problem is: (if (eq xterm-extra-capabilities 'check) ;; Try to find out the type of terminal by sending a "Secondary ;; Device Attributes (DA)" query. (xterm--query "\e[>0c" ;; Some terminals (like OS X's Terminal.app) respond to ;; this query as if it were a "Primary Device Attributes" ;; query instead, so we should handle that too. '(("\e[?" . xterm--version-handler) ("\e[>" . xterm--version-handler))) (when (memq 'reportBackground xterm-extra-capabilities) (xterm--query "\e]11;?\e\\" '(("\e]11;" . xterm--report-background-handler)))) (when (memq 'modifyOtherKeys xterm-extra-capabilities) (terminal-init-xterm-modify-other-keys))) If I introduce a network delay with: tc qdisc add dev eth0 root netem delay 2000ms the problem always occurs. But if I also remove the above code, then it no longer occurs. So, the above (eq xterm-extra-capabilities 'check) test seems to be useless, and there should be a way to disable it. IMHO, this query is ugly and should be removed entirely in favor of checking the environment, in addition to user side settings. If the issue is that not all xterm's behave in the same way because of new features, you can test the XTERM_VERSION environment variable. If the default guess is not OK, the user should have a way to fix it in his ".emacs". -- Vincent Lefèvre - Web: 100% accessible validated (X)HTML - Blog: Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon) From debbugs-submit-bounces@debbugs.gnu.org Sun Jun 28 21:01:14 2015 Received: (at 12354) by debbugs.gnu.org; 29 Jun 2015 01:01:14 +0000 Received: from localhost ([127.0.0.1]:60664 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Z9NRg-0001dD-TK for submit@debbugs.gnu.org; Sun, 28 Jun 2015 21:01:13 -0400 Received: from ironport2-out.teksavvy.com ([206.248.154.181]:26582) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Z9NRc-0001ce-Ii for 12354@debbugs.gnu.org; Sun, 28 Jun 2015 21:01:10 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A0CtCwA731xV/2cGNJ1cgxCEAsEMCYdLBAICgTw5FAEBAQEBAQGBCkEFg10BAQMBViMFCws0BwsUGA0kiDcIzyMBAQEBBgEBAQEeizqFBQeELQWfF5IUg1kjgjuBWSKCeAEBAQ X-IPAS-Result: A0CtCwA731xV/2cGNJ1cgxCEAsEMCYdLBAICgTw5FAEBAQEBAQGBCkEFg10BAQMBViMFCws0BwsUGA0kiDcIzyMBAQEBBgEBAQEeizqFBQeELQWfF5IUg1kjgjuBWSKCeAEBAQ X-IronPort-AV: E=Sophos;i="5.13,465,1427774400"; d="scan'208";a="128741194" Received: from 157-52-6-103.cpe.teksavvy.com (HELO pastel.home) ([157.52.6.103]) by ironport2-out.teksavvy.com with ESMTP; 28 Jun 2015 21:01:02 -0400 Received: by pastel.home (Postfix, from userid 20848) id 512DA614BA; Sun, 28 Jun 2015 21:01:02 -0400 (EDT) From: Stefan Monnier To: Vincent Lefevre Subject: Re: bug#12354: 24.2; garbage inserted at the beginning of the buffer even when xterm-extra-capabilities is t Message-ID: References: <87txvcen36.fsf@xvii.vinc17.org> <20120905184424.GQ4846@xvii.vinc17.org> <20150527112723.GA23516@ypig.lip.ens-lyon.fr> Date: Sun, 28 Jun 2015 21:01:02 -0400 In-Reply-To: <20150527112723.GA23516@ypig.lip.ens-lyon.fr> (Vincent Lefevre's message of "Wed, 27 May 2015 13:27:23 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.3 (/) X-Debbugs-Envelope-To: 12354 Cc: Glenn Morris , 12354@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.3 (/) >> > By experiment, -eval is processed too late to affect the relevant >> > portion of start-up. Try putting the setting in .emacs >> I had >> '(xterm-extra-capabilities (quote (modifyOtherKeys reportBackground))) >> in the custom variables, but got the same problem. > The .emacs is executed too late as well: That's not my experience: I added (message "xterm-extra-capabilities = %S" xterm-extra-capabilities) right before the `if' and it does give me the value I set in my ~/.emacs. > if I introduce an error in the > code below (e.g. zzz before the first when), I can see it reported. That seems right as well: the code after (xterm--query "\e[>0c" ...) is run only if (eq xterm-extra-capabilities 'check) is false, i.e. only if your ~/.emacs code was run. > So, the above (eq xterm-extra-capabilities 'check) test seems to be > useless, and there should be a way to disable it. It works for my test (which is "emacs -nw"). > IMHO, this query is ugly and should be removed entirely in favor of > checking the environment, in addition to user side settings. If the > issue is that not all xterm's behave in the same way because of new > features, you can test the XTERM_VERSION environment variable. echo "$XTERM_VERSION" returns the empty string for me (running in an xterm, under Debian testing). It's just one datapoint, maybe there are cases where it works, but at least not for my own usecase. Stefan From debbugs-submit-bounces@debbugs.gnu.org Sun Jun 28 22:35:24 2015 Received: (at 12354) by debbugs.gnu.org; 29 Jun 2015 02:35:24 +0000 Received: from localhost ([127.0.0.1]:60695 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Z9Oup-0003tY-Dd for submit@debbugs.gnu.org; Sun, 28 Jun 2015 22:35:24 -0400 Received: from ioooi.vinc17.net ([92.243.22.117]:35094) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Z9Oun-0003tP-1B for 12354@debbugs.gnu.org; Sun, 28 Jun 2015 22:35:21 -0400 Received: from smtp-xvii.vinc17.net (128.119.75.86.rev.sfr.net [86.75.119.128]) by ioooi.vinc17.net (Postfix) with ESMTPSA id CEDBA56E; Mon, 29 Jun 2015 04:35:19 +0200 (CEST) Received: by xvii.vinc17.org (Postfix, from userid 1000) id 8502221A07D; Mon, 29 Jun 2015 04:35:19 +0200 (CEST) Date: Mon, 29 Jun 2015 04:35:19 +0200 From: Vincent Lefevre To: Stefan Monnier Subject: Re: bug#12354: 24.2; garbage inserted at the beginning of the buffer even when xterm-extra-capabilities is t Message-ID: <20150629023519.GA7712@xvii.vinc17.org> References: <87txvcen36.fsf@xvii.vinc17.org> <20120905184424.GQ4846@xvii.vinc17.org> <20150527112723.GA23516@ypig.lip.ens-lyon.fr> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Mailer-Info: https://www.vinc17.net/mutt/ User-Agent: Mutt/1.5.23-6457-vl-r76280 (2015-06-26) X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 12354 Cc: Glenn Morris , 12354@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) On 2015-06-28 21:01:02 -0400, Stefan Monnier wrote: > >> > By experiment, -eval is processed too late to affect the relevant > >> > portion of start-up. Try putting the setting in .emacs > >> I had > >> '(xterm-extra-capabilities (quote (modifyOtherKeys reportBackground))) > >> in the custom variables, but got the same problem. > > The .emacs is executed too late as well: > > That's not my experience: I added > > (message "xterm-extra-capabilities = %S" xterm-extra-capabilities) > > right before the `if' and it does give me the value I set in my ~/.emacs. Sorry, I agree. I had removed too much code in my test: the whole "if", including the ELSE part. In fact, reportBackground also yields the garbage problem. So, there's a bug here: (when (memq 'reportBackground xterm-extra-capabilities) (xterm--query "\e]11;?\e\\" '(("\e]11;" . xterm--report-background-handler)))) If I understand correctly, there's a timeout here, but since the feature is claimed to be supported, the timeout should be removed. > > IMHO, this query is ugly and should be removed entirely in favor of > > checking the environment, in addition to user side settings. If the > > issue is that not all xterm's behave in the same way because of new > > features, you can test the XTERM_VERSION environment variable. > > echo "$XTERM_VERSION" > > returns the empty string for me (running in an xterm, under Debian testing). Debian 6.0.10: $ echo $XTERM_VERSION XTerm(261) Debian 7.8: $ echo $XTERM_VERSION XTerm(278) Debian 8.1: $ echo $XTERM_VERSION XTerm(312) Debian unstable: $ echo $XTERM_VERSION XTerm(318) However it is not passed by default via SSH, though this could be fixed in later versions. Now, the end user can set the value of xterm-extra-capabilities depending on $XTERM_VERSION. The only remaining problem is the one I've mentioned above. -- Vincent Lefèvre - Web: 100% accessible validated (X)HTML - Blog: Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon) From debbugs-submit-bounces@debbugs.gnu.org Mon Jun 29 09:12:10 2015 Received: (at 12354) by debbugs.gnu.org; 29 Jun 2015 13:12:10 +0000 Received: from localhost ([127.0.0.1]:60985 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Z9Yr3-0005Ap-P4 for submit@debbugs.gnu.org; Mon, 29 Jun 2015 09:12:10 -0400 Received: from ironport2-out.teksavvy.com ([206.248.154.181]:10399) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Z9Yr1-0005Ac-SY for 12354@debbugs.gnu.org; Mon, 29 Jun 2015 09:12:08 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A0CVDQA731xV/2cGNJ1cgxCEAsEVh0sEAgKBPDsSAQEBAQEBAYEKQQWDXQEBAwFWIwULCzQHCxQYDSSINwjPIwEBAQEGAQEBAR6LOoUFB4QtBZ8XhmmLK4NZI4FmIR8VgVkigngBAQE X-IPAS-Result: A0CVDQA731xV/2cGNJ1cgxCEAsEVh0sEAgKBPDsSAQEBAQEBAYEKQQWDXQEBAwFWIwULCzQHCxQYDSSINwjPIwEBAQEGAQEBAR6LOoUFB4QtBZ8XhmmLK4NZI4FmIR8VgVkigngBAQE X-IronPort-AV: E=Sophos;i="5.13,465,1427774400"; d="scan'208";a="128774923" Received: from 157-52-6-103.cpe.teksavvy.com (HELO pastel.home) ([157.52.6.103]) by ironport2-out.teksavvy.com with ESMTP; 29 Jun 2015 09:12:01 -0400 Received: by pastel.home (Postfix, from userid 20848) id B920E5F788; Mon, 29 Jun 2015 09:12:01 -0400 (EDT) From: Stefan Monnier To: Vincent Lefevre Subject: Re: bug#12354: 24.2; garbage inserted at the beginning of the buffer even when xterm-extra-capabilities is t Message-ID: References: <87txvcen36.fsf@xvii.vinc17.org> <20120905184424.GQ4846@xvii.vinc17.org> <20150527112723.GA23516@ypig.lip.ens-lyon.fr> <20150629023519.GA7712@xvii.vinc17.org> Date: Mon, 29 Jun 2015 09:12:01 -0400 In-Reply-To: <20150629023519.GA7712@xvii.vinc17.org> (Vincent Lefevre's message of "Mon, 29 Jun 2015 04:35:19 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.3 (/) X-Debbugs-Envelope-To: 12354 Cc: Glenn Morris , 12354@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.3 (/) > In fact, reportBackground also yields the garbage problem. > So, there's a bug here: > (when (memq 'reportBackground xterm-extra-capabilities) > (xterm--query "\e]11;?\e\\" > '(("\e]11;" . xterm--report-background-handler)))) > If I understand correctly, there's a timeout here, but since the > feature is claimed to be supported, the timeout should be removed. The timeout is present because we prefer having garbage in those (presumably rare) cases where the terminal answers too late, over having Emacs hang forever (tho it's not a hard-hang) when the terminal doesn't understand the request. You try the patch below, and set xterm-query-timeout to some value of your choosing (e.g. nil). Stefan diff --git a/lisp/term/xterm.el b/lisp/term/xterm.el index 45da1bd..54c46de 100644 --- a/lisp/term/xterm.el +++ b/lisp/term/xterm.el @@ -688,6 +688,10 @@ string bytes that can be copied is 3/4 of this value." ;;(xterm--init-activate-get-selection) (xterm--init-activate-set-selection)))))) +(defvar xterm-query-timeout 2 + "Seconds to wait for an answer from the terminal. +Can be nil to mean \"no timeout\".") + (defun xterm--query (query handlers &optional no-async) "Send QUERY string to the terminal and watch for a response. HANDLERS is an alist with elements of the form (STRING . FUNCTION). @@ -696,7 +700,8 @@ We run the first FUNCTION whose STRING matches the input events." ;; rather annoying (bug#6758). Maybe we could always use the asynchronous ;; approach, but it's less tested. ;; FIXME: Merge the two branches. - (if (and (input-pending-p) (not no-async)) + (if (and (or (null xterm-query-timeout) (input-pending-p)) + (not no-async)) (progn (dolist (handler handlers) (define-key input-decode-map (car handler) @@ -714,7 +719,7 @@ We run the first FUNCTION whose STRING matches the input events." (let ((handler (pop handlers)) (i 0)) (while (and (< i (length (car handler))) - (let ((evt (read-event nil nil 2))) + (let ((evt (read-event nil nil xterm-query-timeout))) (or (eq evt (aref (car handler) i)) (progn (if evt (push evt unread-command-events)) nil)))) > However it is not passed by default via SSH, Ah, indeed, that's my case: I almost only use "-nw" in an SSH session. Stefan From debbugs-submit-bounces@debbugs.gnu.org Mon Jun 29 09:47:12 2015 Received: (at 12354) by debbugs.gnu.org; 29 Jun 2015 13:47:12 +0000 Received: from localhost ([127.0.0.1]:32772 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Z9ZOx-0005xJ-Ha for submit@debbugs.gnu.org; Mon, 29 Jun 2015 09:47:11 -0400 Received: from ypig.lip.ens-lyon.fr ([140.77.13.48]:59301) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Z9ZOu-0005x8-AS for 12354@debbugs.gnu.org; Mon, 29 Jun 2015 09:47:09 -0400 Received: from vlefevre by ypig.lip.ens-lyon.fr with local (Exim 4.86_RC4) (envelope-from ) id 1Z9ZOq-0004Do-4d; Mon, 29 Jun 2015 15:47:04 +0200 Date: Mon, 29 Jun 2015 15:47:04 +0200 From: Vincent Lefevre To: Stefan Monnier Subject: Re: bug#12354: 24.2; garbage inserted at the beginning of the buffer even when xterm-extra-capabilities is t Message-ID: <20150629134704.GD32461@ypig.lip.ens-lyon.fr> References: <87txvcen36.fsf@xvii.vinc17.org> <20120905184424.GQ4846@xvii.vinc17.org> <20150527112723.GA23516@ypig.lip.ens-lyon.fr> <20150629023519.GA7712@xvii.vinc17.org> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Mailer-Info: https://www.vinc17.net/mutt/ User-Agent: Mutt/1.5.23-6455-vl-r76280 (2015-06-26) X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 12354 Cc: Glenn Morris , 12354@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.0 (/) On 2015-06-29 09:12:01 -0400, Stefan Monnier wrote: > > In fact, reportBackground also yields the garbage problem. > > So, there's a bug here: > > > (when (memq 'reportBackground xterm-extra-capabilities) > > (xterm--query "\e]11;?\e\\" > > '(("\e]11;" . xterm--report-background-handler)))) > > > If I understand correctly, there's a timeout here, but since the > > feature is claimed to be supported, the timeout should be removed. > > The timeout is present because we prefer having garbage in those > (presumably rare) cases where the terminal answers too late, over having > Emacs hang forever (tho it's not a hard-hang) when the terminal doesn't > understand the request. Won't C-g have any effect? In such a case, the user could hit C-g then modify his settings. Or see below. Note that reaching the timeout isn't that rare. It happened recently to someone else here, who didn't notice and committed his changes to the repository, with the consequence that the file could no longer be compiled. IMHO, with the default configuration (i.e. with "check"), Emacs should make sure that files cannot be silently corrupted. Perhaps, in case of timeout and some data have been written to the buffer before a cursor move, Emacs should warn about this when the user saves the buffer (or perhaps earlier). When this happens, there are two possibilities: 1. There is indeed garbage because the terminal was slow to respond, and the user removes this garbage (and he may want to increase the timeout value, in particular if this occurs too often). 2. No garbage, the terminal didn't respond, in which case the user may want to modify his configuration to avoid a timeout in all cases. So, in either case, the warning would be beneficial to the user. > You try the patch below, and set xterm-query-timeout to some value of > your choosing (e.g. nil). Thanks. -- Vincent Lefèvre - Web: 100% accessible validated (X)HTML - Blog: Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon) From debbugs-submit-bounces@debbugs.gnu.org Tue Jun 30 10:04:44 2015 Received: (at 12354) by debbugs.gnu.org; 30 Jun 2015 14:04:45 +0000 Received: from localhost ([127.0.0.1]:34565 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Z9w9U-0004NH-JP for submit@debbugs.gnu.org; Tue, 30 Jun 2015 10:04:44 -0400 Received: from pruche.dit.umontreal.ca ([132.204.246.22]:41905) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Z9w9S-0004N9-NV for 12354@debbugs.gnu.org; Tue, 30 Jun 2015 10:04:43 -0400 Received: from ceviche.home (lechon.iro.umontreal.ca [132.204.27.242]) by pruche.dit.umontreal.ca (8.14.1/8.14.1) with ESMTP id t5UE4eRZ000327; Tue, 30 Jun 2015 10:04:40 -0400 Received: by ceviche.home (Postfix, from userid 20848) id E76A56625D; Tue, 30 Jun 2015 10:04:39 -0400 (EDT) From: Stefan Monnier To: Vincent Lefevre Subject: Re: bug#12354: 24.2; garbage inserted at the beginning of the buffer even when xterm-extra-capabilities is t Message-ID: References: <87txvcen36.fsf@xvii.vinc17.org> <20120905184424.GQ4846@xvii.vinc17.org> <20150527112723.GA23516@ypig.lip.ens-lyon.fr> <20150629023519.GA7712@xvii.vinc17.org> <20150629134704.GD32461@ypig.lip.ens-lyon.fr> Date: Tue, 30 Jun 2015 10:04:39 -0400 In-Reply-To: <20150629134704.GD32461@ypig.lip.ens-lyon.fr> (Vincent Lefevre's message of "Mon, 29 Jun 2015 15:47:04 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-NAI-Spam-Flag: NO X-NAI-Spam-Threshold: 5 X-NAI-Spam-Score: 0 X-NAI-Spam-Rules: 1 Rules triggered RV5353=0 X-NAI-Spam-Version: 2.3.0.9393 : core <5353> : inlines <3303> : streams <1463976> : uri <1973003> X-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: 12354 Cc: Glenn Morris , 12354@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.9 (-) >> The timeout is present because we prefer having garbage in those >> (presumably rare) cases where the terminal answers too late, over having >> Emacs hang forever (tho it's not a hard-hang) when the terminal doesn't >> understand the request. > Won't C-g have any effect? As I said, it's not a hard hang. Even just hitting any key should get you out of it (but the key is eaten along the way). > Perhaps, in case of timeout and some data have been written to the > buffer before a cursor move, Emacs should warn about this when the > user saves the buffer (or perhaps earlier). When this happens, there > are two possibilities: If you look at the code, you'll hopefully see that there are 2 code paths (one synchronous with a timeout, and one asynchronous), and a comment saying that the two should be merged. I.e. when using the synchronous path, after hitting the timeout, we should switch to the async path. Or simply just "always" use the async path. Stefan From debbugs-submit-bounces@debbugs.gnu.org Tue Jun 30 23:19:20 2015 Received: (at 12354) by debbugs.gnu.org; 1 Jul 2015 03:19:20 +0000 Received: from localhost ([127.0.0.1]:35003 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZA8YR-00061V-MK for submit@debbugs.gnu.org; Tue, 30 Jun 2015 23:19:20 -0400 Received: from ironport2-out.teksavvy.com ([206.248.154.181]:27101) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZA8YP-00061I-Rv for 12354@debbugs.gnu.org; Tue, 30 Jun 2015 23:19:19 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A0CgDQA731xV/2cGNJ1cgxCEAsYTgk0EAgKBPD0QAQEBAQEBAYEKQQWDXQEBAwFWIwULCzQHCxQYDSSINwjPIwEBAQEBBQEBAQEeizqFBQeELQWYO4ZchmmLK4NZI4FmIR8VgVkigngBAQE X-IPAS-Result: A0CgDQA731xV/2cGNJ1cgxCEAsYTgk0EAgKBPD0QAQEBAQEBAYEKQQWDXQEBAwFWIwULCzQHCxQYDSSINwjPIwEBAQEBBQEBAQEeizqFBQeELQWYO4ZchmmLK4NZI4FmIR8VgVkigngBAQE X-IronPort-AV: E=Sophos;i="5.13,465,1427774400"; d="scan'208";a="128926524" Received: from 157-52-6-103.cpe.teksavvy.com (HELO pastel.home) ([157.52.6.103]) by ironport2-out.teksavvy.com with ESMTP; 30 Jun 2015 23:19:12 -0400 Received: by pastel.home (Postfix, from userid 20848) id E48515FE1B; Tue, 30 Jun 2015 23:19:11 -0400 (EDT) From: Stefan Monnier To: Vincent Lefevre Subject: Re: bug#12354: 24.2; garbage inserted at the beginning of the buffer even when xterm-extra-capabilities is t Message-ID: References: <87txvcen36.fsf@xvii.vinc17.org> <20120905184424.GQ4846@xvii.vinc17.org> <20150527112723.GA23516@ypig.lip.ens-lyon.fr> <20150629023519.GA7712@xvii.vinc17.org> <20150629134704.GD32461@ypig.lip.ens-lyon.fr> Date: Tue, 30 Jun 2015 23:19:11 -0400 In-Reply-To: (Stefan Monnier's message of "Tue, 30 Jun 2015 10:04:39 -0400") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.3 (/) X-Debbugs-Envelope-To: 12354 Cc: Glenn Morris , 12354@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.3 (/) > If you look at the code, you'll hopefully see that there are 2 code > paths (one synchronous with a timeout, and one asynchronous), and > a comment saying that the two should be merged. > I.e. when using the synchronous path, after hitting the timeout, we > should switch to the async path. > Or simply just "always" use the async path. I installed the patch below which switches to the async method in case of a timeout. That should hopefully solve your use case. Stefan diff --git a/lisp/term/xterm.el b/lisp/term/xterm.el index f7f8007..350ab3c 100644 --- a/lisp/term/xterm.el +++ b/lisp/term/xterm.el @@ -688,6 +688,10 @@ string bytes that can be copied is 3/4 of this value." ;;(xterm--init-activate-get-selection) (xterm--init-activate-set-selection)))))) +(defvar xterm-query-timeout 2 + "Seconds to wait for an answer from the terminal. +Can be nil to mean \"no timeout\".") + (defun xterm--query (query handlers &optional no-async) "Send QUERY string to the terminal and watch for a response. HANDLERS is an alist with elements of the form (STRING . FUNCTION). @@ -696,25 +696,37 @@ ;; rather annoying (bug#6758). Maybe we could always use the asynchronous ;; approach, but it's less tested. ;; FIXME: Merge the two branches. - (if (and (input-pending-p) (not no-async)) - (progn + (let ((register + (lambda (handlers) (dolist (handler handlers) (define-key input-decode-map (car handler) (lambda (&optional _prompt) - ;; Unregister the handler, since we don't expect further answers. + ;; Unregister the handler, since we don't expect + ;; further answers. (dolist (handler handlers) (define-key input-decode-map (car handler) nil)) (funcall (cdr handler)) - []))) + [])))))) + (if (and (or (null xterm-query-timeout) (input-pending-p)) + (not no-async)) + (progn + (funcall register handlers) (send-string-to-terminal query)) ;; Pending input can be mistakenly returned by the calls to - ;; read-event below. Discard it. + ;; read-event below: discard it. + (discard-input) (send-string-to-terminal query) (while handlers (let ((handler (pop handlers)) (i 0)) (while (and (< i (length (car handler))) - (let ((evt (read-event nil nil 2))) + (let ((evt (read-event nil nil xterm-query-timeout))) + (if (and (null evt) (= i 0) (not no-async)) + ;; Timeout on the first event: fallback on async. + (progn + (funcall register (cons handler handlers)) + (setq handlers nil) + nil) (or (eq evt (aref (car handler) i)) (progn (if evt (push evt unread-command-events)) nil)))) @@ -724,7 +736,7 @@ (funcall (cdr handler))) (while (> i 0) (push (aref (car handler) (setq i (1- i))) - unread-command-events))))))) + unread-command-events))))))))) (defun xterm--push-map (map basemap) ;; Use inheritance to let the main keymaps override those defaults. From debbugs-submit-bounces@debbugs.gnu.org Wed Jul 01 11:01:48 2015 Received: (at 12354) by debbugs.gnu.org; 1 Jul 2015 15:01:48 +0000 Received: from localhost ([127.0.0.1]:36150 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZAJWF-0000C8-Mk for submit@debbugs.gnu.org; Wed, 01 Jul 2015 11:01:48 -0400 Received: from ioooi.vinc17.net ([92.243.22.117]:35733) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZAJWD-0000Bw-3i for 12354@debbugs.gnu.org; Wed, 01 Jul 2015 11:01:45 -0400 Received: from smtp-xvii.vinc17.net (128.119.75.86.rev.sfr.net [86.75.119.128]) by ioooi.vinc17.net (Postfix) with ESMTPSA id A5E1557; Wed, 1 Jul 2015 17:01:43 +0200 (CEST) Received: by xvii.vinc17.org (Postfix, from userid 1000) id 6860B21A082; Wed, 1 Jul 2015 17:01:43 +0200 (CEST) Date: Wed, 1 Jul 2015 17:01:43 +0200 From: Vincent Lefevre To: Stefan Monnier Subject: Re: bug#12354: 24.2; garbage inserted at the beginning of the buffer even when xterm-extra-capabilities is t Message-ID: <20150701150143.GS7712@xvii.vinc17.org> References: <87txvcen36.fsf@xvii.vinc17.org> <20120905184424.GQ4846@xvii.vinc17.org> <20150527112723.GA23516@ypig.lip.ens-lyon.fr> <20150629023519.GA7712@xvii.vinc17.org> <20150629134704.GD32461@ypig.lip.ens-lyon.fr> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Mailer-Info: https://www.vinc17.net/mutt/ User-Agent: Mutt/1.5.23-6457-vl-r76280 (2015-06-26) X-Spam-Score: -0.6 (/) X-Debbugs-Envelope-To: 12354 Cc: Glenn Morris , 12354@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.6 (/) On 2015-06-30 23:19:11 -0400, Stefan Monnier wrote: > > If you look at the code, you'll hopefully see that there are 2 code > > paths (one synchronous with a timeout, and one asynchronous), and > > a comment saying that the two should be merged. > > I.e. when using the synchronous path, after hitting the timeout, we > > should switch to the async path. > > Or simply just "always" use the async path. > > I installed the patch below which switches to the async method in case > of a timeout. That should hopefully solve your use case. I don't know whether this is related, but I've compiled the the master branch (3d759f4f6f2a20abbc05225a55d35c5daf093ff6), and Emacs freezes (in an xterm, via SSH). I need to type C-g. -- Vincent Lefèvre - Web: 100% accessible validated (X)HTML - Blog: Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon) From debbugs-submit-bounces@debbugs.gnu.org Thu Jul 02 10:49:59 2015 Received: (at 12354) by debbugs.gnu.org; 2 Jul 2015 14:49:59 +0000 Received: from localhost ([127.0.0.1]:37761 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZAfoN-0005CB-0G for submit@debbugs.gnu.org; Thu, 02 Jul 2015 10:49:59 -0400 Received: from ironport2-out.teksavvy.com ([206.248.154.181]:52171) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZAfoL-0005Bw-5p for 12354@debbugs.gnu.org; Thu, 02 Jul 2015 10:49:57 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: A0CVDQA731xV/2cGNJ1cgxCEAsEVh0sEAgKBPDsSAQEBAQEBAYEKQQWDXQEBAwFWIwULCzQHCxQYDSSINwjPIwEBAQEGAQEBAR6LOoUFB4QtAQS1BCOBZlWBWSKCeAEBAQ X-IPAS-Result: A0CVDQA731xV/2cGNJ1cgxCEAsEVh0sEAgKBPDsSAQEBAQEBAYEKQQWDXQEBAwFWIwULCzQHCxQYDSSINwjPIwEBAQEGAQEBAR6LOoUFB4QtAQS1BCOBZlWBWSKCeAEBAQ X-IronPort-AV: E=Sophos;i="5.13,465,1427774400"; d="scan'208";a="129055562" Received: from 157-52-6-103.cpe.teksavvy.com (HELO pastel.home) ([157.52.6.103]) by ironport2-out.teksavvy.com with ESMTP; 02 Jul 2015 10:49:51 -0400 Received: by pastel.home (Postfix, from userid 20848) id F39BF6165D; Thu, 2 Jul 2015 10:49:50 -0400 (EDT) From: Stefan Monnier To: Vincent Lefevre Subject: Re: bug#12354: 24.2; garbage inserted at the beginning of the buffer even when xterm-extra-capabilities is t Message-ID: References: <87txvcen36.fsf@xvii.vinc17.org> <20120905184424.GQ4846@xvii.vinc17.org> <20150527112723.GA23516@ypig.lip.ens-lyon.fr> <20150629023519.GA7712@xvii.vinc17.org> <20150629134704.GD32461@ypig.lip.ens-lyon.fr> <20150701150143.GS7712@xvii.vinc17.org> Date: Thu, 02 Jul 2015 10:49:50 -0400 In-Reply-To: <20150701150143.GS7712@xvii.vinc17.org> (Vincent Lefevre's message of "Wed, 1 Jul 2015 17:01:43 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.3 (/) X-Debbugs-Envelope-To: 12354 Cc: Glenn Morris , 12354@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.3 (/) > I don't know whether this is related, but I've compiled the the master > branch (3d759f4f6f2a20abbc05225a55d35c5daf093ff6), and Emacs freezes > (in an xterm, via SSH). I need to type C-g. Yeah, I only tested one case and didn't catch the paren-typo in the other. Sorry, should be fixed now, Stefan From debbugs-submit-bounces@debbugs.gnu.org Thu Jul 02 21:17:02 2015 Received: (at 12354) by debbugs.gnu.org; 3 Jul 2015 01:17:02 +0000 Received: from localhost ([127.0.0.1]:38109 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZApbB-0004hs-Q9 for submit@debbugs.gnu.org; Thu, 02 Jul 2015 21:17:02 -0400 Received: from ioooi.vinc17.net ([92.243.22.117]:36007) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZApb9-0004hi-2d for 12354@debbugs.gnu.org; Thu, 02 Jul 2015 21:16:59 -0400 Received: from smtp-xvii.vinc17.net (128.119.75.86.rev.sfr.net [86.75.119.128]) by ioooi.vinc17.net (Postfix) with ESMTPSA id B5F2D1A3; Fri, 3 Jul 2015 03:16:57 +0200 (CEST) Received: by xvii.vinc17.org (Postfix, from userid 1000) id 7FCC921A082; Fri, 3 Jul 2015 03:16:57 +0200 (CEST) Date: Fri, 3 Jul 2015 03:16:57 +0200 From: Vincent Lefevre To: Stefan Monnier Subject: Re: bug#12354: 24.2; garbage inserted at the beginning of the buffer even when xterm-extra-capabilities is t Message-ID: <20150703011657.GE5844@xvii.vinc17.org> References: <20120905184424.GQ4846@xvii.vinc17.org> <20150527112723.GA23516@ypig.lip.ens-lyon.fr> <20150629023519.GA7712@xvii.vinc17.org> <20150629134704.GD32461@ypig.lip.ens-lyon.fr> <20150701150143.GS7712@xvii.vinc17.org> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Mailer-Info: https://www.vinc17.net/mutt/ User-Agent: Mutt/1.5.23-6457-vl-r76280 (2015-06-26) X-Spam-Score: -0.6 (/) X-Debbugs-Envelope-To: 12354 Cc: Glenn Morris , 12354@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.6 (/) On 2015-07-02 10:49:50 -0400, Stefan Monnier wrote: > > I don't know whether this is related, but I've compiled the the master > > branch (3d759f4f6f2a20abbc05225a55d35c5daf093ff6), and Emacs freezes > > (in an xterm, via SSH). I need to type C-g. > > Yeah, I only tested one case and didn't catch the paren-typo in > the other. Sorry, should be fixed now, Thanks. I can no longer reproduce the problem. -- Vincent Lefèvre - Web: 100% accessible validated (X)HTML - Blog: Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon) From debbugs-submit-bounces@debbugs.gnu.org Sat Dec 16 21:07:54 2017 Received: (at 12354) by debbugs.gnu.org; 17 Dec 2017 02:07:54 +0000 Received: from localhost ([127.0.0.1]:37916 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eQOMs-0005o3-K2 for submit@debbugs.gnu.org; Sat, 16 Dec 2017 21:07:54 -0500 Received: from mail-io0-f170.google.com ([209.85.223.170]:41765) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eQOMp-0005nh-3m; Sat, 16 Dec 2017 21:07:51 -0500 Received: by mail-io0-f170.google.com with SMTP id o2so6409159ioe.8; Sat, 16 Dec 2017 18:07:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=+oY57sp2kWT0OejNRQJmSe9LpG9XRCYd1fnsAR1xV/I=; b=jEhfC6Gt+MnUvQawcaHqxPfvEEtpd0G36q7Azo9L72hATPdnCK3zVoWHGgSbS/IGUw FN/83eie9P5vozdsZ/27anV1G7WPsumnzkHhvm8GKDnCdHxqNEZ/l9SCwyMRj1+Y2HkP ZMYTD96cpwZYZl2x7MnTGuo6KXmWGFuE5LmU0zI6m1NNwx0Xjjx8L5krEcKb01k7Wwva 5p6GZ9UFOj0CfUsWznqmxf1bQLgeVT1PG7wEuzDgafEJiTwr+3/6AjDx4/JRTSesprwO C2SlKS2hoQFy0Z34WhnJ5nkq2lj6hRTDWU6CO+M0ReXMt1iyjmQfTxQ6PaymeTDIuno2 T8yg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:references:date :in-reply-to:message-id:user-agent:mime-version; bh=+oY57sp2kWT0OejNRQJmSe9LpG9XRCYd1fnsAR1xV/I=; b=NbUEcqtiYPMokPLRpQB9k5k+ijLdb0NKmc3MKhgk/DxRh2GWCXY00d8ILoBz1Jmo5z xiNufOldMSLqw37Wkx+RiCOpSkGNpsPzGrwIfNEW/2yj3b9hiJDt5apEa+/s9z4MqBn/ 4BBfiCepRYLTqnpeFhuAiKamtgwZF23L/JyCxNJbneOSrBLsL83iGgVlKVR2+1qCTkOO jvKKpsPfjsJ4LbVzOgv9cg4T9PWFVIRHUs84M5WJzXR7bI4kdV+1WibD2yr/sbYKNYFV dUwwaV0uks5Zu/OgRl6Bnlxf4LDgN958EejpBqY7MhSWDnc/iQlW5d+qF9zmVFGAiX+r fyFA== X-Gm-Message-State: AKGB3mI5Rg3sIHJ7XflkrzRy4ZZVQCYyqgbBcy1HLhDWknAQJafbHniZ 8LNDD3mM+1Zsq4ZkGgPPorEcpA== X-Google-Smtp-Source: ACJfBovyW6ktcNHU+SFx0FeftvFVbe3w8mpJTuNmdh9nPKFUdGgofib+NOy+e3TAdEgLzGHES2CB3w== X-Received: by 10.107.151.142 with SMTP id z136mr17974586iod.248.1513476465428; Sat, 16 Dec 2017 18:07:45 -0800 (PST) Received: from zebian ([45.2.119.34]) by smtp.googlemail.com with ESMTPSA id q6sm6243269ita.38.2017.12.16.18.07.43 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 16 Dec 2017 18:07:44 -0800 (PST) From: Noam Postavsky To: Vincent Lefevre Subject: Re: bug#12354: 24.2; garbage inserted at the beginning of the buffer even when xterm-extra-capabilities is t References: <20120905184424.GQ4846@xvii.vinc17.org> <20150527112723.GA23516@ypig.lip.ens-lyon.fr> <20150629023519.GA7712@xvii.vinc17.org> <20150629134704.GD32461@ypig.lip.ens-lyon.fr> <20150701150143.GS7712@xvii.vinc17.org> <20150703011657.GE5844@xvii.vinc17.org> Date: Sat, 16 Dec 2017 21:07:42 -0500 In-Reply-To: <20150703011657.GE5844@xvii.vinc17.org> (Vincent Lefevre's message of "Fri, 3 Jul 2015 03:16:57 +0200") Message-ID: <87fu8aayz5.fsf@users.sourceforge.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.90 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.5 (/) X-Debbugs-Envelope-To: 12354 Cc: Glenn Morris , 12354@debbugs.gnu.org, Stefan Monnier X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.5 (/) tags 12354 fixed close 12354 quit Vincent Lefevre writes: > On 2015-07-02 10:49:50 -0400, Stefan Monnier wrote: >> Yeah, I only tested one case and didn't catch the paren-typo in >> the other. Sorry, should be fixed now, > > Thanks. I can no longer reproduce the problem. Therefore closing. From unknown Wed Jun 25 00:22:45 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Sun, 14 Jan 2018 12:24:06 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator