+(when (if (save-match-data (string-match "Lucid\\|XEmacs" (emacs-version)))
+ nil
+ (or (and (= emacs-major-version 20) (< emacs-minor-version 4))
+ (= emacs-major-version 19)))
+ ;;
+ ;; We use `vertical-motion' rather than `window-end' UPDATE arg.
+ (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'.
+ (let ((inhibit-point-motion-hooks t))
+ (save-excursion
+ (goto-char window-start)
+ (vertical-motion (window-height window) window)
+ (lazy-lock-fontify-region window-start (point))))
+ (set-window-redisplay-end-trigger window nil))
+ (defun lazy-lock-fontify-after-trigger (window trigger-point)
+ ;; Called from `redisplay-end-trigger-functions'.
+ ;; Fontify WINDOW from TRIGGER-POINT following the redisplay. We cannot
+ ;; use `window-end' so we work out what it would be via `vertical-motion'.
+ (let ((inhibit-point-motion-hooks t))
+ (save-excursion
+ (goto-char (window-start window))
+ (vertical-motion (window-height window) window)
+ (lazy-lock-fontify-region trigger-point (point))))))
+