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

From: Eli Zaretskii <[email-masked]>
Date: Thu, 07 Mar 2024 19:47:05 +0200

> From: [email-masked]
> cc: [email-masked], [email-masked]
> Comments: In-reply-to Eli Zaretskii <[email-masked]>
>    message dated "Thu, 07 Mar 2024 08:47:37 +0200."
> Date: Thu, 07 Mar 2024 17:32:38 +0000
> 
> Eli Zaretskii writes:
> >
> >   ** Emacs can support 24-bit color TTY without terminfo database.
> >   If your text-mode terminal supports 24-bit true color, but your system
> >   lacks the terminfo database, you can instruct Emacs to support 24-bit
> >   true color by setting 'COLORTERM=truecolor' in the environment.  This is
> >   useful on systems such as FreeBSD which ships only with "etc/termcap".
> >
> >   *** Emacs will now use 24-bit colors on terminals that support "Tc" capability.
> >   This is in addition to previously-supported ways of discovering 24-bit
> >   color support: either via the "RGB" or "setf24" capabilities, or if
> >   the 'COLORTERM' environment variable is set to the value "truecolor".
> >
> > Did you try the COLORTERM=truecolor setting?
> 
> I did now, in a new non-xterm terminal which does display all colours
> in emacs if $TERM is xterm-direct, and no joy (only lists 8 colours).
> 
> 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).
> 
> I recall testing the RGB capability late last night despite not
> seeing it documented anywhere and that did not work. I shall
> experiment with the Tc capability and RGB more carefully and see
> what effect they have nevertheless I think the above sequence now
> repeated on two distinct operating systems is quite telling.
> 
> Both systems have little or no customisation beyond the base image
> apart from installed packages. Certainly nothing that should affect
> terminfo (apart from running tic).

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,
and see what's going on there on your system.  Just from the
information you provided, it is very hard to guess what could be the
culprit.

Thanks.