[Top][All Lists]

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

Re: Colors on TTY (v26)

From: Aleksey Midenkov
Subject: Re: Colors on TTY (v26)
Date: Sun, 31 Mar 2019 20:20:56 +0300

On Sun, Mar 31, 2019 at 6:15 PM Eli Zaretskii <address@hidden> wrote:

> > From: Aleksey Midenkov <address@hidden>
> > Date: Sun, 31 Mar 2019 11:22:59 +0300
> >
> > Trial and error shown that emacs holds special knowledge on terminal
> names:
> > f.ex. "xterm-something" works as 256 colors and "xterm2" works as 16
> > colors. This is in fact very strange because there are terminals like
> > "screen.xterm-256color".
> > So it's not good to hold special magic about term names for that. Why it
> > doesn't check terminfo db for that (though it checks for 24bit as doc
> > states)? Looks like a bug to me.
> >
> > To test it:
> > 1. infocmp your current term into file;
> > 2. rename file and rename term inside it;
> > 3. tic renamed file;
> > 4. set TERM to renamed term.
> >
> > And voila: it's either 256 or 16 colors depending on term name!
> Emacs doesn't hard-code terminal names, but it has Lisp libraries
> under lisp/term/ which are loaded by the terminal name.  If you have a
> terminal that behaves like one of the ones known to Emacs, you need
> only copy the relevant Lisp library under lisp/term/ to the name of
> your terminal (with the .el extension), and things should work from
> there.

I tried different terminal names. It seems, that it understands "xterm-"
prefix. The remaining part can be arbitrary: I literally tried
"xterm-something" and it worked. I guess, there is no such file
"xterm-something" in the library. In any case, it's much better to rename
terminal to "xterm-*", than deal with distributed files.

> > Another bug:
> > (list-color-display)
> > always shows 16 colors from .emacs file (or from -f option). It detects
> 256
> > colors somehow later and then list-colors-display executed interactively
> > shows different result.
> The full color list is indeed set during startup, so if you invoke
> list-colors-display too early during startup, you will not see that.
> This is not a bug, as Emacs can not know the color capabilities of the
> terminal until it probes them.
This is indeed a bug: different result returned by same routine. Either
list-colors-display should not exist at an early stage or color capability
probe should be done earlier.

All the best,

Aleksey Midenkov

reply via email to

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