Some fixes to follow coding conventions in files maintained by FSF.
[bpt/emacs.git] / lisp / lazy-lock.el
index 5f048d3..ef18b8a 100644 (file)
@@ -1,12 +1,14 @@
-;;; lazy-lock.el --- Lazy demand-driven fontification for fast Font Lock mode.
+;;; lazy-lock.el --- lazy demand-driven fontification for fast Font Lock mode
 
-;; Copyright (C) 1994, 1995, 1996, 1997 Free Software Foundation, Inc.
+;; Copyright (C) 1994, 1995, 1996, 1997, 1998, 2001
+;;   Free Software Foundation, Inc.
 
-;; Author: Simon Marshall <simon@gnu.ai.mit.edu>
+;; Author: Simon Marshall <simon@gnu.org>
+;; Maintainer: FSF
 ;; Keywords: faces files
-;; Version: 2.08
+;; Version: 2.11
 
-;;; This file is part of GNU Emacs.
+;; This file is part of GNU Emacs.
 
 ;; GNU Emacs is free software; you can redistribute it and/or modify
 ;; it under the terms of the GNU General Public License as published by
 ;; point in making this version of lazy-lock.el work with it.  Anyway, that's
 ;; Lit 30 of my humble opinion.
 ;;
-;; Steve Baur reverted to a non-hacked version 1 lazy-lock.el for XEmacs 19.15
-;; and 20.0.  Obviously, the above `post-command-hook' problems still apply.)
-;;
 ;; - Version 1 stealth fontification is also implemented by placing a function
 ;; on `post-command-hook'.  This function waits for a given amount of time,
 ;; and, if Emacs remains idle, fontifies where necessary.  Again, there are a
 ;; - Removed `lazy-lock-submit-bug-report' and bade farewell
 ;; 2.07--2.08:
 ;; - Made `lazy-lock-fontify-conservatively' fontify around `window-point'
+;; - Made `save-buffer-state' wrap `inhibit-point-motion-hooks'
 ;; - Added Custom support
