Subject: Re: bug#12354: 24.2; garbage inserted at the beginning of the buffer even when xterm-extra-capabilities is t

From: Andreas Schwab <[email-masked]>
Date: Sat, 08 Sep 2012 11:57:50 +0200

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, [email-masked]
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."