diff options
| author | Karl Heuer | 1995-05-29 06:59:49 +0000 |
|---|---|---|
| committer | Karl Heuer | 1995-05-29 06:59:49 +0000 |
| commit | 800479f5fda5fd1454c08c70a12c150e053fce77 (patch) | |
| tree | 8323823d66c9f12cf4024f9b4ed59889a8c05841 | |
| parent | ba5c8c93695b8baab586e0fe45b205032621e010 (diff) | |
| download | emacs-800479f5fda5fd1454c08c70a12c150e053fce77.tar.gz emacs-800479f5fda5fd1454c08c70a12c150e053fce77.zip | |
(font-lock-revert-cleanup): Always turn font lock on.
(font-lock-mode): When turning mode off, always take out
the revert hooks.
| -rw-r--r-- | lisp/font-lock.el | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/lisp/font-lock.el b/lisp/font-lock.el index c6d5ef1ac33..83ca7e049cc 100644 --- a/lisp/font-lock.el +++ b/lisp/font-lock.el | |||
| @@ -639,6 +639,8 @@ size, you can use \\[font-lock-fontify-buffer]." | |||
| 639 | (font-lock-unfontify-region (point-min) (point-max)) | 639 | (font-lock-unfontify-region (point-min) (point-max)) |
| 640 | (font-lock-thing-lock-cleanup)) | 640 | (font-lock-thing-lock-cleanup)) |
| 641 | (t | 641 | (t |
| 642 | (remove-hook 'before-revert-hook 'font-lock-revert-setup) | ||
| 643 | (remove-hook 'after-revert-hook 'font-lock-revert-cleanup) | ||
| 642 | (font-lock-thing-lock-cleanup))) | 644 | (font-lock-thing-lock-cleanup))) |
| 643 | (force-mode-line-update))) | 645 | (force-mode-line-update))) |
| 644 | 646 | ||
| @@ -648,6 +650,9 @@ size, you can use \\[font-lock-fontify-buffer]." | |||
| 648 | (font-lock-mode 1)) | 650 | (font-lock-mode 1)) |
| 649 | 651 | ||
| 650 | ;; Turn off other related packages if they're on. I prefer a hook. | 652 | ;; Turn off other related packages if they're on. I prefer a hook. |
| 653 | ;; These explicit calls are easier to understand | ||
| 654 | ;; because people know what they will do. | ||
| 655 | ;; A hook is a mystery because it might do anything whatever. -- rms. | ||
| 651 | (defun font-lock-thing-lock-cleanup () | 656 | (defun font-lock-thing-lock-cleanup () |
| 652 | (cond ((and (boundp 'fast-lock-mode) fast-lock-mode) | 657 | (cond ((and (boundp 'fast-lock-mode) fast-lock-mode) |
| 653 | (fast-lock-mode -1)) | 658 | (fast-lock-mode -1)) |
| @@ -661,17 +666,14 @@ size, you can use \\[font-lock-fontify-buffer]." | |||
| 661 | ((and (boundp 'lazy-lock-mode) lazy-lock-mode) | 666 | ((and (boundp 'lazy-lock-mode) lazy-lock-mode) |
| 662 | (lazy-lock-after-fontify-buffer)))) | 667 | (lazy-lock-after-fontify-buffer)))) |
| 663 | 668 | ||
| 664 | ;; If the buffer is about to be reverted, it won't be fontified. | 669 | ;; If the buffer is about to be reverted, it won't be fontified afterward. |
| 665 | (defun font-lock-revert-setup () | 670 | (defun font-lock-revert-setup () |
| 666 | (setq font-lock-fontified nil)) | 671 | (setq font-lock-fontified nil)) |
| 667 | 672 | ||
| 668 | ;; If the buffer has just been reverted, we might not even be in font-lock | 673 | ;; If the buffer has just been reverted, normally that turns off |
| 669 | ;; mode anymore, and if we are, the buffer may or may not have already been | 674 | ;; Font Lock mode. So turn the mode back on if necessary. |
| 670 | ;; refontified. Refontify here if it looks like we need to. | ||
| 671 | (defun font-lock-revert-cleanup () | 675 | (defun font-lock-revert-cleanup () |
| 672 | (and font-lock-mode | 676 | (font-lock-mode 1)) |
| 673 | (not font-lock-fontified) | ||
| 674 | (font-lock-mode 1))) | ||
| 675 | 677 | ||
| 676 | ;;;###autoload | 678 | ;;;###autoload |
| 677 | (defun font-lock-fontify-buffer () | 679 | (defun font-lock-fontify-buffer () |