GNU bug report logs - #34606
Emacs colors are off in screen sessions

Previous Next

Package: emacs;

Reported by: Clément Pit-Claudel <cpitclaudel <at> gmail.com>

Date: Thu, 21 Feb 2019 14:57:02 UTC

Severity: normal

Tags: notabug

Done: Stefan Kangas <stefan <at> marxist.se>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 34606 in the body.
You can then email your comments to 34606 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#34606; Package emacs. (Thu, 21 Feb 2019 14:57:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Clément Pit-Claudel <cpitclaudel <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Thu, 21 Feb 2019 14:57:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Clément Pit-Claudel <cpitclaudel <at> gmail.com>
To: bug-gnu-emacs <bug-gnu-emacs <at> gnu.org>
Subject: Emacs colors are off in screen sessions
Date: Thu, 21 Feb 2019 09:56:18 -0500
Hi all,

I'm having issues with color selection and syntax highlighting in Emacs running in screen.
I'm comparing the appearance of `emacs -nw -Q` on GNU / Linux Mint 18.3 (based on Ubuntu 16.04).

In a newly created gnome-terminal window (TERM=xterm-256color), I get orange comments in *scratch*.
In a newly created screen (TERM=screen), I get pale yellow comments in *scratch*.  If I change TERM to either xterm-256color or screen-256color, I get the expected orange text.

