4
5
I'm trying to get a custom color-theme (solarized) setup for my emacs that utilizes a 16 color palette, which I've already set up for my terminal (gnome-terminal).
When running emacs from a normal terminal with TERM=xterm-256color
, I can correctly get M-x list-colors-display
to show all 16 ansi colors, e.g. red, green, brightgreen, brightred, etc.
However, when running it from within tmux and TERM=screen-256color
, M-x list-colors-display
only lists the basic 8 colors, and is missing the extended bright colors. Under both settings, evaluating (display-color-cells)
reports 256 colors. The only references to the bright colors that I can find are in lisp/term/xterm.el and lisp/term/rxvt.el, so it would seem the issue is in the TERM
setting.
For tmux to work properly the TERM
must be set to screen or screen-256color, so setting TERM differently is out. I have had some luck using an alias:
alias emacs='TERM=xterm-256color emacs'
Is there a better way than this to force emacs to allow the use of all 16 ansi colors?
I do sometimes have to use version 23, which appears to be missing the screen definitions as you mentioned. I'll give the solution you posted a try. Thanks! – agrubb – 2013-01-09T23:11:05.823
As a follow up, the solution you posted is working fine as far as color support goes. One problem I have noticed using this approach is that emacs appears to lose the ability to support underlined faces when running using this method, but using the alias approach works fine. I've tried hunting down where underline support is defined but haven't had any luck. Any thoughts? – agrubb – 2013-01-25T21:00:05.643
@agrubb: Emacs is probably using a terminfo entry for your active TERM (e.g.
screen-256color
) that includes anncv
capability that says that the terminal can not support underlining and color at the same time; this causes Emacs to forgo underlining in favor of bold (see thedefface underline
infaces.el
). You can check your terminfo entry withtput ncv
(ideally, to support underlining you need -1, or a number where the the “2 bit” is off). In emacs you can useM-x : (display-supports-face-attributes-p '(:underline t))
to check for underline support. – Chris Johnsen – 2013-01-26T02:53:44.537@agrubb: The terminfo entry in newer releases of ncurses clears
ncv
from itsscreen
entries, so I guess your Emacs binary is using an older version if the terminfo database. You could build a custom entry that clearsncv
with a command like this:{ infocmp -x screen-256color; printf '\t%s\n' 'ncv@,'; } > /tmp/t && tic -x /tmp/t
(when run as non-root, it will write a newscreen-256color
entry under~/.terminfo/
). You can get an overview of the faces withM-x list-faces-display
to check how (e.g.)underline
is shown. – Chris Johnsen – 2013-01-26T02:54:27.127That was the problem. Building the custom terminfo entry did the trick. Thanks! – agrubb – 2013-01-28T19:46:46.793