Subject: bug#62237: 28.1 or higher: 24-bit true color breaks colours in Emacsen built without X under GNU Screen

From: Robert Pluim <[email-masked]>
Date: Fri, 17 Mar 2023 18:44:19 +0100

>>>>> On Fri, 17 Mar 2023 18:30:23 +0200, Eli Zaretskii <[email-masked]> said:

    >> From: Robert Pluim <[email-masked]>
    >> Cc: Sebastian Tennant <[email-masked]>,  [email-masked]
    >> Date: Fri, 17 Mar 2023 16:39:19 +0100
    >> 
    >> For reasons unknown to me, I actually have COLORTERM=truecolor set in
    >> my environment, which tickles this issue. But the only reason it does
    >> so is because under screen by default I get
    >> TERM=screen.xterm-256color. If I do
    >> 
    >> TERM=xterm-256color src/emacs -Q -nw
    >> 
    >> then I get 24bit colour (according to `display-color-cells')
    >> 
    >> I guess we could drop the 'screen.' prefix in
    >> `init_display_interactive', although that does feel like a hack.

    Eli> Why not in screen.el?

Because the 24 bit colour detection is done in init_tty. By the time
we get to screen.el itʼs too late.

    Eli> Is this screen.FOO format documented somewhere in screen's
    Eli> documentation?

Yes:

       When screen tries to figure out a terminal name for  itself,  it  first
       looks  for an entry named "screen.<term>", where <term> is the contents
       of your $TERM variable.  If no such entry exists, screen tries "screen"
       (or  "screen-w"  if  the terminal is wide (132 cols or more)).  If even
       this entry cannot be found, "vt100" is used as a substitute.

       The idea is that if you have a terminal which doesn't support an impor‐
       tant  feature  (e.g.  delete  char or clear to EOS) you can build a new
       termcap/terminfo entry for screen (named "screen.<dumbterm>") in  which
       this  capability  has been disabled. If this entry is installed on your
       machines you are able to do a rlogin and still keep the  correct  term‐
-->    cap/terminfo  entry.  The terminal name is put in the $TERM variable of
       all new windows.  Screen also sets the $TERMCAP variable reflecting the
       capabilities of the virtual terminal emulated. Notice that, however, on
       machines using the terminfo database this variable has no effect.  Fur‐
       thermore, the variable $WINDOW is set to the window number of each win‐
       dow.

Robert
--