Emacs font lock mode: provide a custom color instead of a face
On this page discussing font开发者_StackOverflow 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)))))
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)))
or an RGB color definition:
(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)))
A full list of attributes is in the manual.
精彩评论