+;; 2.08--2.09:
+;; - Removed `byte-*' variables from `eval-when-compile' (Erik Naggum hint)
+;; - Made various wrapping `inhibit-point-motion-hooks' (Vinicius Latorre hint)
+;; - Made `lazy-lock-fontify-after-idle' wrap `minibuffer-auto-raise'
+;; - Made `lazy-lock-fontify-after-defer' paranoid about deferred buffers
+;; 2.09--2.10:
+;; - Use `window-end' UPDATE arg for Emacs 20.4 and later.
+;; - Made deferral `widen' before unfontifying (Dan Nicolaescu report)
+;; - Use `lazy-lock-fontify-after-visage' for hideshow.el (Dan Nicolaescu hint)
+;; - Use `other' widget where possible (Andreas Schwab fix)
+;; 2.10--2.11:
+;; - Used `with-temp-message' where possible to make messages temporary.
 \f
 ;;; Code:
 
 (require 'font-lock)
 
-;; Make sure lazy-lock.el is supported.
-(if (if (save-match-data (string-match "Lucid\\|XEmacs" (emacs-version)))
-       t
-      (and (= emacs-major-version 19) (< emacs-minor-version 30)))
-    (error "`lazy-lock' was written for Emacs 19.30 or later"))
-
 (eval-when-compile
-  ;;
-  ;; We don't do this at the top-level as idle timers are not necessarily used.
-  (require 'timer)
   ;; We don't do this at the top-level as we only use non-autoloaded macros.
   (require 'cl)
   ;;
-  ;; Well, shouldn't Lazy Lock mode be as lazy as possible?
-  (setq byte-compile-dynamic t byte-compile-dynamic-docstrings t)
-  ;; But, we make sure that the code is as zippy as can be.
-  (setq byte-optimize t)
-  ;;
   ;; We use this to preserve or protect things when modifying text properties.
   (defmacro save-buffer-state (varlist &rest body)
     "Bind variables according to VARLIST and eval BODY restoring buffer state."
 The order of execution is thus BODY, TEST, BODY, TEST and so on
 until TEST returns nil."
     (` (while (progn (,@ body) (, test)))))
-  (put 'do-while 'lisp-indent-function (get 'while 'lisp-indent-function))
-  ;;
-  ;; We use this for clarity and speed.  Borrowed from a future Emacs.
-  (or (fboundp 'with-current-buffer)
-      (defmacro with-current-buffer (buffer &rest body)
-       "Execute the forms in BODY with BUFFER as the current buffer.
-The value returned is the value of the last form in BODY."
-       (` (save-excursion (set-buffer (, buffer)) (,@ body)))))
-  (put 'with-current-buffer 'lisp-indent-function 1))
-
-;(defun lazy-lock-submit-bug-report ()
-;  "Submit via mail a bug report on lazy-lock.el."
-;  (interactive)
-;  (let ((reporter-prompt-for-summary-p t))
-;    (reporter-submit-bug-report "simon@gnu.ai.mit.edu" "lazy-lock 2.08"
-;     '(lazy-lock-minimum-size lazy-lock-defer-on-the-fly
-;       lazy-lock-defer-on-scrolling lazy-lock-defer-contextually
-;       lazy-lock-defer-time lazy-lock-stealth-time
-;       lazy-lock-stealth-load lazy-lock-stealth-nice lazy-lock-stealth-lines
-;       lazy-lock-stealth-verbose)
-;     nil nil
-;     (concat "Hi Si.,
-;
-;I want to report a bug.  I've read the `Bugs' section of `Info' on Emacs, so I
-;know how to make a clear and unambiguous report.  To reproduce the bug:
-;
-;Start a fresh editor via `" invocation-name " -no-init-file -no-site-file'.
-;In the `*scratch*' buffer, evaluate:"))))
+  (put 'do-while 'lisp-indent-function (get 'while 'lisp-indent-function)))
 
 (defvar lazy-lock-mode nil)                    ; Whether we are turned on.
 (defvar lazy-lock-buffers nil)                 ; For deferral.
@@ -330,12 +301,7 @@ The value returned is the value of the last form in BODY."
 \f
 ;; User Variables:
 
-(defgroup lazy-lock nil
-  "Font Lock support mode to fontify lazily."
-  :link '(custom-manual "(emacs)Support Modes")
-  :group 'font-lock)
-
-(defcustom lazy-lock-minimum-size (* 25 1024)
+(defcustom lazy-lock-minimum-size 25600
   "*Minimum size of a buffer for demand-driven fontification.
 On-demand fontification occurs if the buffer size is greater than this value.
 If nil, means demand-driven fontification is never performed.
@@ -401,7 +367,7 @@ makes little sense if `lazy-lock-defer-contextually' is non-nil.)
 The value of this variable is used when Lazy Lock mode is turned on."
   :type '(choice (const :tag "never" nil)
                 (const :tag "always" t)
-                (const eventually))
+                (other :tag "eventually" eventually))
   :group 'lazy-lock)
 
 (defcustom lazy-lock-defer-contextually 'syntax-driven
@@ -419,11 +385,11 @@ buffer mode's syntax table, i.e., only if `font-lock-keywords-only' is nil.
 The value of this variable is used when Lazy Lock mode is turned on."
   :type '(choice (const :tag "never" nil)
                 (const :tag "always" t)
-                (const syntax-driven))
+                (other :tag "syntax-driven" syntax-driven))
   :group 'lazy-lock)
 
 (defcustom lazy-lock-defer-time
-  (if (featurep 'lisp-float-type) (/ (float 1) (float 3)) 1)
+  (if (featurep 'lisp-float-type) (/ (float 1) (float 4)) 1)
   "*Time in seconds to delay before beginning deferred fontification.
 Deferred fontification occurs if there is no input within this time.
 If nil, means fontification is never deferred, regardless of the values of the
@@ -454,8 +420,7 @@ taking longer to fontify, you could reduce the value of this variable."
   :group 'lazy-lock)
 
 (defcustom lazy-lock-stealth-load
-  (when (condition-case nil (load-average) (error))
-    200)
+  (if (condition-case nil (load-average) (error)) 200)
   "*Load in percentage above which stealth fontification is suspended.
 Stealth fontification pauses when the system short-term load average (as
 returned by the function `load-average' if supported) goes above this level,
@@ -467,7 +432,7 @@ See also `lazy-lock-stealth-nice'."
   :type (if (condition-case nil (load-average) (error))
            '(choice (const :tag "never" nil)
                     (integer :tag "load"))
-         '(const :tag "never" nil))
+         '(const :format "%t: unsupported\n" nil))
   :group 'lazy-lock)
 
 (defcustom lazy-lock-stealth-nice
@@ -484,8 +449,8 @@ See also `lazy-lock-stealth-load'."
   :group 'lazy-lock)
 
 (defcustom lazy-lock-stealth-verbose
-  (when (featurep 'lisp-float-type)
-    (and font-lock-verbose (not lazy-lock-defer-contextually)))
+  (if (featurep 'lisp-float-type)
+      (and (not lazy-lock-defer-contextually) (not (null font-lock-verbose))))
   "*If non-nil, means stealth fontification should show status messages."
   :type 'boolean
   :group 'lazy-lock)
@@ -635,7 +600,9 @@ verbosity is controlled via the variable `lazy-lock-stealth-verbose'."
   ;;
   ;; Add package-specific hook.
   (make-local-hook 'outline-view-change-hook)
-  (add-hook 'outline-view-change-hook 'lazy-lock-fontify-after-outline nil t))
+  (add-hook 'outline-view-change-hook 'lazy-lock-fontify-after-visage nil t)
+  (make-local-hook 'hs-hide-hook)
+  (add-hook 'hs-hide-hook 'lazy-lock-fontify-after-visage nil t))
 
 (defun lazy-lock-install-timers (dtime stime)
   ;; Schedule or re-schedule the deferral and stealth timers.
@@ -665,13 +632,13 @@ verbosity is controlled via the variable `lazy-lock-stealth-verbose'."
       (let ((verbose (if (numberp font-lock-verbose)
                         (> (buffer-size) font-lock-verbose)
                       font-lock-verbose)))
-       (if verbose (message "Fontifying %s..." (buffer-name)))
-       ;; Make sure we fontify etc. in the whole buffer.
-       (save-restriction
-         (widen)
-         (lazy-lock-fontify-region (point-min) (point-max)))
-       (if verbose (message "Fontifying %s...%s" (buffer-name)
-                            (if (lazy-lock-unfontified-p) "quit" "done")))))
+       (with-temp-message
+           (when verbose
+             (format "Fontifying %s..." (buffer-name)))
+         ;; Make sure we fontify etc. in the whole buffer.
+         (save-restriction
+           (widen)
+           (lazy-lock-fontify-region (point-min) (point-max))))))
     (add-hook 'after-change-functions 'font-lock-after-change-function nil t))
   ;;
   ;; Remove the text properties.
@@ -685,7 +652,8 @@ verbosity is controlled via the variable `lazy-lock-stealth-verbose'."
   (remove-hook 'after-change-functions 'lazy-lock-fontify-rest-after-change t)
   (remove-hook 'after-change-functions 'lazy-lock-defer-line-after-change t)
   (remove-hook 'after-change-functions 'lazy-lock-defer-rest-after-change t)
-  (remove-hook 'outline-view-change-hook 'lazy-lock-fontify-after-outline t))
+  (remove-hook 'outline-view-change-hook 'lazy-lock-fontify-after-visage t)
+  (remove-hook 'hs-hide-hook 'lazy-lock-fontify-after-visage t))
 \f
 ;; Hook functions.
 
@@ -706,12 +674,9 @@ verbosity is controlled via the variable `lazy-lock-stealth-verbose'."
 
 (defun lazy-lock-fontify-after-scroll (window window-start)
   ;; Called from `window-scroll-functions'.
-  ;; Fontify WINDOW from WINDOW-START following the scroll.  We cannot use
-  ;; `window-end' so we work out what it would be via `vertical-motion'.
-  (save-excursion
-    (goto-char window-start)
-    (vertical-motion (window-height window) window)
-    (lazy-lock-fontify-region window-start (point)))
+  ;; Fontify WINDOW from WINDOW-START following the scroll.
+  (let ((inhibit-point-motion-hooks t))
+    (lazy-lock-fontify-region window-start (window-end window t)))
   ;; A prior deletion that did not cause scrolling, followed by a scroll, would
   ;; result in an unnecessary trigger after this if we did not cancel it now.
   (set-window-redisplay-end-trigger window nil))
@@ -769,14 +734,11 @@ verbosity is controlled via the variable `lazy-lock-stealth-verbose'."
 
 (defun lazy-lock-fontify-after-trigger (window trigger-point)
   ;; Called from `redisplay-end-trigger-functions'.
-  ;; Fontify WINDOW from TRIGGER-POINT.  We cannot use `window-end' so we work
-  ;; out what it would be via `vertical-motion'.
+  ;; Fontify WINDOW from TRIGGER-POINT following the redisplay.
   ;; We could probably just use `lazy-lock-fontify-after-scroll' without loss:
-  ;;  (lazy-lock-fontify-after-scroll window (window-start window))
-  (save-excursion
-    (goto-char (window-start window))
-    (vertical-motion (window-height window) window)
-    (lazy-lock-fontify-region trigger-point (point))))
+  ;;  (inline (lazy-lock-fontify-after-scroll window (window-start window)))
+  (let ((inhibit-point-motion-hooks t))
+    (lazy-lock-fontify-region trigger-point (window-end window t))))
 
 ;; 2.  Modified text must be marked as unfontified so it can be identified and
 ;;     fontified later when Emacs is idle.  Deferral occurs by adding one of
@@ -798,7 +760,9 @@ verbosity is controlled via the variable `lazy-lock-stealth-verbose'."
   (save-buffer-state nil
     (unless (memq (current-buffer) lazy-lock-buffers)
       (push (current-buffer) lazy-lock-buffers))
-    (remove-text-properties end (point-max) '(lazy-lock nil))))
+    (save-restriction
+      (widen)
+      (remove-text-properties end (point-max) '(lazy-lock nil)))))
 
 (defun lazy-lock-defer-line-after-change (beg end old-len)
   ;; Called from `after-change-functions'.
@@ -818,9 +782,11 @@ verbosity is controlled via the variable `lazy-lock-stealth-verbose'."
   (save-buffer-state nil
     (unless (memq (current-buffer) lazy-lock-buffers)
       (push (current-buffer) lazy-lock-buffers))
-    (remove-text-properties (max (1- beg) (point-min))
-                           (point-max)
-                           '(lazy-lock nil))))
+    (save-restriction
+      (widen)
+      (remove-text-properties (max (1- beg) (point-min))
+                             (point-max)
+                             '(lazy-lock nil)))))
 
 ;; 3.  Deferred fontification and stealth fontification are done from these two
 ;;     functions.  They are set up as Idle Timers.
@@ -828,12 +794,18 @@ verbosity is controlled via the variable `lazy-lock-stealth-verbose'."
 (defun lazy-lock-fontify-after-defer ()
   ;; Called from `timer-idle-list'.
   ;; Fontify all windows where deferral has occurred for its buffer.
-  (while (and lazy-lock-buffers (not (input-pending-p)))
-    (let ((windows (get-buffer-window-list (car lazy-lock-buffers) 'nomini t)))
-      (while windows
-       (lazy-lock-fontify-window (car windows))
-       (setq windows (cdr windows)))
-      (setq lazy-lock-buffers (cdr lazy-lock-buffers))))
+  (save-excursion
+    (while (and lazy-lock-buffers (not (input-pending-p)))
+      (let ((buffer (car lazy-lock-buffers)) windows)
+       ;; Paranoia: check that the buffer is still live and Lazy Lock mode on.
+       (when (buffer-live-p buffer)
+         (set-buffer buffer)
+         (when lazy-lock-mode
+           (setq windows (get-buffer-window-list buffer 'nomini t))
+           (while windows
+             (lazy-lock-fontify-window (car windows))
+             (setq windows (cdr windows)))))
+       (setq lazy-lock-buffers (cdr lazy-lock-buffers)))))
   ;; Add hook if fontification should now be defer-driven in this buffer.
   (when (and lazy-lock-mode lazy-lock-defer-on-scrolling
             (memq 'lazy-lock-fontify-after-scroll window-scroll-functions)
@@ -846,41 +818,46 @@ verbosity is controlled via the variable `lazy-lock-stealth-verbose'."
   ;; Fontify all buffers that need it, stealthily while idle.
   (unless (or executing-kbd-macro (window-minibuffer-p (selected-window)))
     ;; Loop over all buffers, fontify stealthily for each if necessary.
-    (let ((buffers (buffer-list)) (continue t) message message-log-max)
+    (let ((buffers (buffer-list)) (continue t)
+         message message-log-max minibuffer-auto-raise)
       (save-excursion
        (do-while (and buffers continue)
          (set-buffer (car buffers))
          (if (not (and lazy-lock-mode (lazy-lock-unfontified-p)))
              (setq continue (not (input-pending-p)))
            ;; Fontify regions in this buffer while there is no input.
-           (do-while (and (lazy-lock-unfontified-p) continue)
-             (if (and lazy-lock-stealth-load
-                      (> (car (load-average)) lazy-lock-stealth-load))
-                 ;; Wait a while before continuing with the loop.
-                 (progn
-                   (when message
-                     (message "Fontifying stealthily...suspended")
-                     (setq message nil))
-                   (setq continue (sit-for (or lazy-lock-stealth-time 30))))
-               ;; Fontify a chunk.
+           (with-temp-message
                (when lazy-lock-stealth-verbose
-                 (if message
-                     (message "Fontifying stealthily... %2d%% of %s"
-                              (lazy-lock-percent-fontified) (buffer-name))
-                   (message "Fontifying stealthily...")
-                   (setq message t)))
-               (lazy-lock-fontify-chunk)
-               (setq continue (sit-for (or lazy-lock-stealth-nice 0))))))
-         (setq buffers (cdr buffers))))
-      (when message
-       (message "Fontifying stealthily...%s" (if continue "done" "quit"))))))
+                 "Fontifying stealthily...")
+             (do-while (and (lazy-lock-unfontified-p) continue)
+               (if (and lazy-lock-stealth-load
+                        (> (car (load-average)) lazy-lock-stealth-load))
+                   ;; Wait a while before continuing with the loop.
+                   (progn
+                     (when message
+                       (message "Fontifying stealthily...suspended")
+                       (setq message nil))
+                     (setq continue (sit-for (or lazy-lock-stealth-time 30))))
+                 ;; Fontify a chunk.
+                 (when lazy-lock-stealth-verbose
+                   (if message
+                       (message "Fontifying stealthily... %2d%% of %s"
+                                (lazy-lock-percent-fontified) (buffer-name))
+                     (message "Fontifying stealthily...")
+                     (setq message t)))
+                 ;; Current buffer may have changed during `sit-for'.
+                 (set-buffer (car buffers))
+                 (lazy-lock-fontify-chunk)
+                 (setq continue (sit-for (or lazy-lock-stealth-nice 0)))))))
+         (setq buffers (cdr buffers)))))))
 
 ;; 4.  Special circumstances.
 
-(defun lazy-lock-fontify-after-outline ()
-  ;; Called from `outline-view-change-hook'.
+(defun lazy-lock-fontify-after-visage ()
+  ;; Called from `outline-view-change-hook' and `hs-hide-hook'.
   ;; Fontify windows showing the current buffer, as its visibility has changed.
-  ;; This is a conspiracy hack between lazy-lock.el and noutline.el.
+  ;; This is a conspiracy hack between lazy-lock.el, outline.el and
+  ;; hideshow.el.
   (let ((windows (get-buffer-window-list (current-buffer) 'nomini t)))
     (while windows
       (lazy-lock-fontify-conservatively (car windows))
@@ -933,32 +910,33 @@ verbosity is controlled via the variable `lazy-lock-stealth-verbose'."
 
 (defun lazy-lock-fontify-chunk ()
   ;; Fontify the nearest chunk, for stealth, in the current buffer.
-  (save-excursion
-    (save-restriction
-      (widen)
-      ;; Move to end of line in case the character at point is not fontified.
-      (end-of-line)
-      ;; Find where the previous, and next, unfontified regions end, and begin.
-      (let ((prev (previous-single-property-change (point) 'lazy-lock))
-           (next (text-property-any (point) (point-max) 'lazy-lock nil)))
-       ;; Fontify from the nearest unfontified position.
-       (if (or (null prev) (and next (< (- next (point)) (- (point) prev))))
-           ;; The next, or neither, region is the nearest not fontified.
+  (let ((inhibit-point-motion-hooks t))
+    (save-excursion
+      (save-restriction
+       (widen)
+       ;; Move to end of line in case the character at point is not fontified.
+       (end-of-line)
+       ;; Find where the previous (next) unfontified regions end (begin).
+       (let ((prev (previous-single-property-change (point) 'lazy-lock))
+             (next (text-property-any (point) (point-max) 'lazy-lock nil)))
+         ;; Fontify from the nearest unfontified position.
+         (if (or (null prev) (and next (< (- next (point)) (- (point) prev))))
+             ;; The next, or neither, region is the nearest not fontified.
+             (lazy-lock-fontify-region
+              (progn (goto-char (or next (point-min)))
+                     (beginning-of-line)
+                     (point))
+              (progn (goto-char (or next (point-min)))
+                     (forward-line lazy-lock-stealth-lines)
+                     (point)))
+           ;; The previous region is the nearest not fontified.
            (lazy-lock-fontify-region
-            (progn (goto-char (or next (point-min)))
-                   (beginning-of-line)
+            (progn (goto-char prev)
+                   (forward-line (- lazy-lock-stealth-lines))
                    (point))
-            (progn (goto-char (or next (point-min)))
-                   (forward-line lazy-lock-stealth-lines)
-                   (point)))
-         ;; The previous region is the nearest not fontified.
-         (lazy-lock-fontify-region
-          (progn (goto-char prev)
-                 (forward-line (- lazy-lock-stealth-lines))
-                 (point))
-          (progn (goto-char prev)
-                 (forward-line)
-                 (point))))))))
+            (progn (goto-char prev)
+                   (forward-line)
+                   (point)))))))))
 
 (defun lazy-lock-fontify-window (window)
   ;; Fontify in WINDOW between `window-start' and `window-end'.
@@ -971,13 +949,14 @@ verbosity is controlled via the variable `lazy-lock-stealth-verbose'."
   ;; Where we cannot use `window-start' and `window-end' we do `window-height'
   ;; lines around point.  That way we guarantee to have done enough.
   (with-current-buffer (window-buffer window)
-    (lazy-lock-fontify-region
-     (save-excursion
-       (goto-char (window-point window))
-       (vertical-motion (- (window-height window)) window) (point))
-     (save-excursion
-       (goto-char (window-point window))
-       (vertical-motion (window-height window) window) (point)))))
+    (let ((inhibit-point-motion-hooks t))
+      (lazy-lock-fontify-region
+       (save-excursion
+        (goto-char (window-point window))
+        (vertical-motion (- (window-height window)) window) (point))
+       (save-excursion
+        (goto-char (window-point window))
+        (vertical-motion (window-height window) window) (point))))))
 
 (defun lazy-lock-unfontified-p ()
   ;; Return non-nil if there is anywhere still to be fontified.
@@ -1001,39 +980,6 @@ verbosity is controlled via the variable `lazy-lock-stealth-verbose'."
 \f
 ;; Version dependent workarounds and fixes.
 
-(when (if (save-match-data (string-match "Lucid\\|XEmacs" (emacs-version)))
-         nil
-       (and (= emacs-major-version 19) (= emacs-minor-version 30)))
-  ;;
-  ;; We use `post-command-idle-hook' for deferral and stealth.  Oh Lordy.
-  (defun lazy-lock-install-timers (foo bar)
-    (add-hook 'post-command-idle-hook 'lazy-lock-fontify-post-command t)
-    (add-hook 'post-command-idle-hook 'lazy-lock-fontify-post-idle t)
-    (add-to-list 'lazy-lock-install (current-buffer))
-    (add-hook 'post-command-hook 'lazy-lock-fontify-after-install))
-  (defun lazy-lock-fontify-post-command ()
-    (and lazy-lock-buffers (not executing-kbd-macro)
-        (progn
-          (and deactivate-mark (deactivate-mark))
-          (sit-for
-           (or (cdr-safe lazy-lock-defer-time) lazy-lock-defer-time 0)))
-        (lazy-lock-fontify-after-defer)))
-  (defun lazy-lock-fontify-post-idle ()
-    (and lazy-lock-stealth-time (not executing-kbd-macro)
-        (not (window-minibuffer-p (selected-window)))
-        (progn
-          (and deactivate-mark (deactivate-mark))
-          (sit-for lazy-lock-stealth-time))
-        (lazy-lock-fontify-after-idle)))
-  ;;
-  ;; Simulate running of `window-scroll-functions' in `set-window-buffer'.
-  (defvar lazy-lock-install nil)
-  (defun lazy-lock-fontify-after-install ()
-    (remove-hook 'post-command-hook 'lazy-lock-fontify-after-install)
-    (while lazy-lock-install
-      (mapcar 'lazy-lock-fontify-conservatively
-             (get-buffer-window-list (pop lazy-lock-install) 'nomini t)))))
-
 (when (consp lazy-lock-defer-time)
   ;;
   ;; In 2.06.04 and below, `lazy-lock-defer-time' could specify modes and time.
@@ -1041,8 +987,10 @@ verbosity is controlled via the variable `lazy-lock-stealth-verbose'."
     (princ "The value of the variable `lazy-lock-defer-time' was\n ")
     (princ lazy-lock-defer-time)
     (princ "\n")
-    (princ "This variable cannot now be a list of modes and time, ")
-    (princ "so instead use the forms:\n")
+    (princ "This variable cannot now be a list of modes and time,\n")
+    (princ "so instead use ")
+    (princ (substitute-command-keys "\\[customize-option]"))
+    (princ " to modify the variables, or put the forms:\n")
     (princ " (setq lazy-lock-defer-time ")
     (princ (cdr lazy-lock-defer-time))
     (princ ")\n")
@@ -1051,7 +999,9 @@ verbosity is controlled via the variable `lazy-lock-stealth-verbose'."
     (princ ")\n")
     (princ "in your ~/.emacs.  ")
     (princ "The above forms have been evaluated for this editor session,\n")
-    (princ "but you should change your ~/.emacs now."))
+    (princ "but you should use ")
+    (princ (substitute-command-keys "\\[customize-option]"))
+    (princ " or change your ~/.emacs now."))
   (setq lazy-lock-defer-on-the-fly (car lazy-lock-defer-time)
        lazy-lock-defer-time (cdr lazy-lock-defer-time)))
 
@@ -1067,7 +1017,9 @@ verbosity is controlled via the variable `lazy-lock-stealth-verbose'."
       (princ "'"))
     (princ ".\n")
     (princ "This variable is now called `lazy-lock-defer-on-scrolling',\n")
-    (princ "so instead use the form:\n")
+    (princ "so instead use ")
+    (princ (substitute-command-keys "\\[customize-option]"))
+    (princ " to modify the variable, or put the form:\n")
     (princ " (setq lazy-lock-defer-on-scrolling ")
     (unless (memq lazy-lock-defer-driven '(nil t))
       (princ "'"))
@@ -1075,34 +1027,11 @@ verbosity is controlled via the variable `lazy-lock-stealth-verbose'."
     (princ ")\n")
     (princ "in your ~/.emacs.  ")
     (princ "The above form has been evaluated for this editor session,\n")
-    (princ "but you should change your ~/.emacs now."))
+    (princ "but you should use ")
+    (princ (substitute-command-keys "\\[customize-option]"))
+    (princ " or change your ~/.emacs now."))
   (setq lazy-lock-defer-on-scrolling lazy-lock-defer-driven))
 \f
-;; Possibly absent.
-
-(unless (boundp 'font-lock-inhibit-thing-lock)
-  ;; Font Lock mode uses this to direct Lazy and Fast Lock modes to stay off.
-  (defvar font-lock-inhibit-thing-lock nil
-    "List of Font Lock mode related modes that should not be turned on."))
-
-(unless (fboundp 'font-lock-value-in-major-mode)
-  (defun font-lock-value-in-major-mode (alist)
-    ;; Return value in ALIST for `major-mode'.
-    (if (consp alist)
-       (cdr (or (assq major-mode alist) (assq t alist)))
-      alist)))
-
-(unless (fboundp 'get-buffer-window-list)
-  ;; We use this to get all windows showing a buffer we have to fontify.
-  (defun get-buffer-window-list (buffer &optional minibuf frame)
-    "Return windows currently displaying BUFFER, or nil if none."
-    (let ((buffer (if (bufferp buffer) buffer (get-buffer buffer))) windows)
-      (walk-windows (function (lambda (window)
-                               (when (eq (window-buffer window) buffer)
-                                 (push window windows))))
-                   minibuf frame)
-      windows)))
-\f
 ;; Install ourselves:
 
 (add-hook 'window-size-change-functions 'lazy-lock-fontify-after-resize)