unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Tim X <timx@nospam.dev.null>
Subject: Re: help with M-x term
Date: Sat, 15 Jul 2006 10:28:05 +1000	[thread overview]
Message-ID: <873bd3yane.fsf@tiger.rapttech.com.au> (raw)
In-Reply-To: 1152873347.266110.78970@i42g2000cwa.googlegroups.com

"Sergei" <sergio.pokrovskij@gmail.com> writes:

> --- Tim X:
>
> ...
>
>> The difference in 'formatting' you have observed is because M-x shell
>> doesn't understand ANSI escape codes for colour. When you use the ls
>> command and have it configured to display the output using different
>> colours for different file types, it does this by using andsi colour
>> escape sequences. However, M-x shell does not understand these "out of
>> the box".
>
>> There are at least two solutions -
>
> (THREE suggestions snipped :)
>
> [...]
>
> I've put setting LS_COLORS under a condition in my .bashrc :
>
> if [ "$EMACS" != "t" ]
> then
>     PS1="$PS1_long"
>     if [ "$OSVAR" = "Linux" ]; then
>         LS_COLORS='...[set it to your liking] ...'
>         export LS_COLORS
>     else # Darwin:
>
>         export LSCOLORS="DxfxcxdxbxegedabagDxDx"
>     fi 
> else 
>     export PS1='\t \W \!% ' 
> fi 
>

Yes, I've seen solutions of this style before. Its certainly one
solution. In fact, under Debian, the default .bashrc has

# enable color support of ls and also add handy aliases
    if [ "$TERM" != "dumb" ]; then
                eval `dircolors -b`
                alias ls='ls --color=auto'
                alias dir='ls --color=auto --format=vertical'
                alias vdir='ls --color=auto --format=long'
    fi

Which means ls colours are not used within M-x shell as it sets TERM
to dumb. This approach is I think more general in that it will prevent
ls colours from being used in any dumb terminal, not just emacs'
shell. I also note you are using the variable $OSVAR to detect if
running under Linux, but I don't think this is a "standard' variable
(i.e. it is distribution/local/user specific). I only mention it in
case someone uses your code snippet and is wondering why colour ls is
not behaving as expected. 

Tim

-- 
tcross (at) rapttech dot com dot au

  reply	other threads:[~2006-07-15  0:28 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-07-12 20:02 help with M-x term yz7502
2006-07-13  2:56 ` William Daffer
2006-07-13 13:27   ` op132650c
2006-07-13 14:03   ` yz7502
2006-07-13 15:10     ` William Daffer
2006-07-13 16:17       ` yz7502
     [not found]   ` <mailman.4055.1152797235.9609.help-gnu-emacs@gnu.org>
2006-07-13 15:16     ` William Daffer
2006-07-14  5:25     ` Tim X
2006-07-14 10:35       ` Sergei
2006-07-15  0:28         ` Tim X [this message]
2006-07-18  7:01           ` Sergei
2006-07-18  8:34             ` Tim X
2006-07-13 15:14 ` Kevin Rodgers

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=873bd3yane.fsf@tiger.rapttech.com.au \
    --to=timx@nospam.dev.null \
    /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).