Subject: Re: bug#69598: 29.2; colour support based on $TERM value not terminfo database

From: [email-masked]
Date: Thu, 07 Mar 2024 18:31:20 +0000

Eli Zaretskii writes:
> > I also performed this sequence on a linux (Debian 6.1.67-1 (2023-12-12))
> > box in xterm (379) now that my cat has vacated it:
> > 
> >         $ export TERM=xterm-direct
> >         $ emacs -nw                   # Version 28.2
> >         $ echo 'fancy|Fancy Term,use=xterm-direct,' > fancy.info
> >         $ tic fancy.info
> >         $ export TERM=fancy
> >         $ emacs -nw
> > 
> > In the first emacs, list-colors-display listed (I presume) 256
> > colours. Certainly a lot and with the X names (it does not name
> > them nicely if the terminal reports 256 colours). In the second it
> > listed 8. Emacs has no configuration on that box (it's for compiling).
>
> So I guess you will need to step with a debugger through the code in
> term.c which discovers and initializes the color-related capabilities,

If there's something you would like me to look for then I can but
I am highly sceptical of the idea that it is isolated to something
unique about my computers here.

Besides you can see clearly in term.c that there are no references
to xterm in the strings and hopefully none hidden behind macros
(there is one to xterm+direct in a comment describing where hard-coded
defaults are from, which is one of the xterm-direct building blocks),
so whatever is going wrong is likely to be somewhere else, such as
a misunderstanding deeper within the emacs runtime.

> and see what's going on there on your system.  Just from the

Systems. Plural. Linux and BSD. I could probably open an xterm on
something else somehow but the chance of the same problem on two
distinct systems being caused by a local issue is very low.

Did you confirm presence of the bug with the transcript I provided?

> information you provided, it is very hard to guess what could be the
> culprit.

It's a lot harder for me. I only use emacs.

What more information do you need? Here's another bit from a quick
test while writing this email (in the unadulterated-Debian xterm
that's still open):

        $ echo 'xterm-naughty|Naughty Term,use=xterm-direct,' >> fancy.info
        $ tic fancy.info
        $ export TERM=xterm-naughty
        $ emacs -nw

That emacs displayed all the colours, so it's not 'xterm-direct'
in $TERM that emacs is treating magically, it's 'xterm' (naughty-xterm
lists 8 colours, so probably make that /^xterm/).

Matthew