diff lisp/font-lock.el @ 78000:4d83e9f9b01e

(font-lock-add-keywords): In case font-lock was only half-activated, forcefully activate it completely.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Mon, 11 Jun 2007 21:57:11 +0000
parents bc5c78f77063
children 9355f9b7bbff 7ef84bc04072 9c01792a3ce8 3619e7770f2e
line wrap: on
line diff
--- a/lisp/font-lock.el	Mon Jun 11 15:46:12 2007 +0000
+++ b/lisp/font-lock.el	Mon Jun 11 21:57:11 2007 +0000
@@ -698,6 +698,14 @@
 	 ;; contain the new keywords.
 	 (font-lock-update-removed-keyword-alist mode keywords how))
 	(t
+         (when (and font-lock-mode
+                    (not (or font-lock-keywords font-lock-defaults)))
+           ;; The major mode has not set any keywords, so when we enabled
+           ;; font-lock-mode it only enabled the font-core.el part, not the
+           ;; font-lock-mode-internal.  Try again.
+           (font-lock-mode -1)
+           (set (make-local-variable 'font-lock-defaults) '(nil t))
+           (font-lock-mode 1))
 	 ;; Otherwise set or add the keywords now.
 	 ;; This is a no-op if it has been done already in this buffer
 	 ;; for the correct major mode.