summaryrefslogtreecommitdiff
path: root/lisp/font-lock.el
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/font-lock.el')
-rw-r--r--lisp/font-lock.el8
1 files changed, 8 insertions, 0 deletions
diff --git a/lisp/font-lock.el b/lisp/font-lock.el
index c826a5f20c6..265cc4bf682 100644
--- a/lisp/font-lock.el
+++ b/lisp/font-lock.el
@@ -698,6 +698,14 @@ see the variables `c-font-lock-extra-types', `c++-font-lock-extra-types',
;; 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.