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

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

Adding to font-lock-keywords doesn't seem to immediately take effect?


From: address@hidden
Subject: Adding to font-lock-keywords doesn't seem to immediately take effect?
Date: Wed, 3 Dec 2008 12:30:52 -0800 (PST)
User-agent: G2/1.0

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



reply via email to

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