unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Martin Karlsson <qsvans@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: emacs -nw, xterm and 256 colors
Date: Tue, 27 Mar 2007 16:54:16 +0200	[thread overview]
Message-ID: <86vegmenzb.fsf@soeren.network.lan> (raw)

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	other threads:[~2007-03-27 14:54 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-03-27 14:54 Martin Karlsson [this message]
2007-03-28 15:53 ` emacs -nw, xterm and 256 colors Leo
2007-03-29 12:22 ` emacs -nw, xterm and 256 colors [solved] Martin Karlsson
2007-03-29 13:01   ` Leo
2007-03-29 15:17     ` Martin Karlsson
2007-03-29 15:46       ` Leo
2007-03-29 18:54         ` Martin Karlsson
     [not found]         ` <mailman.1591.1175194608.7795.help-gnu-emacs@gnu.org>
2007-03-29 21:53           ` Ilya Zakharevich
2007-03-30 21:24             ` Martin Karlsson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=86vegmenzb.fsf@soeren.network.lan \
    --to=qsvans@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).