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

From: Stefan Monnier <[email-masked]>
Date: Sun, 28 Jun 2015 21:01:02 -0400

>> > 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