我使用ruby-test将rails测试从emacs内部运行到*Ruby-Test*缓冲区中。它工作得很好,除了输出中混杂着ascii颜色控制字符(不确定正确的术语是什么)。
示例:
MyTest:
^[[32m PASS^[[0m Test Passed (2.85s) 如果我在显示为绿色“通过”的终端中运行测试。有什么方法可以让颜色显示在我的输出缓冲区中吗?
有一个相关的问题,关于使用M-|运行的命令获取颜色,但我不知道如何使其适用于通用缓冲区。
emacs shell command output not showing ANSI colors but the code
发布于 2011-09-29 11:16:08
为了让Emacs猜测常规缓冲区的ansi颜色模式,请使用:
(require 'tty-format)
(add-hook 'find-file-hooks 'tty-format-guess)您需要首先对tty格式的包进行download。请参阅:https://unix.stackexchange.com/questions/19494/how-to-colorize-text-in-emacs
看一下代码,看起来作者做出了一堆有问题的决定,但这可能会有所帮助:
(defadvice ruby-test-runner-sentinel (after add-ansi-colors activate compile)
(ansi-color-apply-on-region (point-min) (point-max)))发布于 2011-09-29 05:55:57
您是否已安装ansi-color.el并处于活动状态?See this also.
发布于 2011-09-29 05:56:55
尝试运行
ansi-color-for-coming-mode-on此缓冲区中的函数
https://stackoverflow.com/questions/7589677
复制相似问题