Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to have colors in the output of (emacs) shell-command?

Tags:

emacs

xemacs

When executing the command shell-command, the output shown in the associated buffer is not colorized.

This is particularly annoying when calling a testing framework (outputting yellow/green/red...) from within emacs.

How can I configure, or extend, emacs in order to have shell-command allowing colorized output in the shell and preserving the colors while representing that output?

Thanks!

ps. I'm using the Bash shell, on a UN*X system.

like image 338
mgodinho Avatar asked Oct 29 '25 10:10

mgodinho


1 Answers

You can implement your own shell-execute, something like

(defun my-shell-execute(cmd)
   (interactive "sShell command: ")
   (shell (get-buffer-create "my-shell-buf"))
   (process-send-string (get-buffer-process "my-shell-buf") (concat cmd "\n")))
like image 63
Oleg Pavliv Avatar answered Oct 31 '25 03:10

Oleg Pavliv