From: jpkotta <jpkotta@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Re: highlighting keywords in comments
Date: Mon, 7 Mar 2011 08:18:59 -0800 (PST) [thread overview]
Message-ID: <fe1e2121-633a-4fbb-8d32-57d17b038e5b@a21g2000prj.googlegroups.com> (raw)
In-Reply-To: jwvwrkcos0y.fsf-monnier+gnu.emacs.help@gnu.org
On Mar 6, 3:31 pm, Stefan Monnier <monn...@iro.umontreal.ca> wrote:
> > 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?
>
> Check the doc of `font-lock-keywords', especially the OVERRIDE part.
>
> Stefan
(defvar warning-words-regexp
(regexp-opt '("FIXME" "TODO" "BUG" "XXX" "DEBUG") 'words)
"Regexp matching words that commonly denote something that
warrants attention in programs.")
(setq warning-words-font-lock-spec
(cons warning-words-regexp
(list
0 ;; use whole match
'font-lock-warning-face
t ;; OVERRIDE
)))
(font-lock-add-keywords
'c-mode ;; or nil for current buffer
(list
warning-words-font-lock-spec))
next prev parent reply other threads:[~2011-03-07 16:18 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <mailman.3.1299438195.5045.help-gnu-emacs@gnu.org>
2011-03-06 21:22 ` highlighting keywords in comments Tim X
2011-03-06 21:31 ` Stefan Monnier
2011-03-07 16:18 ` jpkotta [this message]
2011-03-06 19:03 Nathaniel Flath
2011-03-11 17:32 ` Andreas Röhler
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=fe1e2121-633a-4fbb-8d32-57d17b038e5b@a21g2000prj.googlegroups.com \
--to=jpkotta@gmail.com \
--cc=help-gnu-emacs@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.