help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

emacs -nw, xterm and 256 colors


From: Martin Karlsson
Subject: emacs -nw, xterm and 256 colors
Date: Tue, 27 Mar 2007 16:54:16 +0200
User-agent: Gnus/5.110006 (No Gnus v0.6) Emacs/22.0.93 (berkeley-unix)

Hello.

I'm trying to get `emacs -nw' in xterm to display 256 colors, and so far
it's not going well. I only get 8.

This (or a very similar) problem was discussed in
<87fzic4rqq.fsf@dazed.zeppelin.net> (October 2003, emacs-pretest-bugs@),
and in <cr924i$164$1@reader1.panix.com> (January 2005, help-gnu-emacs@).

My environment:

xterm% uname -psr
==> FreeBSD 6.2-RELEASE-p3 i386

xterm% $(which xterm) -v  # /usr/ports/x11/xterm
                          # with 256 colors enabled
==> X.Org 6.9.0(225)

xterm% $(which emacs) --version | head -1
                          # /usr/ports/editors/emacs-devel
==> GNU Emacs 22.0.93.1   # linked against X and libXaw3d

; emacs -nw inside xterm
system-uses-terminfo C-j
==> t

(display-color-cells) C-j
==> 8

M-x list-colors-display RET
==> <http://martink.freeshell.net/emacs/list-colors-display.png>
    black    black    #000000
    red      red      #cd0000
    green    green    #00cd00
    yellow   yellow   #cdcd00
    blue     blue     #0000ee
    magenta  magenta  #cd00cd
    cyan     cyan     #00cdcd
    white    white    #e5e5e5

(getenv "TERMCAP") C-j
==> <http://martink.freeshell.net/emacs/getenv-termcap.txt>
    "xterm-256color|xterm alias 3:k1=\\EOP:k2=\\EOQ: [...]"

xterm% echo $TERM
==> xterm-256color # set in ~/.Xdefaults
                   # (XTerm*termName: xterm-256color)

xterm% ./256colors2.pl # <http://frexx.de/xterm-256-notes/>
==> <http://martink.freeshell.net/emacs/256colors2.png> (the "correct" output)

xterm% infocmp xterm-256color  # /usr/ports/devel/ncurses
==> <http://martink.freeshell.net/emacs/xterm-256color.txt>
    #       Reconstructed via infocmp from file: \
    /usr/local/share/misc/terminfo.db
    xterm-256color|xterm with 256 colors,
        am, bce, ccc, km, mc5i, mir, msgr, npc, xenl,
        colors#256, cols#80, it#8, lines#24, pairs#32767,
    ...
    (weird spacing and line-breaks due to formatting for this message)


On a whim, I changed line 373 of
[...]/share/emacs/22.0.93/lisp/term/xterm.el(.gz) to read:
"(let* ((ncolors 256)"

and later to read:
"(let* ((ncolors 88)"

instead of:
"(let* ((ncolors (display-color-cells))"

In the 256-colors case, emacs tells me "Unsupported number of xterm
colors (256)" in the echo area (and I'm not surprised, me and math don't
mix very well, so the value 256 may very well be wrong).

In the 88-colors case, `M-x list-colors-display' outputs:
==> black         black         0000
    red           red            #cd0000
    green         green          #00cd00
    yellow        yellow         #cdcd00
    blue          blue           #0000ee
    magenta       magenta        #cd00cd
    cyan          cyan           #00cdcd
    white         white          #e5e5e5
    brightblack   brightblack    #7f7f7f
    brightred     brightred      #ff0000
    brightgreen   brightgreen    #00ff00
    brightyellow  brightyellow   #ffff00
    brightblue    brightblue     #5c5cff
    brightmagenta brightmagenta  #ff00ff
    brightcyan    brightcyan     #00ffff
    brightwhite   brightwhite    #ffffff
    color-16      color-16       #000000
    color-17      color-17       #00008b
    ...           ...            ...
    color-87      color-87       #e7e7e7

Only the "usual" colors (up to and including "white"), however, are
actually colorized by emacs.

For the 88-colors case, the output of "M-x open-termscript RET" followed
by "M-x list-colors-display RET" can be found at
<http://martink.freeshell.net/emacs/88termscript.txt>

I'm not at all sure what to make of all this. My working theory is that
it's more of a user problem, than an emacs\|terminfo\|xterm problem --
in any case, I'd appreciate feedback and help.

If the fix for my problem was mentioned in the the threads I mentioned
above, I didn't understand it. My apologies.

Regards,

-- 
Martin Karlsson




reply via email to

[Prev in Thread] Current Thread [Next in Thread]