]> code.delx.au - gnu-emacs/blobdiff - lisp/font-lock.el
-
[gnu-emacs] / lisp / font-lock.el
index 988bf7bd2160d21ef5778c1724f2009c6838dfa4..471db6b148fedb8cee6fc597447f359d0280d258 100644 (file)
@@ -1074,7 +1074,13 @@ accessible portion of the current buffer."
 
 (defvar font-lock-ensure-function
   (lambda (_beg _end)
-    (unless font-lock-fontified (font-lock-default-fontify-buffer)))
+    (unless font-lock-fontified
+      (font-lock-default-fontify-buffer)
+      (unless font-lock-mode
+        ;; If font-lock is not enabled, we don't have the hooks in place to
+        ;; track modifications, so a subsequent call to font-lock-ensure can't
+        ;; assume that the fontification is still valid.
+        (setq font-lock-fontified nil))))
   "Function to make sure a region has been fontified.
 Called with two arguments BEG and END.")