unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Highlighting of special word-tags in all modes
@ 2007-05-06 12:17 Nordlöw
  2007-05-06 16:14 ` Herbert Euler
  2007-05-07  8:40 ` Stefan Monnier
  0 siblings, 2 replies; 3+ messages in thread
From: Nordlöw @ 2007-05-06 12:17 UTC (permalink / raw)
  To: help-gnu-emacs

Hey again, Hackers!

How do I make the following code active in *all* modes in Emacs?
Adding a hook to the text-mode-hook works for many but not *all*
modes. Here is the code:


(defvar alert-tags
  '("FIXME" "FixMe"
    "TODO" "ToDo"
    "TEST" "Test"
    "NOTE" "Note"
    "WARNING" "Warning"
    "OBS" "Obs"
    "OBSERVE" "Observe"
    )
  "Special tags/words mainly used in source code comments to alert the
reader about important things.")

(defun alert-tags-font-locking ()
  (font-lock-add-keywords
   nil
   (list
    (cons (concat "\\<\\(" (regexp-opt alert-tags) "\\):")
	  '(1 'font-lock-warning-face prepend)) ;need prepend-merge to
override inside comments
    )))

(add-hook 'text-mode-hook 'alert-tags-font-locking) ;all modes for now



Many Thanks in advance,
Nordlöw

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2007-05-07  8:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-05-06 12:17 Highlighting of special word-tags in all modes Nordlöw
2007-05-06 16:14 ` Herbert Euler
2007-05-07  8:40 ` Stefan Monnier

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).