all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Lorenzo Isella" <lorenzo.isella@gmail.com>
To: "Paul R" <paul.r.ml@gmail.com>
Cc: help-gnu-emacs@gnu.org, Thierry Volpiatto <thierry.volpiatto@gmail.com>
Subject: Re: Emacs Shell Ansi Colors
Date: Mon, 29 Sep 2008 15:02:57 +0200	[thread overview]
Message-ID: <a2b3004b0809290602y73c3b359t430ff0e5eb42e177@mail.gmail.com> (raw)
In-Reply-To: <87abdr9l3v.fsf@gmail.com>

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 <paul.r.ml@gmail.com>:
>
> 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.




  reply	other threads:[~2008-09-29 13:02 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-09-28 19:27 Emacs Shell Ansi Colors Lorenzo Isella
2008-09-28 21:19 ` Thierry Volpiatto
     [not found]   ` <F725F550-369F-4C9A-BACA-D13E30D70FC2@Web.DE>
2008-09-29 10:48     ` Lorenzo Isella
2008-09-29 10:59       ` Thierry Volpiatto
2008-09-29 12:37       ` Paul R
2008-09-29 12:45       ` Paul R
2008-09-29 13:02         ` Lorenzo Isella [this message]
2008-09-29 13:40           ` Paul R
2008-09-29 14:32             ` Lorenzo Isella
     [not found]         ` <mailman.20145.1222693383.18990.help-gnu-emacs@gnu.org>
2008-09-29 13:32           ` Andreas Politz
2008-09-29 16:08             ` Peter Dyballa
     [not found]       ` <mailman.20143.1222686216.18990.help-gnu-emacs@gnu.org>
2008-09-29 14:14         ` Richard Riley
     [not found]       ` <mailman.20146.1222694164.18990.help-gnu-emacs@gnu.org>
2008-09-29 14:22         ` Richard Riley
2008-09-29 14:57           ` Paul R

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=a2b3004b0809290602y73c3b359t430ff0e5eb42e177@mail.gmail.com \
    --to=lorenzo.isella@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    --cc=paul.r.ml@gmail.com \
    --cc=thierry.volpiatto@gmail.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.