Reputation: 5648
When I open a shell in emacs (M-x shell) it has trouble displaying many "normal" characters. I'm using Putty on Windows to connect to a linux server (a bash shell). I'm running emacs within Putty with "emacs -nw".
What causes this and how can I fix it?
For example,
Without emacs:
username@server:~/so$ ls -a
. .. bar.txt foo.txt
username@server:~/so$
In emacs:
username@server:~/so$ ls -a
^[[0m^[[01;34m.^[[0m ^[[01;34m..^[[0m bar.txt foo.txt
^[[musername@server:~/so$
Upvotes: 0
Views: 127
Reputation: 137179
What you're seeing are ANSI control sequences for colouring output.
Emacs actually has a number of different ways to access a shell. They each have strengths and weaknesses.
Instead of M-x shell
, try M-x ansi-term
. This supports ANSI colours out of the box and is likely the closest to a "regular terminal", e.g. PuTTY, Konsole or Gnome Terminal.
Upvotes: 1
Reputation: 4804
Try this:
(add-hook 'comint-output-filter-functions 'ansi-color-process-output)
Upvotes: 0