# HG changeset patch # User Simon Marshall # Date 878048260 0 # Node ID 0ccfc7a0662f7752c0d36cb176000528901401b3 # Parent bc7fabb22520ffe64e9a89270ed411fa642705f0 In deferral, check saved buffers to make sure they exist and have lazy-lock on. diff -r bc7fabb22520 -r 0ccfc7a0662f lisp/lazy-lock.el --- a/lisp/lazy-lock.el Tue Oct 28 14:16:40 1997 +0000 +++ b/lisp/lazy-lock.el Tue Oct 28 14:17:40 1997 +0000 @@ -2,9 +2,9 @@ ;; Copyright (C) 1994, 1995, 1996, 1997 Free Software Foundation, Inc. -;; Author: Simon Marshall +;; Author: Simon Marshall ;; Keywords: faces files -;; Version: 2.08.04 +;; Version: 2.09 ;;; This file is part of GNU Emacs. @@ -258,6 +258,7 @@ ;; - 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 ;;; Code: @@ -314,7 +315,7 @@ ; "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.04" +; (reporter-submit-bug-report "simon@gnu.ai.mit.edu" "lazy-lock 2.09" ; '(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 @@ -829,12 +830,18 @@ (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) @@ -1096,6 +1103,12 @@ (cdr (or (assq major-mode alist) (assq t alist))) alist))) +(unless (fboundp 'buffer-live-p) + ;; We use this to check that a buffer we have to fontify still exists. + (defun buffer-live-p (object) + "Return non-nil if OBJECT is an editor buffer that has not been deleted." + (and (bufferp object) (buffer-name object)))) + (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)