all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Random832 <random832@fastmail.com>
To: help-gnu-emacs@gnu.org
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	[thread overview]
Message-ID: <m2k2s1lwno.fsf@fastmail.com> (raw)
In-Reply-To: CAAfz9KOCXTKQR9g6_ZvZku+x369XtaQcUTYgzCw8+ad_uz9-PA@mail.gmail.com

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	other threads:[~2015-09-07 21:58 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-07 18:57 Commands like ls(1) does not emits color sequences in 25.0.50.1 Dmitry Igrishin
2015-09-07 21:58 ` Random832 [this message]
2015-09-08  8:18   ` Dmitry Igrishin
2015-09-08 12:13     ` Stefan Monnier
2015-09-08 13:57       ` Random832

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

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

  git send-email \
    --in-reply-to=m2k2s1lwno.fsf@fastmail.com \
    --to=random832@fastmail.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.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.