Cucumber 的 ANSI 颜色弄乱了 emacs 编译缓冲区 [英] Cucumber's ANSI colors messing up emacs compilation buffer
本文介绍了Cucumber 的 ANSI 颜色弄乱了 emacs 编译缓冲区的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在 Emacs 中工作时,我使用编译命令(默认为 F12)来运行程序.当我在 Emacs 中运行 Cucumber 时,Cucumber 会吐出 Emacs 编译模式无法解释的 ANSI 颜色.结果是丑陋且难以阅读.这是显示丑陋的*编译*缓冲区的片段:
When working in Emacs, I use the compile command (F12 by default) to run programs. When I run Cucumber in Emacs, Cucumber spits out ANSI colors that the Emacs compilation mode doesn't interpret. The result is ugly and hard to read. Here's a snippet of the *compilation* buffer showing the ugly:
^[[31m(::) failed steps (::)^[[0m
我正在使用的命令:
( cd ~/lab/rails/todolist && rake cucumber:all )
版本:
- Emacs 23.1
- 黄瓜 0.8.3
- 黄瓜导轨 0.3.2
如果可以,世界将是阳光和鸟鸣:
The world would be sunshine and birds singing if I could:
- 让 Emacs 解释其编译缓冲区中的 ANSI 颜色代码,或
- 让 Cucumber 停止吐出 ANSI 颜色代码
有什么想法吗?
推荐答案
我用它来打开编译缓冲区中的 ansi 颜色解释:
I use this to turn on ansi color interpretation in my compilation buffer:
(require 'ansi-color)
(defun colorize-compilation-buffer ()
(let ((inhibit-read-only t))
(ansi-color-apply-on-region (point-min) (point-max))))
(add-hook 'compilation-filter-hook 'colorize-compilation-buffer)
这篇关于Cucumber 的 ANSI 颜色弄乱了 emacs 编译缓冲区的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文