all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / 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

* RE: Highlighting of special word-tags in all modes
  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
  1 sibling, 0 replies; 3+ messages in thread
From: Herbert Euler @ 2007-05-06 16:14 UTC (permalink / raw)
  To: per.nordlow, help-gnu-emacs

You can add to the hook `after-change-major-mode-hook':

after-change-major-mode-hook is a variable defined in `subr.el'.

Documentation:
Normal hook run at the very end of major mode functions.

Regards,
Guanpeng Xu

_________________________________________________________________
Don't just search. Find. Check out the new MSN Search! 
http://search.msn.com/

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

* Re: Highlighting of special word-tags in all modes
  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
  1 sibling, 0 replies; 3+ messages in thread
From: Stefan Monnier @ 2007-05-07  8:40 UTC (permalink / raw)
  To: help-gnu-emacs

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

Why not add to font-lock-mode?


        Stefan

^ 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

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.