all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Dmitry Igrishin <dmitigr@gmail.com>
To: Random832 <random832@fastmail.com>
Cc: help-gnu-emacs@gnu.org
Subject: Re: Commands like ls(1) does not emits color sequences in 25.0.50.1
Date: Tue, 8 Sep 2015 11:18:49 +0300	[thread overview]
Message-ID: <CAAfz9KOT9Z_6mThu+wY+wS2oCYOouvfPRFZDfyE89RNNoAe4Ow@mail.gmail.com> (raw)
In-Reply-To: <m2k2s1lwno.fsf@fastmail.com>

2015-09-08 0:58 GMT+03:00 Random832 <random832@fastmail.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 see. But in Emacs 25.0.50.1 the $EMACS variable is not intialized,
when running shell, but the INSIDE_EMACS is:
$ env | grep EMACS
INSIDE_EMACS=25.0.50.1,comint

Also I've noticed that exporting COLORTERM with value "dumb"
forces ls(1) to emit color sequences in my case. So, I've added the
following
line to .bashrc:
(echo -n $INSIDE_EMACS | grep comint) > /dev/null && export COLORTERM=dumb

Shrug...


> 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.
>
Thank you! These solution can be useful indeed!



-- 
// Dmitry.


  reply	other threads:[~2015-09-08  8:18 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
2015-09-08  8:18   ` Dmitry Igrishin [this message]
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=CAAfz9KOT9Z_6mThu+wY+wS2oCYOouvfPRFZDfyE89RNNoAe4Ow@mail.gmail.com \
    --to=dmitigr@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    --cc=random832@fastmail.com \
    /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.