]> git.eshelyaron.com Git - emacs.git/commitdiff
(lazy-lock-fontify-region): Widen the current
authorGerd Moellmann <gerd@gnu.org>
Thu, 16 Aug 2001 14:27:07 +0000 (14:27 +0000)
committerGerd Moellmann <gerd@gnu.org>
Thu, 16 Aug 2001 14:27:07 +0000 (14:27 +0000)
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.

lisp/ChangeLog
lisp/lazy-lock.el

index 4055bfcf7bcb138c688a2cb5d89ecba6a1755caf..771c333922b0a80cbf8970877bff242502d080e0 100644 (file)
@@ -1,3 +1,10 @@
+2001-08-16  Gerd Moellmann  <gerd@gnu.org>
+
+       * 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  <andrewi@gnu.org>
 
        * makefile.nt (DONTCOMPILE): Omit bindings.el.
index ef18b8a1ae6b090d05bab3c98bd3eeb520741705..e0e299682e8ffb3e97d23e2a38044752af0f6363 100644 (file)
@@ -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.