Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

While emacs shell mode when I run

ls

I get following

   [0m[01;32mmanage.py[0m     [01;34mtemplates[0m

these must be manage.py and templates. Why its like that and how can fix it?

share|improve this question

2 Answers 2

Those are vt100 codes for color display (which is usually enabled by default on most Linux distros today). Emacs shell doesn't handle the vt100 escape codes.

Find out whether your ls command is aliased.

which ls

Does it look like like the following or something similar?

ls: alias to ls --color=tty

If so you'll need to find where this alias is set and unalias it or change how it is called.

Your shell knows it is running in an emacs shell if the EMACS environment setting is set to t. You can do something like the following to set alternate functions. I use zsh, so this contains some items specific to that shell.

## for emacs
if [[ $EMACS = "t" ]] then
   PROMPT="%# "  # make the prompt simple
   unsetopt zle  # turn off advanced line editting

   ls_pager=( cat ) # ls is simple piped to cat
   ls_flags=( -A )  # default ls flags
fi

For bash you can you just alias ls

alias ls='ls -A'
share|improve this answer
    
+1 (Beat me, I was just typing in the same) But not as detailed... –  Nifle Dec 16 '09 at 19:42
    
which ls /bin/ls I use bash and putting alias ls='ls -A' did not worked –  Gok Demir Dec 16 '09 at 20:24
up vote 0 down vote accepted

I put ~/.emacs

(add-hook 'shell-mode-hook 'ansi-color-for-comint-mode-on)

and it solved my problem. Anyway thanks for answering. The link that solved my problem.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.