I have run M-x ansi-color-for-comint-mode-on
.
Also, when I use /bin/ls --color=always
(or /bin/ls --color=auto
) in a regular terminal, I do see colors in the output.
It's only within Emacs' shell-mode
that these commands fail to produced colorized output. (The variable LS_COLORS
is set to the empty string in all cases.)
Strangely enough, grep --color=always
does produce colorized output, even in shell-mode
. The echoed commands are are also colorized.
(NB: in the illustration above I passed the options -1aF --color=always
to /bin/ls
, but I get the same "monochrome" output with no flags, or with any combination of flags, and with any argument for the --color
option.)
Is there anything else I need to do to get /bin/ls
to produce colorized output in shell-mode
?
config
;; ~/.emacs
(add-hook 'shell-mode-hook 'ansi-color-for-comint-mode-on)
(require 'comint)
(set-face-attribute 'comint-highlight-prompt nil
:inherit nil)
# ~/.zshrc
LS_COLORS='';
export LS_COLORS
PS1=$'%# '
ansi-color-for-comint-mode
says, "In order for this to have any effect,ansi-color-process-output
must be incomint-output-filter-functions
". Is it, for you? (It is, for me -- I have(ansi-color-process-output comint-postoutput-scroll-to-bottom comint-watch-for-password-prompt)
-- and I getls
colors.)ls
.ls
produces colored output when run inshell-mode
, what version are you using?TERM=dumb
instartup.el
and myls
from GNU coreutils 8.24 checksTERM
even with--color=always
.dumb
is not a terminal type recognized bydircolors
(the utility used byls
to decide how to color the output), so runningTERM=ansi ls --color=always
in a*shell*
buffer works as expected, whilels --color=always
does not. So, I would recommend creating an alias similar toalias lls="TERM=ansi gls --color=always"
.