If I install the ncurses-term package, I get the same colors in gnome-terminal, but in a newly created screen TERM becomes screen.xterm-256color and I get red comments in *scratch*.  If I change TERM to xterm-256color nothing changes, and if I change TERM to screen-256color I get the expected orange text (may be relevant: https://emacs.stackexchange.com/questions/20545/emacs-colors-being-set-differently-when-term-is-screen-256color-and-xterm-256)

Is this all as expected?  Why does changing to xterm-256color yield different results with or without ncurses-term?  If I understand correctly, the reason why TERM changes after I install ncurses-term is that this package provides the screen.xterm-256color termcap entry, and then screen acts as documented:

       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" (…)

Is there anything that Emacs could do differently to make things smoother?  In particular, could TERM=screen.xterm-256color behave the same as TERM=screen-256color?

Thanks,
Clément.







Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#34606; Package emacs. (Thu, 21 Feb 2019 15:21:01 GMT) Full text and rfc822 format available.

Message #8 received at 34606 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Clément Pit-Claudel <cpitclaudel <at> gmail.com>
Cc: 34606 <at> debbugs.gnu.org
Subject: Re: bug#34606: Emacs colors are off in screen sessions
Date: Thu, 21 Feb 2019 17:20:43 +0200
> From: Clément Pit-Claudel <cpitclaudel <at> gmail.com>
> Date: Thu, 21 Feb 2019 09:56:18 -0500
> 
> Is this all as expected?  Why does changing to xterm-256color yield different results with or without ncurses-term?  If I understand correctly, the reason why TERM changes after I install ncurses-term is that this package provides the screen.xterm-256color termcap entry, and then screen acts as documented:
> 
>        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" (…)
> 
> Is there anything that Emacs could do differently to make things smoother?  In particular, could TERM=screen.xterm-256color behave the same as TERM=screen-256color?

Emacs on a TTY doesn't control the colors in RGB terms, it just tells
the terminal to display color number N.  What you actually see as
result is up to the terminfo entry and the terminal emulator, AFAIK
mostly the latter.  So I'd suggest to dig into 'screen's
customizations to see how to affect the colors (I customized the
colors of PuTTY to get something I like, for example).




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#34606; Package emacs. (Thu, 21 Feb 2019 16:38:02 GMT) Full text and rfc822 format available.

Message #11 received at 34606 <at> debbugs.gnu.org (full text, mbox):

From: Clément Pit-Claudel <cpitclaudel <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 34606 <at> debbugs.gnu.org
Subject: Re: bug#34606: Emacs colors are off in screen sessions
Date: Thu, 21 Feb 2019 11:37:25 -0500
On 21/02/2019 10.20, Eli Zaretskii wrote:
>> From: Clément Pit-Claudel <cpitclaudel <at> gmail.com>
>> Date: Thu, 21 Feb 2019 09:56:18 -0500
>>
>> Is this all as expected?  Why does changing to xterm-256color yield different results with or without ncurses-term?  If I understand correctly, the reason why TERM changes after I install ncurses-term is that this package provides the screen.xterm-256color termcap entry, and then screen acts as documented:
>>
>>        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" (…)
>>
>> Is there anything that Emacs could do differently to make things smoother?  In particular, could TERM=screen.xterm-256color behave the same as TERM=screen-256color?
> 
> Emacs on a TTY doesn't control the colors in RGB terms, it just tells
> the terminal to display color number N.  What you actually see as
> result is up to the terminfo entry and the terminal emulator, AFAIK
> mostly the latter.  So I'd suggest to dig into 'screen's
> customizations to see how to affect the colors (I customized the
> colors of PuTTY to get something I like, for example).

I don't understand. If that is the case, how can changing the value of the TERM environment variable change the colors displayed by emacs?





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#34606; Package emacs. (Thu, 21 Feb 2019 19:23:01 GMT) Full text and rfc822 format available.

Message #14 received at 34606 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Clément Pit-Claudel <cpitclaudel <at> gmail.com>
Cc: 34606 <at> debbugs.gnu.org
Subject: Re: bug#34606: Emacs colors are off in screen sessions
Date: Thu, 21 Feb 2019 21:21:45 +0200
> Cc: 34606 <at> debbugs.gnu.org
> From: Clément Pit-Claudel <cpitclaudel <at> gmail.com>
> Date: Thu, 21 Feb 2019 11:37:25 -0500
> 
> > Emacs on a TTY doesn't control the colors in RGB terms, it just tells
> > the terminal to display color number N.  What you actually see as
> > result is up to the terminfo entry and the terminal emulator, AFAIK
> > mostly the latter.  So I'd suggest to dig into 'screen's
> > customizations to see how to affect the colors (I customized the
> > colors of PuTTY to get something I like, for example).
> 
> I don't understand. If that is the case, how can changing the value of the TERM environment variable change the colors displayed by emacs?

Because the terminfo entry defines both the number of colors and the
specific command to turn on a given color.  (If that doesn't explain
what you were asking about, maybe I didn't understand the question
well enough.)




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#34606; Package emacs. (Thu, 21 Feb 2019 22:07:01 GMT) Full text and rfc822 format available.

Message #17 received at 34606 <at> debbugs.gnu.org (full text, mbox):

From: Clément Pit-Claudel <cpitclaudel <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 34606 <at> debbugs.gnu.org
Subject: Re: bug#34606: Emacs colors are off in screen sessions
Date: Thu, 21 Feb 2019 17:06:35 -0500
On 21/02/2019 14.21, Eli Zaretskii wrote:
>> Cc: 34606 <at> debbugs.gnu.org
>> From: Clément Pit-Claudel <cpitclaudel <at> gmail.com>
>> Date: Thu, 21 Feb 2019 11:37:25 -0500
>>
>>> Emacs on a TTY doesn't control the colors in RGB terms, it just tells
>>> the terminal to display color number N.  What you actually see as
>>> result is up to the terminfo entry and the terminal emulator, AFAIK
>>> mostly the latter.  So I'd suggest to dig into 'screen's
>>> customizations to see how to affect the colors (I customized the
>>> colors of PuTTY to get something I like, for example).
>>
>> I don't understand. If that is the case, how can changing the value of the TERM environment variable change the colors displayed by emacs?
> 
> Because the terminfo entry defines both the number of colors and the
> specific command to turn on a given color.

Thanks, I understand a bit better.  Does that mean that there's a bug in the terminfo database for screen.xterm-256color that causes Emacs' request for a shade of yellow/orange to be displayed as bright red?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#34606; Package emacs. (Fri, 22 Feb 2019 07:15:01 GMT) Full text and rfc822 format available.

Message #20 received at 34606 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Clément Pit-Claudel <cpitclaudel <at> gmail.com>
Cc: 34606 <at> debbugs.gnu.org
Subject: Re: bug#34606: Emacs colors are off in screen sessions
Date: Fri, 22 Feb 2019 09:14:08 +0200
> Cc: 34606 <at> debbugs.gnu.org
> From: Clément Pit-Claudel <cpitclaudel <at> gmail.com>
> Date: Thu, 21 Feb 2019 17:06:35 -0500
> 
> Thanks, I understand a bit better.  Does that mean that there's a bug in the terminfo database for screen.xterm-256color that causes Emacs' request for a shade of yellow/orange to be displayed as bright red?

No, I think the more probable cause is how the colors are configured
in each terminal emulator, in this case 'screen'.

The translation of a given TTY color to X RGB values are entirely
controlled by how the terminal emulator is configured, hopefully this
is customizable in some way and not hard-coded in the emulator's code.
I suggest to dig into the docs of each emulator and perhaps search the
net for pertinent keywords.  Or maybe asking on some relevant forum.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#34606; Package emacs. (Wed, 03 Jul 2019 02:33:01 GMT) Full text and rfc822 format available.

Message #23 received at 34606 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Kangas <stefan <at> marxist.se>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 34606 <at> debbugs.gnu.org,
 Clément Pit-Claudel <cpitclaudel <at> gmail.com>
Subject: Re: bug#34606: Emacs colors are off in screen sessions
Date: Wed, 3 Jul 2019 04:31:56 +0200
tags 34606 + notabug
close 34606
quit

Eli Zaretskii <eliz <at> gnu.org> writes:

>> Cc: 34606 <at> debbugs.gnu.org
>> From: Clément Pit-Claudel <cpitclaudel <at> gmail.com>
>> Date: Thu, 21 Feb 2019 17:06:35 -0500
>>
>> Thanks, I understand a bit better.  Does that mean that there's a bug in the terminfo database for screen.xterm-256color that causes Emacs' request for a shade of yellow/orange to be displayed as bright red?
>
> No, I think the more probable cause is how the colors are configured
> in each terminal emulator, in this case 'screen'.
>
> The translation of a given TTY color to X RGB values are entirely
> controlled by how the terminal emulator is configured, hopefully this
> is customizable in some way and not hard-coded in the emulator's code.
> I suggest to dig into the docs of each emulator and perhaps search the
> net for pertinent keywords.  Or maybe asking on some relevant forum.

It doesn't look like there is much more to do here, so I'm closing this
as notabug.  If anyone disagrees, feel free to reopen.

Thanks,
Stefan Kangas




Added tag(s) notabug. Request was from Stefan Kangas <stefan <at> marxist.se> to control <at> debbugs.gnu.org. (Wed, 03 Jul 2019 02:33:02 GMT) Full text and rfc822 format available.

bug closed, send any further explanations to 34606 <at> debbugs.gnu.org and Clément Pit-Claudel <cpitclaudel <at> gmail.com> Request was from Stefan Kangas <stefan <at> marxist.se> to control <at> debbugs.gnu.org. (Wed, 03 Jul 2019 02:33:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 31 Jul 2019 11:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 4 years and 268 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.