unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Adding to font-lock-keywords doesn't seem to immediately take effect?
@ 2008-12-03 20:30 seberino
  0 siblings, 0 replies; only message in thread
From: seberino @ 2008-12-03 20:30 UTC (permalink / raw)
  To: help-gnu-emacs

I'm trying to write a simple toy mode that highlights chars after
column 80......

(define-minor-mode warning80-mode
      " " nil " W80" nil
      (if warning80-mode
             (font-lock-add-keywords nil
                                     '(("^.\\{80\\}\\(.*\\)$"
                                        1
                                        font-lock-warning-face
                                        prepend)))
             (font-lock-remove-keywords nil
                                     '(("^.\\{80\\}\\(.*\\)$"
                                        1
                                        font-lock-warning-face
                                        prepend))))
      (font-lock-fontify-buffer))


It successfully highlights chars past column 80 and turns off
successfully.

The problem is that I must turn the mode on and off a few times to get
it to
start working.

Also, after it starts to "work"....it makes EVERYTHING be highlighted
thereafter as if it is ALL past col 80!!!

Any help greatly appreciated.

Chris



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2008-12-03 20:30 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-12-03 20:30 Adding to font-lock-keywords doesn't seem to immediately take effect? seberino

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