(font-lock-ensure-function): Fix bug#22399

* lisp/font-lock.el (font-lock-ensure-function): Fix handling when
font-lock-mode is not enabled (bug#22399).
This commit is contained in:
Stefan Monnier 2016-01-25 09:28:37 -05:00
parent ec90220ac1
commit 21beb19d80

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