My emacs lists strange escape characters in shell buffers:
me@ubuntu:~//configuration.template/hooks$
me@ubuntu:~//configuration.template/hooks$ ls
[0m[01;32mpost-commit[0m [01;32mpost-commit~[0m [01;32mpost-update[0m
[01;32mpost-update~[0m [01;32mpre-commit[0m [01;32mpre-commit~[0m [01;32mupdate[0m update~
Anyone knows how I can fix that?
Best Answer
These characters are color-changing control sequences. These sequences don't work in emacs
*shell*
buffers: instead they are displayed almost directly.You should change your shell startup file (probably
~/.bashrc
) so thatls
uses colors only in terminals that support them. In practice, this is likely to mean on every terminal type other thandumb
(which is the terminal type provided in*shell*
buffers). The terminal type is indicated in theTERM
environment variable, so you can do something like this: