I have the following
(defun add-c-syntax-highlighting ()
(font-lock-add-keywords nil '(
("\\<\\(\\-+\\)" 1 font-lock-warning-face prepend)
("\\<\\(FIXME\\):" 1 font-lock-warning-face prepend))))
with
(add-hook 'c-mode-common-hook 'add-c-syntax-highlighting)
Testing on this simple buffer yields seemingly contradictory results:
//FIXME:
//-------------
with only FIXME
fontified. What am I doing wrong?
Answer
My crystal ball tells me what you do wrong is copy&paste code you don't understand. Looks like it's feeling sarcastic today, sorry, I promise I'll get a new one soon.
As for your problem, it's the \\<
in your regexp, which is a special constructor which matches the beginning of a word, so it can never match in front of a -
since words can only start with proper letters or digits.
No comments:
Post a Comment