From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Tim X Newsgroups: gmane.emacs.help Subject: Re: help with M-x term Date: Sat, 15 Jul 2006 10:28:05 +1000 Organization: Posted via Supernews, http://www.supernews.com Message-ID: <873bd3yane.fsf@tiger.rapttech.com.au> References: <1152734523.744338.154800@m79g2000cwm.googlegroups.com> <877j2gycyl.fsf@tiger.rapttech.com.au> <1152873347.266110.78970@i42g2000cwa.googlegroups.com> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1152924037 20653 80.91.229.2 (15 Jul 2006 00:40:37 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sat, 15 Jul 2006 00:40:37 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sat Jul 15 02:40:36 2006 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1G1YCr-0008Ge-Kh for geh-help-gnu-emacs@m.gmane.org; Sat, 15 Jul 2006 02:40:30 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1G1YCr-0006sh-5g for geh-help-gnu-emacs@m.gmane.org; Fri, 14 Jul 2006 20:40:29 -0400 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!headwall.stanford.edu!newsfeed.news2me.com!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed.freenet.de!feeder.news-service.com!138.199.65.86.MISMATCH!sn-xt-ams-06!sn-xt-ams-05!sn-ams!sn-feed-ams-03!sn-post-ams-01!sn-post-sjc-01!supernews.com!corp.supernews.com!not-for-mail Original-Newsgroups: gnu.emacs.help User-Agent: Gnus/5.110006 (No Gnus v0.6) Emacs/22.0.50 (gnu/linux) Cancel-Lock: sha1:OXar5zGAUpgIrTTcJHN5IwaUpLY= Original-X-Complaints-To: abuse@supernews.com Original-Lines: 60 Original-Xref: shelby.stanford.edu gnu.emacs.help:140343 Original-To: help-gnu-emacs@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:35968 Archived-At: "Sergei" 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