[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Add font-lock pattern to all modes in Emacs 22.x
From: |
Stefan Monnier |
Subject: |
Re: Add font-lock pattern to all modes in Emacs 22.x |
Date: |
Fri, 23 Feb 2007 12:31:03 -0500 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/22.0.93 (gnu/linux) |
> (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.