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

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

Re: Commands like ls(1) does not emits color sequences in 25.0.50.1


From: Random832
Subject: Re: Commands like ls(1) does not emits color sequences in 25.0.50.1
Date: Mon, 07 Sep 2015 17:58:03 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (darwin)

Dmitry Igrishin <dmitigr@gmail.com> writes:

> To workaround this problem I've tried to add
> (setenv "TERM" "ansi") to the init.el, but Emacs resets the TERM
> variable to "dumb" upon the startup. Is this expected?

Yes, it is expected. You can see where it does this in the comint-exec-1
function. You can test for the EMACS environment variable in your shell
(it will be set to "t" if running within emacs) and reset the TERM in
your e.g. bashrc file.

if [ "$TERM" = dumb ] && [ "$EMACS" = t ]; then
        TERM=dumb-emacs-ansi
fi  

I would tend to use a handcrafted terminfo entry (provided below) that
has only the color codes (and bold, italic, underline), and nothing
else, so that full-screen apps don't think they will work. Many
applications (top and vim both do on my machine) will assume they can
anyway, though.

dumb-emacs-ansi|Emacs dumb terminal with ANSI color codes,
        am,
        colors#8, it#8, ncv#13, pairs#64,
        bold=\E[1m, cud1=^J, ht=^I, ind=^J, op=\E[39;49m,
        ritm=\E[23m, rmul=\E[24m, setab=\E[4%p1%dm,
        setaf=\E[3%p1%dm, sgr0=\E[m, sitm=\E[3m, smul=\E[4m,

Note: 'ncv' is set to disallow reverse, blink, and standout, since these
are mapped by default to faces that set the foreground color (C-h v
ansi-color-faces-vector), but also does not provide codes to use them in
the first place - only color, bold, italic, and underline are provided.

I couldn't find any way to actually indicate the behavior that emacs has
when given a backspace or carriage return (it actually deletes
characters, rather than moving backwards to overtype them), so I omitted
these codes. So, in that sense, this entry is even dumber than dumb.




reply via email to

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