(require 'font-lock)
(eval-when-compile
(require 'cl)
(defmacro save-buffer-state (varlist &rest body)
"Bind variables according to VARLIST and eval BODY restoring buffer state."
(` (let* ((,@ (append varlist
'((modified (buffer-modified-p)) (buffer-undo-list t)
(inhibit-read-only t) (inhibit-point-motion-hooks t)
before-change-functions after-change-functions
deactivate-mark buffer-file-name buffer-file-truename))))
(,@ body)
(when (and (not modified) (buffer-modified-p))
(set-buffer-modified-p nil)))))
(put 'save-buffer-state 'lisp-indent-function 1)
(defmacro do-while (test &rest body)
"(do-while TEST BODY...): eval BODY... and repeat if TEST yields non-nil.
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)))
(defvar lazy-lock-mode nil) (defvar lazy-lock-buffers nil) (defvar lazy-lock-timers (cons nil nil))
(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.
If a list, each element should be a cons pair of the form (MAJOR-MODE . SIZE),
where MAJOR-MODE is a symbol or t (meaning the default). For example:
((c-mode . 25600) (c++-mode . 25600) (rmail-mode . 1048576))
means that the minimum size is 25K for buffers in C or C++ modes, one megabyte
for buffers in Rmail mode, and size is irrelevant otherwise.
The value of this variable is used when Lazy Lock mode is turned on."
:type '(choice (const :tag "none" nil)
(integer :tag "size")
(repeat :menu-tag "mode specific" :tag "mode specific"
:value ((t . nil))
(cons :tag "Instance"
(radio :tag "Mode"
(const :tag "all" t)
(symbol :tag "name"))
(radio :tag "Size"
(const :tag "none" nil)
(integer :tag "size")))))
:group 'lazy-lock)
(defcustom lazy-lock-defer-on-the-fly t
"*If non-nil, means fontification after a change should be deferred.
If nil, means on-the-fly fontification is performed. This means when changes
occur in the buffer, those areas are immediately fontified.
If a list, it should be a list of `major-mode' symbol names for which deferred
fontification should occur. The sense of the list is negated if it begins with
`not'. For example:
(c-mode c++-mode)
means that on-the-fly fontification is deferred for buffers in C and C++ modes
only, and deferral does not occur otherwise.
The value of this variable is used when Lazy Lock mode is turned on."
:type '(choice (const :tag "never" nil)
(const :tag "always" t)
(set :menu-tag "mode specific" :tag "modes"
:value (not)
(const :tag "Except" not)
(repeat :inline t (symbol :tag "mode"))))
:group 'lazy-lock)
(defcustom lazy-lock-defer-on-scrolling nil
"*If non-nil, means fontification after a scroll should be deferred.
If nil, means demand-driven fontification is performed. This means when
scrolling into unfontified areas of the buffer, those areas are immediately
fontified. Thus scrolling never presents unfontified areas. However, since
fontification occurs during scrolling, scrolling may be slow.
If t, means defer-driven fontification is performed. This means fontification
of those areas is deferred. Thus scrolling may present momentarily unfontified
areas. However, since fontification does not occur during scrolling, scrolling
will be faster than demand-driven fontification.
If any other value, e.g., `eventually', means demand-driven fontification is
performed until the buffer is fontified, then buffer fontification becomes
defer-driven. Thus scrolling never presents unfontified areas until the buffer
is first fontified, after which subsequent scrolling may present future buffer
insertions momentarily unfontified. However, since fontification does not
occur during scrolling after the buffer is first fontified, scrolling will
become faster. (But, since contextual changes continually occur, such a value
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)
(other :tag "eventually" eventually))
:group 'lazy-lock)
(defcustom lazy-lock-defer-contextually 'syntax-driven
"*If non-nil, means deferred fontification should be syntactically true.
If nil, means deferred fontification occurs only on those lines modified. This
means where modification on a line causes syntactic change on subsequent lines,
those subsequent lines are not refontified to reflect their new context.
If t, means deferred fontification occurs on those lines modified and all
subsequent lines. This means those subsequent lines are refontified to reflect
their new syntactic context, either immediately or when scrolling into them.
If any other value, e.g., `syntax-driven', means deferred syntactically true
fontification occurs only if syntactic fontification is performed using the
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)
(other :tag "syntax-driven" syntax-driven))
:group 'lazy-lock)
(defcustom lazy-lock-defer-time
(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
variables `lazy-lock-defer-on-the-fly', `lazy-lock-defer-on-scrolling' and
`lazy-lock-defer-contextually'.
The value of this variable is used when Lazy Lock mode is turned on."
:type '(choice (const :tag "never" nil)
(number :tag "seconds"))
:group 'lazy-lock)
(defcustom lazy-lock-stealth-time 30
"*Time in seconds to delay before beginning stealth fontification.
Stealth fontification occurs if there is no input within this time.
If nil, means stealth fontification is never performed.
The value of this variable is used when Lazy Lock mode is turned on."
:type '(choice (const :tag "never" nil)
(number :tag "seconds"))
:group 'lazy-lock)
(defcustom lazy-lock-stealth-lines (if font-lock-maximum-decoration 100 250)
"*Maximum size of a chunk of stealth fontification.
Each iteration of stealth fontification can fontify this number of lines.
To speed up input response during stealth fontification, at the cost of stealth
taking longer to fontify, you could reduce the value of this variable."
:type '(integer :tag "lines")
:group 'lazy-lock)
(defcustom lazy-lock-stealth-load
(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,
thus reducing the demand that stealth fontification makes on the system.
If nil, means stealth fontification is never suspended.
To reduce machine load during stealth fontification, at the cost of stealth
taking longer to fontify, you could reduce the value of this variable.
See also `lazy-lock-stealth-nice'."
:type (if (condition-case nil (load-average) (error))
'(choice (const :tag "never" nil)
(integer :tag "load"))
'(const :format "%t: unsupported\n" nil))
:group 'lazy-lock)
(defcustom lazy-lock-stealth-nice
(if (featurep 'lisp-float-type) (/ (float 1) (float 8)) 1)
"*Time in seconds to pause between chunks of stealth fontification.
Each iteration of stealth fontification is separated by this amount of time,
thus reducing the demand that stealth fontification makes on the system.
If nil, means stealth fontification is never paused.
To reduce machine load during stealth fontification, at the cost of stealth
taking longer to fontify, you could increase the value of this variable.
See also `lazy-lock-stealth-load'."
:type '(choice (const :tag "never" nil)
(number :tag "seconds"))
:group 'lazy-lock)
(defcustom lazy-lock-stealth-verbose
(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)
(defun lazy-lock-mode (&optional arg)
"Toggle Lazy Lock mode.
With arg, turn Lazy Lock mode on if and only if arg is positive. Enable it
automatically in your `~/.emacs' by:
(setq font-lock-support-mode 'lazy-lock-mode)
When Lazy Lock mode is enabled, fontification can be lazy in a number of ways:
- Demand-driven buffer fontification if `lazy-lock-minimum-size' is non-nil.
This means initial fontification does not occur if the buffer is greater than
`lazy-lock-minimum-size' characters in length. Instead, fontification occurs
when necessary, such as when scrolling through the buffer would otherwise
reveal unfontified areas. This is useful if buffer fontification is too slow
for large buffers.
- Deferred scroll fontification if `lazy-lock-defer-on-scrolling' is non-nil.
This means demand-driven fontification does not occur as you scroll.
Instead, fontification is deferred until after `lazy-lock-defer-time' seconds
of Emacs idle time, while Emacs remains idle. This is useful if
fontification is too slow to keep up with scrolling.
- Deferred on-the-fly fontification if `lazy-lock-defer-on-the-fly' is non-nil.
This means on-the-fly fontification does not occur as you type. Instead,
fontification is deferred until after `lazy-lock-defer-time' seconds of Emacs
idle time, while Emacs remains idle. This is useful if fontification is too
slow to keep up with your typing.
- Deferred context fontification if `lazy-lock-defer-contextually' is non-nil.
This means fontification updates the buffer corresponding to true syntactic
context, after `lazy-lock-defer-time' seconds of Emacs idle time, while Emacs
remains idle. Otherwise, fontification occurs on modified lines only, and
subsequent lines can remain fontified corresponding to previous syntactic
contexts. This is useful where strings or comments span lines.
- Stealthy buffer fontification if `lazy-lock-stealth-time' is non-nil.
This means remaining unfontified areas of buffers are fontified if Emacs has
been idle for `lazy-lock-stealth-time' seconds, while Emacs remains idle.
This is useful if any buffer has any deferred fontification.
Basic Font Lock mode on-the-fly fontification behaviour fontifies modified
lines only. Thus, if `lazy-lock-defer-contextually' is non-nil, Lazy Lock mode
on-the-fly fontification may fontify differently, albeit correctly. In any
event, to refontify some lines you can use \\[font-lock-fontify-block].
Stealth fontification only occurs while the system remains unloaded.
If the system load rises above `lazy-lock-stealth-load' percent, stealth
fontification is suspended. Stealth fontification intensity is controlled via
the variable `lazy-lock-stealth-nice' and `lazy-lock-stealth-lines', and
verbosity is controlled via the variable `lazy-lock-stealth-verbose'."
(interactive "P")
(let* ((was-on lazy-lock-mode)
(now-on (unless (memq 'lazy-lock-mode font-lock-inhibit-thing-lock)
(if arg (> (prefix-numeric-value arg) 0) (not was-on)))))
(cond ((and now-on (not font-lock-mode))
(let ((font-lock-support-mode 'lazy-lock-mode))
(font-lock-mode t)))
(now-on
(set (make-local-variable 'lazy-lock-mode) t)
(lazy-lock-install))
(was-on
(set (make-local-variable 'lazy-lock-mode) nil)
(lazy-lock-unstall)))))
(defun turn-on-lazy-lock ()
"Unconditionally turn on Lazy Lock mode."
(lazy-lock-mode t))
(defun lazy-lock-install ()
(let ((min-size (font-lock-value-in-major-mode lazy-lock-minimum-size))
(defer-change (and lazy-lock-defer-time lazy-lock-defer-on-the-fly))
(defer-scroll (and lazy-lock-defer-time lazy-lock-defer-on-scrolling))
(defer-context (and lazy-lock-defer-time lazy-lock-defer-contextually
(or (eq lazy-lock-defer-contextually t)
(null font-lock-keywords-only)))))
(make-local-variable 'font-lock-fontified)
(setq font-lock-fontified (and min-size (>= (buffer-size) min-size)))
(if (not font-lock-fontified)
(lazy-lock-after-fontify-buffer)
(let ((windows (get-buffer-window-list (current-buffer) 'nomini t)))
(lazy-lock-after-unfontify-buffer)
(while windows
(lazy-lock-fontify-conservatively (car windows))
(setq windows (cdr windows)))))
(lazy-lock-install-hooks
font-lock-fontified
(cond ((eq (car-safe defer-change) 'not)
(not (memq major-mode (cdr defer-change))))
((listp defer-change)
(memq major-mode defer-change))
(t
defer-change))
(eq defer-scroll t)
defer-context)
(lazy-lock-install-timers
(if (or defer-change defer-scroll defer-context) lazy-lock-defer-time)
lazy-lock-stealth-time)))
(defun lazy-lock-install-hooks (fontifying
defer-change defer-scroll defer-context)
(when (or fontifying defer-change defer-scroll defer-context)
(make-local-hook 'window-scroll-functions)
(add-hook 'window-scroll-functions (if defer-scroll
'lazy-lock-defer-after-scroll
'lazy-lock-fontify-after-scroll)
nil t))
(when (and fontifying (not defer-change) (not defer-context))
(make-local-hook 'before-change-functions)
(add-hook 'before-change-functions 'lazy-lock-arrange-before-change nil t))
(remove-hook 'after-change-functions 'font-lock-after-change-function t)
(add-hook 'after-change-functions
(cond ((and defer-change defer-context)
'lazy-lock-defer-rest-after-change)
(defer-change
'lazy-lock-defer-line-after-change)
(defer-context
'lazy-lock-fontify-rest-after-change)
(t
'lazy-lock-fontify-line-after-change))
nil t)
(make-local-hook 'outline-view-change-hook)
(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)
(unless (eq dtime (car (car lazy-lock-timers)))
(let ((defer (car lazy-lock-timers)))
(when (cdr defer)
(cancel-timer (cdr defer)))
(setcar lazy-lock-timers (cons dtime (and dtime
(run-with-idle-timer dtime t 'lazy-lock-fontify-after-defer))))))
(unless (eq stime (car (cdr lazy-lock-timers)))
(let ((stealth (cdr lazy-lock-timers)))
(when (cdr stealth)
(cancel-timer (cdr stealth)))
(setcdr lazy-lock-timers (cons stime (and stime
(run-with-idle-timer stime t 'lazy-lock-fontify-after-idle)))))))
(defun lazy-lock-unstall ()
(when font-lock-mode
(when (lazy-lock-unfontified-p)
(let ((verbose (if (numberp font-lock-verbose)
(> (buffer-size) font-lock-verbose)
font-lock-verbose)))
(with-temp-message
(when verbose
(format "Fontifying %s..." (buffer-name)))
(save-restriction
(widen)
(lazy-lock-fontify-region (point-min) (point-max))))))
(add-hook 'after-change-functions 'font-lock-after-change-function nil t))
(lazy-lock-after-unfontify-buffer)
(remove-hook 'window-scroll-functions 'lazy-lock-fontify-after-scroll t)
(remove-hook 'window-scroll-functions 'lazy-lock-defer-after-scroll t)
(remove-hook 'before-change-functions 'lazy-lock-arrange-before-change t)
(remove-hook 'after-change-functions 'lazy-lock-fontify-line-after-change t)
(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-visage t)
(remove-hook 'hs-hide-hook 'lazy-lock-fontify-after-visage t))
(defun lazy-lock-fontify-after-scroll (window window-start)
(let ((inhibit-point-motion-hooks t))
(lazy-lock-fontify-region window-start (window-end window t)))
(set-window-redisplay-end-trigger window nil))
(defun lazy-lock-defer-after-scroll (window window-start)
(unless (memq (current-buffer) lazy-lock-buffers)
(push (current-buffer) lazy-lock-buffers))
(set-window-redisplay-end-trigger window nil))
(defun lazy-lock-fontify-after-resize (frame)
(save-excursion
(save-selected-window
(select-frame frame)
(walk-windows (function (lambda (window)
(set-buffer (window-buffer window))
(when lazy-lock-mode
(lazy-lock-fontify-conservatively window))
(set-window-redisplay-end-trigger window nil)))
'nomini frame))))
(defun lazy-lock-arrange-before-change (beg end)
(unless (eq beg end)
(let ((windows (get-buffer-window-list (current-buffer) 'nomini t)) window)
(while windows
(setq window (car windows))
(unless (markerp (window-redisplay-end-trigger window))
(set-window-redisplay-end-trigger window (make-marker)))
(set-marker (window-redisplay-end-trigger window) (window-end window))
(setq windows (cdr windows))))))
(defun lazy-lock-fontify-after-trigger (window trigger-point)
(let ((inhibit-point-motion-hooks t))
(lazy-lock-fontify-region trigger-point (window-end window t))))
(defalias 'lazy-lock-fontify-line-after-change
'font-lock-after-change-function)
(defun lazy-lock-fontify-rest-after-change (beg end old-len)
(lazy-lock-fontify-line-after-change beg end old-len)
(save-buffer-state nil
(unless (memq (current-buffer) lazy-lock-buffers)
(push (current-buffer) lazy-lock-buffers))
(save-restriction
(widen)
(remove-text-properties end (point-max) '(lazy-lock nil)))))
(defun lazy-lock-defer-line-after-change (beg end old-len)
(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))
(min (1+ end) (point-max))
'(lazy-lock nil))))
(defun lazy-lock-defer-rest-after-change (beg end old-len)
(save-buffer-state nil
(unless (memq (current-buffer) lazy-lock-buffers)
(push (current-buffer) lazy-lock-buffers))
(save-restriction
(widen)
(remove-text-properties (max (1- beg) (point-min))
(point-max)
'(lazy-lock nil)))))
(defun lazy-lock-fontify-after-defer ()
(save-excursion
(while (and lazy-lock-buffers (not (input-pending-p)))
(let ((buffer (car lazy-lock-buffers)) windows)
(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)))))
(when (and lazy-lock-mode lazy-lock-defer-on-scrolling
(memq 'lazy-lock-fontify-after-scroll window-scroll-functions)
(not (or (input-pending-p) (lazy-lock-unfontified-p))))
(remove-hook 'window-scroll-functions 'lazy-lock-fontify-after-scroll t)
(add-hook 'window-scroll-functions 'lazy-lock-defer-after-scroll nil t)))
(defun lazy-lock-fontify-after-idle ()
(unless (or executing-kbd-macro (window-minibuffer-p (selected-window)))
(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)))
(with-temp-message
(when lazy-lock-stealth-verbose
"Fontifying stealthily...")
(do-while (and (lazy-lock-unfontified-p) continue)
(if (and lazy-lock-stealth-load
(> (car (load-average)) lazy-lock-stealth-load))
(progn
(when message
(message "Fontifying stealthily...suspended")
(setq message nil))
(setq continue (sit-for (or lazy-lock-stealth-time 30))))
(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)))
(set-buffer (car buffers))
(lazy-lock-fontify-chunk)
(setq continue (sit-for (or lazy-lock-stealth-nice 0)))))))
(setq buffers (cdr buffers)))))))
(defun lazy-lock-fontify-after-visage ()
(let ((windows (get-buffer-window-list (current-buffer) 'nomini t)))
(while windows
(lazy-lock-fontify-conservatively (car windows))
(setq windows (cdr windows)))))
(defun lazy-lock-after-fontify-buffer ()
(save-buffer-state nil
(add-text-properties (point-min) (point-max) '(lazy-lock t))))
(defun lazy-lock-after-unfontify-buffer ()
(save-buffer-state nil
(remove-text-properties (point-min) (point-max) '(lazy-lock nil))))
(defun lazy-lock-fontify-region (beg end)
(save-restriction
(widen)
(when (setq beg (text-property-any beg end 'lazy-lock nil))
(save-excursion
(save-match-data
(save-buffer-state
(font-lock-beginning-of-syntax-function next)
(condition-case data
(do-while beg
(setq next (or (text-property-any beg end 'lazy-lock t) end))
(goto-char beg)
(unless (bolp)
(beginning-of-line)
(setq beg (point)))
(goto-char next)
(unless (bolp)
(forward-line)
(setq next (point)))
(font-lock-fontify-region beg next)
(add-text-properties beg next '(lazy-lock t))
(setq beg (text-property-any next end 'lazy-lock nil)))
((error quit) (message "Fontifying region...%s" data)))))))))
(defun lazy-lock-fontify-chunk ()
(let ((inhibit-point-motion-hooks t))
(save-excursion
(save-restriction
(widen)
(end-of-line)
(let ((prev (previous-single-property-change (point) 'lazy-lock))
(next (text-property-any (point) (point-max) 'lazy-lock nil)))
(if (or (null prev) (and next (< (- next (point)) (- (point) prev))))
(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)))
(lazy-lock-fontify-region
(progn (goto-char prev)
(forward-line (- lazy-lock-stealth-lines))
(point))
(progn (goto-char prev)
(forward-line)
(point)))))))))
(defun lazy-lock-fontify-window (window)
(with-current-buffer (window-buffer window)
(lazy-lock-fontify-region (window-start window) (window-end window))))
(defun lazy-lock-fontify-conservatively (window)
(with-current-buffer (window-buffer window)
(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 ()
(save-restriction
(widen)
(text-property-any (point-min) (point-max) 'lazy-lock nil)))
(defun lazy-lock-percent-fontified ()
(save-restriction
(widen)
(let ((beg (point-min)) (size 0) next)
(while (setq beg (text-property-any beg (point-max) 'lazy-lock t))
(setq next (or (text-property-any beg (point-max) 'lazy-lock nil)
(point-max)))
(incf size (- next beg))
(setq beg next))
(truncate (* (/ (float size) (point-max)) 100)))))
(when (consp lazy-lock-defer-time)
(with-output-to-temp-buffer "*Help*"
(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,\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")
(princ " (setq lazy-lock-defer-on-the-fly '")
(princ (car lazy-lock-defer-time))
(princ ")\n")
(princ "in your ~/.emacs. ")
(princ "The above forms have been evaluated for this editor session,\n")
(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)))
(when (boundp 'lazy-lock-defer-driven)
(with-output-to-temp-buffer "*Help*"
(princ "The value of the variable `lazy-lock-defer-driven' is set to ")
(if (memq lazy-lock-defer-driven '(nil t))
(princ lazy-lock-defer-driven)
(princ "`")
(princ lazy-lock-defer-driven)
(princ "'"))
(princ ".\n")
(princ "This variable is now called `lazy-lock-defer-on-scrolling',\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 "'"))
(princ lazy-lock-defer-driven)
(princ ")\n")
(princ "in your ~/.emacs. ")
(princ "The above form has been evaluated for this editor session,\n")
(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))
(add-hook 'window-size-change-functions 'lazy-lock-fontify-after-resize)
(add-hook 'redisplay-end-trigger-functions 'lazy-lock-fontify-after-trigger)
(unless (assq 'lazy-lock-mode minor-mode-alist)
(setq minor-mode-alist (append minor-mode-alist '((lazy-lock-mode nil)))))
(provide 'lazy-lock)