(font-lock-revert-cleanup): Always turn font lock on.

(font-lock-mode): When turning mode off, always take out
the revert hooks.
This commit is contained in:
Karl Heuer 1995-05-29 06:59:49 +00:00
parent ba5c8c9369
commit 800479f5fd

View file

@ -639,6 +639,8 @@ size, you can use \\[font-lock-fontify-buffer]."
(font-lock-unfontify-region (point-min) (point-max)) (font-lock-unfontify-region (point-min) (point-max))
(font-lock-thing-lock-cleanup)) (font-lock-thing-lock-cleanup))
(t (t
(remove-hook 'before-revert-hook 'font-lock-revert-setup)
(remove-hook 'after-revert-hook 'font-lock-revert-cleanup)
(font-lock-thing-lock-cleanup))) (font-lock-thing-lock-cleanup)))
(force-mode-line-update))) (force-mode-line-update)))
@ -648,6 +650,9 @@ size, you can use \\[font-lock-fontify-buffer]."
(font-lock-mode 1)) (font-lock-mode 1))
;; Turn off other related packages if they're on. I prefer a hook. ;; Turn off other related packages if they're on. I prefer a hook.
;; These explicit calls are easier to understand
;; because people know what they will do.
;; A hook is a mystery because it might do anything whatever. -- rms.
(defun font-lock-thing-lock-cleanup () (defun font-lock-thing-lock-cleanup ()
(cond ((and (boundp 'fast-lock-mode) fast-lock-mode) (cond ((and (boundp 'fast-lock-mode) fast-lock-mode)
(fast-lock-mode -1)) (fast-lock-mode -1))
@ -661,17 +666,14 @@ size, you can use \\[font-lock-fontify-buffer]."
((and (boundp 'lazy-lock-mode) lazy-lock-mode) ((and (boundp 'lazy-lock-mode) lazy-lock-mode)
(lazy-lock-after-fontify-buffer)))) (lazy-lock-after-fontify-buffer))))
;; If the buffer is about to be reverted, it won't be fontified. ;; If the buffer is about to be reverted, it won't be fontified afterward.
(defun font-lock-revert-setup () (defun font-lock-revert-setup ()
(setq font-lock-fontified nil)) (setq font-lock-fontified nil))
;; If the buffer has just been reverted, we might not even be in font-lock ;; If the buffer has just been reverted, normally that turns off
;; mode anymore, and if we are, the buffer may or may not have already been ;; Font Lock mode. So turn the mode back on if necessary.
;; refontified. Refontify here if it looks like we need to.
(defun font-lock-revert-cleanup () (defun font-lock-revert-cleanup ()
(and font-lock-mode (font-lock-mode 1))
(not font-lock-fontified)
(font-lock-mode 1)))
;;;###autoload ;;;###autoload
(defun font-lock-fontify-buffer () (defun font-lock-fontify-buffer ()