This is a follow-up question to Adding syntax highlighting for a comment section in Emacs.
I have the following face definition adapted from the definition of
; (defface font-lock-warning-face ; '((t :inherit error)) ; "Font Lock mode face used to highlight warnings." ; :group 'font-lock-faces) (defface my-code-section-face '((t :inherit font-lock-warning-face)) "Face used for comment guards") (defun add-c-syntax-highlighting () (font-lock-add-keywords nil '( ("//\\-+" 0 (if t font-lock-warning-face my-code-section-face) prepend))))
When I use
font-lock-warning-face), the function works. When
nil (to use
my-code-section-face), it does not. I can only assume that it's a problem with how I'm defining the face, but I can't find an issue. (Using
' makes no effective difference.)