开发者

Weird control characters in ruby test output inside emacs buffer

I'm using ruby-test to run rails tests from inside emacs into the *Ruby-Test* buffer. It works great except that the output is cluttered with ascii color-control characters (not sure what the right terminology is).

Example:

MyTest:
    ^[[32m     PASS^[[0m Test Pa开发者_StackOverflow中文版ssed (2.85s) 

If I run the test in a terminal that shows up as a green "PASS". Is there something I can do to get the colors to show up in my output buffer?

There's a related question about getting color for commands run with M-|, but I couldn't figure out how to adapt it for a generic buffer.

emacs shell command output not showing ANSI colors but the code


In order to get Emacs to guess ansi-color mode for regular buffers, use:

(require 'tty-format)
(add-hook 'find-file-hooks 'tty-format-guess)

You need to download the tty-format package first. See: https://unix.stackexchange.com/questions/19494/how-to-colorize-text-in-emacs

Looking at the code, it looks like the author's made a bunch of questionable decisions, but maybe this will help:

(defadvice ruby-test-runner-sentinel (after add-ansi-colors activate compile)
  (ansi-color-apply-on-region (point-min) (point-max)))


Do you have ansi-color.el installed and active? See this also.


Try running the

ansi-color-for-coming-mode-on

function in this buffer

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