Subject: bug#25097: 25.1; Scratch buffer flashes with emacsclient and xterm

From: Stefan Kangas <[email-masked]>
Date: Tue, 11 Aug 2020 17:35:27 -0700

Noam Postavsky <[email-masked]> writes:

> Jake <[email-masked]> writes:
>
>> When I run
>>
>>      emacs -Q --daemon
>>      emacsclient -t foo.txt
>>
>> to open some file foo.txt, the scratch buffer displays for 2-3 seconds
>> before the buffer for the file actually opens. My TERM environment
>> variable is set to "xterm-256color", and if I change it to
>> "screen-256color" this problem goes away. Also if I create a file
>> containing only "(setq-default xterm-query-timeout nil)" and load that
>> with the -l flag, the problem goes away. Presumably there is a purpose
>> to this timeout, so just doing this is probably not ideal. It was
>> added in commit cc8f96e in response to bug#12345.
>
> That commit actually changed the timeout from a hardcoded 2, and makes
> the timeout configurable.  So I think setting xterm-query-timeout to nil
> is the right thing here.  Perhaps even a nil xterm-query-timeout should
> be the default?
>
> Here's another case where that seems to help:
>
> https://emacs.stackexchange.com/questions/16878/0950c-escape-code-is-inserted-with-typeahead-in-terminal-emacs

Should we just go ahead and change it, then?  From reading the SE
comment, there seems to be no concrete reason to not set it to nil by
default.

Best regards,
Stefan Kangas