From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Lorenzo Isella" Newsgroups: gmane.emacs.help Subject: Re: Emacs Shell Ansi Colors Date: Mon, 29 Sep 2008 15:02:57 +0200 Message-ID: References: <48DFDAB9.5020506@gmail.com> <87prmo3r45.fsf@tux.homenetwork> <87abdr9l3v.fsf@gmail.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1222693426 3693 80.91.229.12 (29 Sep 2008 13:03:46 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 29 Sep 2008 13:03:46 +0000 (UTC) Cc: help-gnu-emacs@gnu.org, Thierry Volpiatto To: "Paul R" Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon Sep 29 15:04:44 2008 connect(): Connection refused Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1KkIQP-0001K9-A3 for geh-help-gnu-emacs@m.gmane.org; Mon, 29 Sep 2008 15:04:29 +0200 Original-Received: from localhost ([127.0.0.1]:51528 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KkIPM-0006OL-FA for geh-help-gnu-emacs@m.gmane.org; Mon, 29 Sep 2008 09:03:24 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KkIOz-0006N0-TE for help-gnu-emacs@gnu.org; Mon, 29 Sep 2008 09:03:01 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KkIOy-0006Mf-Oz for help-gnu-emacs@gnu.org; Mon, 29 Sep 2008 09:03:01 -0400 Original-Received: from [199.232.76.173] (port=43290 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KkIOx-0006MZ-V7 for help-gnu-emacs@gnu.org; Mon, 29 Sep 2008 09:03:00 -0400 Original-Received: from ey-out-1920.google.com ([74.125.78.149]:49609) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1KkIOx-0004Lg-GO for help-gnu-emacs@gnu.org; Mon, 29 Sep 2008 09:02:59 -0400 Original-Received: by ey-out-1920.google.com with SMTP id 4so528998eyg.24 for ; Mon, 29 Sep 2008 06:02:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:sender :to:subject:cc:in-reply-to:mime-version:content-type :content-transfer-encoding:content-disposition:references :x-google-sender-auth; bh=muipROx1XeCaADhYIp+BetswS+V8vpnceIXCbzos1BE=; b=Yp9cuPlXsrT5LOs+sbrPIgWQY9PiZ+zHU6vXJir6/Cxp0ExY//J+lxgSGfGUjCLRev HaMdTCyDtW8Ipdv/KclTG4F9ekr4brDChoWLLJ3i5nF7b5jSynHpq4zFxbHFXUJ3ekvp f823JI96oFindAHUgnsnoGKidYJ4RnAop9fa4= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:sender:to:subject:cc:in-reply-to:mime-version :content-type:content-transfer-encoding:content-disposition :references:x-google-sender-auth; b=I0qJLakBRk1tY/KV0H/E7GXI8cpU7dZ51jSoHHxShVLHigckh1aXU/avqUAFHJStjS xe181aKrHohqtDN+oJbicP9ff2JStKDhAZzFHsyzQttzyg/z2N7VWFhahQijolR/2at+ rFCkw5+n7qu4+g41An76QYyVWRhIh9Tj/GNCg= Original-Received: by 10.210.61.8 with SMTP id j8mr6204191eba.123.1222693378032; Mon, 29 Sep 2008 06:02:58 -0700 (PDT) Original-Received: by 10.210.11.3 with HTTP; Mon, 29 Sep 2008 06:02:57 -0700 (PDT) In-Reply-To: <87abdr9l3v.fsf@gmail.com> Content-Disposition: inline X-Google-Sender-Auth: ff3eab8f9567229e X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2) 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:58178 Archived-At: OK, I think we are getting to the bottom of this. Apologies in advance for the long email, but there are several suggestions here about what to modify (and how), and my knowledge of shell scripting is clearly on a different league wrt the one of many people on the list. To make a long story short, this is the output of your command: ~$ env | grep TERM TERM=xterm COLORTERM=gnome-terminal and this is my .bashrc file (or better: the part about aliases and colors, which I think is relevant here): # set a fancy prompt (non-color, unless we know we "want" color) case "$TERM" in xterm-color) PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ ' ;; *) PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ ' ;; esac # Comment in the above and uncomment this below for a color prompt #PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ ' # If this is an xterm set the title to user@host:dir case "$TERM" in xterm*|rxvt*) PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME}: ${PWD/$HOME/~}\007"' ;; *) ;; esac # Alias definitions. # You may want to put all your additions into a separate file like # ~/.bash_aliases, instead of adding them here directly. # See /usr/share/doc/bash-doc/examples in the bash-doc package. #if [ -f ~/.bash_aliases ]; then # . ~/.bash_aliases #fi # 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 # some more ls aliases #alias ll='ls -l' #alias la='ls -A' #alias l='ls -CF' and this is my /etc/profile file: # /etc/profile: system-wide .profile file for the Bourne shell (sh(1)) # and Bourne compatible shells (bash(1), ksh(1), ash(1), ...). if [ "`id -u`" -eq 0 ]; then PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/bin/X11" else PATH="/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/games" fi if [ "$PS1" ]; then if [ "$BASH" ]; then PS1='\u@\h:\w\$ ' else if [ "`id -u`" -eq 0 ]; then PS1='# ' else PS1='$ ' fi fi fi export PATH umask 022 As to your suggestion: > in case you need a drop-in solution for emacs, you can use the lines > below. > > (comint-send-string (current-buffer) "alias ls='ls --color'") > then do a > (comint-send-input) please, do not laugh, but I am a bit at a loss about the way I should put this into my .emacs file. The part dealing with the shell is now: (require 'shell-command) (shell-command-completion-mode) ;; ;;Now I add another customization for the shell-mode (autoload 'ansi-color-for-comint-mode-on "ansi-color" nil t) (add-hook 'shell-mode-hook 'ansi-color-for-comint-mode-on) (custom-set-variables '(comint-scroll-to-bottom-on-input t) ; always insert at the bottom '(comint-scroll-to-bottom-on-output t) ; always add output at the bottom '(comint-scroll-show-maximum-output t) ; scroll to show max possible output '(comint-completion-autolist t) ; show completion list when ambiguous '(comint-input-ignoredups t) ; no duplicates in command history '(comint-completion-addsuffix t) ; insert space/slash after file completion ) ; make completion buffers disappear after 3 seconds. (add-hook 'completion-setup-hook (lambda () (run-at-time 3 nil (lambda () (delete-windows-on "*Completions*"))))) (add-hook 'shell-mode-hook '(lambda () (toggle-truncate-lines 1))) (setq comint-prompt-read-only t) What should I actually add to this? Hope this is the conclusion, thanks again to everybody. Cheers Lorenzo 2008/9/29 Paul R : > > Lorenzo> So it looks like there could be a problem with the TERM > Lorenzo> environment variable (but do not ask me what this stands > Lorenzo> for). I suppose (hope?) this is a one-liner for somebody > Lorenzo> really knowledgeable about emacs. Kind Regards > > in case you need a drop-in solution for emacs, you can use the lines > below. > > (comint-send-string (current-buffer) "alias ls='ls --color'") > then do a > (comint-send-input) > > -- > Paul > -- It is hard to want something you cannot describe.