help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Emacs Shell Ansi Colors


From: Paul R
Subject: Re: Emacs Shell Ansi Colors
Date: Mon, 29 Sep 2008 15:40:09 +0200
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.2 (gnu/linux)

On Mon, 29 Sep 2008 15:02:57 +0200, "Lorenzo Isella" <lorenzo.isella@gmail.com> 
said:
Lorenzo> ~$ env | grep TERM TERM=xterm COLORTERM=gnome-terminal

I guess this is the output of the command run from within
gnome-terminal, not from emacs shell mode :)
Run it from shell mode you should read that the term is dumb.

Lorenzo> [ "$TERM" != "dumb" ]; then eval "`dircolors -b`" alias
Lorenzo> ls='ls --color=auto' #alias

Here we go. Emacs comint shell is dumb so the alias won't happen.


Lorenzo> please, do not laugh, but I am a bit at a loss about the way
Lorenzo> I should put this into my .emacs file. The part dealing with
Lorenzo> the shell is now:

I don't use M-x shell at all so I have hard time helping you more.
Reading shell.el code yield :
,---- see lines starting with !!!
|   (interactive
|    (list
|     (and current-prefix-arg
|        (read-buffer "Shell buffer: "
|                     (generate-new-buffer-name "*shell*")))))
|   (setq buffer (get-buffer-create (or buffer "*shell*")))
|   ;; Pop to buffer, so that the buffer's window will be correctly set
|   ;; when we call comint (so that comint sets the COLUMNS env var properly).
|   (pop-to-buffer buffer)
|   (unless (comint-check-proc buffer)
|     (let* ((prog (or explicit-shell-file-name
|                    (getenv "ESHELL") shell-file-name))
|          (name (file-name-nondirectory prog))
|!!!!! NOTICE BELOW
|          (startfile (concat "~/.emacs_" name))
|          (xargs-name (intern-soft (concat "explicit-" name "-args"))))
|       (unless (file-exists-p startfile)
|       (setq startfile (concat "~/.emacs.d/init_" name ".sh")))
|       (apply 'make-comint-in-buffer "shell" buffer prog
|            (if (file-exists-p startfile) startfile)
|            (if (and xargs-name (boundp xargs-name))
|                (symbol-value xargs-name)
|              '("-i")))
|       (shell-mode)))
|   buffer)
`----

So what we read here is that shell will try to evaluate (with your
shell) the file ~/.emacs_bash or ~/.emacs.d/init_bash.sh

So just drop in either file
   alias ls='ls --color'

followed by a blank line (thx comint) and it should work
automagically.

By the way, have you tried eshell ? In most cases, it just works.

-- 
  Paul




reply via email to

[Prev in Thread] Current Thread [Next in Thread]