From: Stefan Monnier <monnier@iro.umontreal.ca>
To: help-gnu-emacs@gnu.org
Subject: Re: Add font-lock pattern to all modes in Emacs 22.x
Date: Fri, 23 Feb 2007 12:31:03 -0500 [thread overview]
Message-ID: <jwvodnklr9e.fsf-monnier+gnu.emacs.help@gnu.org> (raw)
In-Reply-To: 1172178802.741733.247230@j27g2000cwj.googlegroups.com
> (defun my-font-lock-mode-hook ()
> (font-lock-add-keywords
> nil
> (list (cons (concat "^.*" (replace-regexp-in-string "[ \t]+$" ""
> comment-start)
> ".*?\\(TODO\\|todo\\|Todo\\|FIXME\\|fixme\\|
> Fixme\\)")
> (list '(1 'my-todo-face t))))
> 'add-to-end))
Try:
(defun my-font-lock-mode-hook ()
(font-lock-add-keywords
nil
'(("\\<\\(TODO\\|[tT]odo\\|FIXME\\|[fF]ixme\\)\\>"
(1 (if (eq (get-text-property (point) 'face) 'font-lock-comment-face)
'my-todo-face))))
'append))
It will also work in multiline comments ;-)
Stefan
PS: Guaranteed 100% pure untested code only, of course.
prev parent reply other threads:[~2007-02-23 17:31 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-02-22 21:13 Add font-lock pattern to all modes in Emacs 22.x Scott Frazer
2007-02-22 21:28 ` Scott Frazer
2007-02-23 17:31 ` Stefan Monnier [this message]
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=jwvodnklr9e.fsf-monnier+gnu.emacs.help@gnu.org \
--to=monnier@iro.umontreal.ca \
--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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).