[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: help with M-x term
From: |
Tim X |
Subject: |
Re: help with M-x term |
Date: |
Sat, 15 Jul 2006 10:28:05 +1000 |
User-agent: |
Gnus/5.110006 (No Gnus v0.6) Emacs/22.0.50 (gnu/linux) |
"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
Re: help with M-x term, Kevin Rodgers, 2006/07/13