1

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?

2 Answers 2

5

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'
2
  • +1 (Beat me, I was just typing in the same) But not as detailed...
    – Nifle
    Dec 16, 2009 at 19:42
  • which ls /bin/ls I use bash and putting alias ls='ls -A' did not worked
    – Gok Demir
    Dec 16, 2009 at 20:24
1

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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .