[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: highlighting keywords in comments
From: |
Andreas Röhler |
Subject: |
Re: highlighting keywords in comments |
Date: |
Fri, 11 Mar 2011 18:32:51 +0100 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686; de; rv:1.9.1.11) Gecko/20100711 Thunderbird/3.0.6 |
Am 06.03.2011 20:03, schrieb Nathaniel Flath:
In java-mode (and other cc-modes), I have the following code
(font-lock-add-keywords
nil
'(("\\(FIXME\\|TODO\\)" 1 font-lock-warning-face)))
However, this doesn't work on FIXME or TODO words in comments, making it
much less useful. Is there a way for these keywords to be highlighted in
font-lock-warning-face, even in comments?
Thanks,
Nathaniel Flath
maybe a "prepend" helps here?
C-h f font-lock-add-keywords says:
...
For example:
(font-lock-add-keywords 'c-mode
'(("\\<\\(FIXME\\):" 1 font-lock-warning-face prepend)
("\\<\\(and\\|or\\|not\\)\\>" . font-lock-keyword-face)))
adds two fontification patterns for C mode, to fontify `FIXME:' words,
even in
comments, and to fontify `and', `or' and `not' words as keywords.