help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Highlighting of special word-tags in all modes


From: Nordlöw
Subject: Highlighting of special word-tags in all modes
Date: 6 May 2007 05:17:46 -0700
User-agent: G2/1.0

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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]