ANSI着色在编译模式 [英] ANSI Coloring in Compilation Mode
问题描述
已经有一个将颜色应用于comint缓冲区的功能。您只需要在编译缓冲区中启用它:
(require'ansi-color)
(defun colorize-compilation-buffer()
(toggle-read-only)
(ansi-color-apply-on-region compilation-filter-start(point))
切换只读))
(add-hook'compilation-filter-hook'colorize-compilation-buffer)
颜色编写程序应检查 TERM
环境变量和terminfo数据库,以检查终端是否支持颜色。实际上,很多程序忽略这一点,并且依赖于用户设置。默认情况下,Emacs会将编译终端类型设置为 dumb
,但可以通过设置编译环境
变量来覆盖。
Have anyone added support for ansi-color in compilation-mode Emacs? If so what property/attribute does the color-writing program have to check for in order to make sure its active terminal supports ANSI-escape coloring.
There's already a function for applying color to comint buffers. You simply need to enable it on compilation buffers:
(require 'ansi-color)
(defun colorize-compilation-buffer ()
(toggle-read-only)
(ansi-color-apply-on-region compilation-filter-start (point))
(toggle-read-only))
(add-hook 'compilation-filter-hook 'colorize-compilation-buffer)
Color writing programs should check the TERM
environment variable and the terminfo database to check if the terminal supports color. In practice, a lot of programs ignore this and rely on a user setting. Emacs will set the compilation terminal type to dumb
by default but this can be overriden by setting the compilation-environment
variable.
这篇关于ANSI着色在编译模式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!