Emacs字体锁定模式:提供自定义颜色而不是脸部 [英] Emacs font lock mode: provide a custom color instead of a face
本文介绍了Emacs字体锁定模式:提供自定义颜色而不是脸部的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在此页面讨论字体锁定模式,一个例子是其中突出显示了自定义模式:
On this page discussing font lock mode, an example is provided which highlights a custom pattern:
(add-hook 'c-mode-hook
(lambda ()
(font-lock-add-keywords nil
'(("\\<\\(FIXME\\):" 1 font-lock-warning-face t)))))
是否有提供自定义颜色而不是字体的方法-lock-warning-face
和没有定义新的自定义面。我想要能够写如下:
Is there a way to provide a custom color instead of font-lock-warning-face
and without defining a new custom face. I want to be able to write something like:
(font-lock-add-keywords nil '(("\\<\\(FIXME\\):" 1 "Blue" t)))
或RGB颜色定义:
(font-lock-add-keywords nil '(("\\<\\(FIXME\\):" 1 "#F0F0F0" t)))
使用双引号不起作用。
Using the double quotes doesn't work. Do you know what will make it work?
推荐答案
(font-lock-add-keywords nil '(("\\<\\(FIXME\\):" 1 '(:foreground "blue") t)))
(font-lock-add-keywords nil '(("\\<\\(FIXME\\):" 1 '(:foreground "#F0F0F0") t)))
属性的完整列表位于手动。
这篇关于Emacs字体锁定模式:提供自定义颜色而不是脸部的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文