tags:

views:

1619

answers:

5

I use Ubuntu8.10 and emacs-snapshot. Running shell-mode on emacs and input "ls" shows escape codes:

screenshot

How can I get the output I expect?

A: 

The problem is that "l" is trying to colorise the output and emacs isn't having any of it. Try the following:

$ unalias l
$ alias l ls --color=never
Vatine
how to only change it in emacs?
linjunhalida
TERM=dumb ls, probably.
jrockway
+3  A: 

Furthermore, you may choose another shell: M-x term or M-x eshell. The former provides an interface that is much closer to a real terminal emulator than shell-mode (once you start it, you can get out of the mode with C-c C-j and get in again with C-c C-k). The latter is a shell implementation written in Elisp (you can use the common shell commands as well as evaluating Lisp code).

Török Gábor
I know eshell, but I don't like it, not that powerful.
linjunhalida
You are saying a general purpose programing langauge is less powerful than *shell*? I think you just don't know how to use it.
jrockway
I do not mean that. It is not about any languages versus shell, but the `shell-mode` and its alternatives. If you want a shell inside Emacs, I found myself `term-mode` much convenient, which allows the buffer to behave like a real terminal or you can work on it as any other common Emacs buffer.
Török Gábor
+21  A: 

You can use AnsiTerm which does support colors or you can enable AnsiColor for the normal shell:

(autoload 'ansi-color-for-comint-mode-on "ansi-color" nil t)
(add-hook 'shell-mode-hook 'ansi-color-for-comint-mode-on)
danielpoe
A: 

Expanding on vatine's answer, you can add that inside your .cshrc (.tcshrc/.bashrc) wrapped with a check for the environment variable INSIDE_EMACS.

For example (from my .tcshrc):

if ( $?INSIDE_EMACS ) then
   alias l 'ls --color=never'
endif
Trey Jackson
+1  A: 

M-x ansi-color-for-comint-mode-on

Mahesh Lavannis