From: Gerd Moellmann Date: Thu, 16 Aug 2001 14:27:07 +0000 (+0000) Subject: (lazy-lock-fontify-region): Widen the current X-Git-Tag: emacs-pretest-21.0.105~166 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=e67d1843223500d1406d18ffa74b84d82a6220fc;p=emacs.git (lazy-lock-fontify-region): Widen the current buffer in a save-restriction. Under one test case with Ediff, window-scroll-functions are run with a window start that's temporarily outside of the restriction. --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 4055bfcf7bc..771c333922b 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,10 @@ +2001-08-16 Gerd Moellmann + + * lazy-lock.el (lazy-lock-fontify-region): Widen the current + buffer in a save-restriction. Under one test case with Ediff, + window-scroll-functions are run with a window start that's + temporarily outside of the restriction. + 2001-08-16 Andrew Innes * makefile.nt (DONTCOMPILE): Omit bindings.el. diff --git a/lisp/lazy-lock.el b/lisp/lazy-lock.el index ef18b8a1ae6..e0e299682e8 100644 --- a/lisp/lazy-lock.el +++ b/lisp/lazy-lock.el @@ -883,30 +883,32 @@ verbosity is controlled via the variable `lazy-lock-stealth-verbose'." ;; should use this function. For an example, see ps-print.el. (defun lazy-lock-fontify-region (beg end) ;; Fontify between BEG and END, where necessary, in the current buffer. - (when (setq beg (text-property-any beg end 'lazy-lock nil)) - (save-excursion - (save-match-data - (save-buffer-state - ;; Ensure syntactic fontification is always correct. - (font-lock-beginning-of-syntax-function next) - ;; Find successive unfontified regions between BEG and END. - (condition-case data - (do-while beg - (setq next (or (text-property-any beg end 'lazy-lock t) end)) - ;; Make sure the region end points are at beginning of line. - (goto-char beg) - (unless (bolp) - (beginning-of-line) - (setq beg (point))) - (goto-char next) - (unless (bolp) - (forward-line) - (setq next (point))) - ;; Fontify the region, then flag it as fontified. - (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)))))))) + (save-restriction + (widen) + (when (setq beg (text-property-any beg end 'lazy-lock nil)) + (save-excursion + (save-match-data + (save-buffer-state + ;; Ensure syntactic fontification is always correct. + (font-lock-beginning-of-syntax-function next) + ;; Find successive unfontified regions between BEG and END. + (condition-case data + (do-while beg + (setq next (or (text-property-any beg end 'lazy-lock t) end)) + ;; Make sure the region end points are at beginning of line. + (goto-char beg) + (unless (bolp) + (beginning-of-line) + (setq beg (point))) + (goto-char next) + (unless (bolp) + (forward-line) + (setq next (point))) + ;; Fontify the region, then flag it as fontified. + (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 () ;; Fontify the nearest chunk, for stealth, in the current buffer.