Color codes are not working on my Windows 7 box. I have working colors in Git Bash that comes with the Git install.
Here is what I get:
Emacs Stack Exchange is a question and answer site for those using, extending or developing Emacs. It only takes a minute to sign up.Sign up to join this community
Except for "log" Magit never tells Git to
--color its output. It also doesn't
--no-color explicitly, because that usually is not necessary. In my experience Git is usually capable of figuring out when to use colors and when not. So the most likely cause for this issue that you have (or some tool you use has) explicitly told Git to always color its output.
Check the values of
git config --list | grep color).
color.ui This variable determines the default value for variables such as color.diff and color.grep that control the use of color per command family. Its scope will expand as more commands learn configuration to set a default for the --color option. Set it to false or never if you prefer Git commands not to use color unless enabled explicitly with some other configuration or the --color option. Set it to always if you want all output not intended for machine consumption to use color, to true or auto (this is the default since Git 1.8.4) if you want such output to use color when written to the terminal.
I am a bit confused about the "since Git 1.8.4", I was pretty sure that was always the case.
Anyway, if you cannot set this in your Git configuration, then appending
("-c" "core.ui=false") to
magit-git-standard-options should also work.
You can use the ansi-color package (bundled with Emacs) to handle the output properly without having to turn off colors.
M-x load-library RET ansi-color RET M-: (ansi-color-apply-on-region (point-min) (point-max)) RET
To automatically apply the function, use the following in your .emacs file:
;; load package (require 'ansi-color) ;; function for colorizing (defun colorize-buffer () (interactive) (toggle-read-only) (ansi-color-apply-on-region (point-min) (point-max)) (toggle-read-only)) ;; add hook to apply the function when magit mode is enabled (add-hook 'magit-mode-hook 'colorize-buffer)