Subject: Re: bug#68531: 29.1; garbage inserted in the buffer when starting Emacs in xterm

From: Eli Zaretskii <[email-masked]>
Date: Wed, 17 Jan 2024 16:42:28 +0200

> Cc: Vincent Lefevre <[email-masked]>
> From: Vincent Lefevre <[email-masked]>
> Date: Wed, 17 Jan 2024 15:32:04 +0100
> 
> 
> 1. Create a large file "foo", e.g. with
>      echo `seq 10000000` > foo
> 
> 2. In an xterm, connect to the machine via ssh (AFAIK to introduce
>    a delay in the transmissions).
> 
> 3. Type (without <RET>):
>      /usr/bin/emacs -nw -Q --eval="(setq large-file-warning-threshold
>      100000000)" foo
> 
> 4. Type <RET> twice very quickly.
> 
> I sometimes get garbage near the beginning of the buffer, after a
> blank line (due to <RET>):
> 
> 11;rgb:0000/0000/00001 2 3 4 5 6 7 8 [...]

It's not garbage, it's Emacs querying the terminal about its
background mode, see xterm--report-background-handler.  I'm guessing
Emacs fails to read the response because visiting that file takes too
much time.

Try playing with the value of xterm-query-timeout.  Or avoid visiting
files with such humongously long lines from the command line.