Subject: bug#35180: 27.0.50; emacs daemon and “package” often inserts [I when opening file

From: Eli Zaretskii <[email-masked]>
Date: Sat, 27 Apr 2019 12:52:47 +0300

> From: Han Boetes <[email-masked]>
> Date: Sat, 27 Apr 2019 11:26:17 +0200
> 
> Digging further and stripping out more unnecessary options that are not required to reproduce this issue: I got
> down to this:
> 
> cd
> mv ~/.emacs.d{,.orig}
> mkdir .emacs.d
> touch .emacs.d/init.el
> xrdb -remove
> xrdb -query # Just to prove there are no Xresources active
> 
> pkill emacs; sleep 1; /usr/local/bin/emacs –no-init-file –no-site-file –no-splash –daemon; emacsclient -t
> .emacs.d/init.el
> 
> File Edit Options Buffers Tools Emacs-Lisp Help
> [I
> 
> This happens about 25% of the time. But if I replace “–no-init-file –no-site-file –no-splash”
>  with “-Q” it no longer happens. It seems there is an undocumented difference here.
> 
> I straced it and this is what I got: Check the write() line, see also the attachment for the complete strace file.

I think this is Emacs probing the terminal capabilities, see
terminal-init-xterm in xterm.el.  Try playing with the value of
xterm-query-timeout.