Subject: Re: Add "lisp/term/screen.el" to support GNU Screen's 256 colors mode

From: Gregor Zattler <[email-masked]>
Date: Sun, 27 Feb 2011 21:41:29 +0100

Hi Anders, Prestoo,

today I discovered this thread and I'm happy to use Prestoo's
solution:

* Anders Kaseorg <[email-masked]> [30. Jul. 2010]:
> On Thu, 12 Mar 2009, Prestoo Ten wrote:
>> Please consider adding the file "lisp/term/screen.el" with the
>> following contents to support GNU Screen's "screen-256color" terminal
>> type:
> 
> Note that lisp/faces.el has a heuristic [1] that assumes the terminal has 
> a light background for TERM={xterm*,rxvt*,dtterm*,eterm*}, but a dark 
> background for other TERMs including TERM=screen*.  So you may also need 
> to customize frame-background-mode to 'light to prevent the default colors 
> from becoming unreadably bright.  

By chance my background is dark, so no problem for me.

I tested what would happen if my background was white without
other customisations (emacs -Q; screen -c /dev/null) with an
org-mode file.  It is really barely readable. 

That's not the case without screen, because Emacs then recognises
the brightness of the terminal emulators background (at least for
white and black) and adjusts the faces colours.

So, if I used white backround with screen I would have to
customise frame-background-mode via .emacs or utilise .Xdefaults.

But this should not hinder the inclusion of the file
lisp/termscreen.el as provided by the OP.

> Perhaps the heuristic should be updated?
> 
> [1] http://repo.or.cz/w/emacs.git/blob/EMACS_23_2:/lisp/faces.el#l1876

That's still the same in Emacs trunk.  This is way beyond my
elisp literacy.  But Emacs somehow realises is background is dark
or light if invoked in a rxvt-unicode or xterm terminal emulator
window.  This is for some reason not the case when invoked in a
screen session which in turn is invoked in a rxvt-unicode or
xterm.  Perhaps it is somehow possible to detect the background
brightness in screen too?

Thanks, Gregor