aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGerd Moellmann2001-08-16 14:27:07 +0000
committerGerd Moellmann2001-08-16 14:27:07 +0000
commite67d1843223500d1406d18ffa74b84d82a6220fc (patch)
tree98dff80fbe9204d48db28bd4f6595cbac52617ba
parent0645d241489db5d0eee2866566dfba696dc14d01 (diff)
downloademacs-e67d1843223500d1406d18ffa74b84d82a6220fc.tar.gz
emacs-e67d1843223500d1406d18ffa74b84d82a6220fc.zip
(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.
-rw-r--r--lisp/ChangeLog7
-rw-r--r--lisp/lazy-lock.el50
2 files changed, 33 insertions, 24 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 4055bfcf7bc..771c333922b 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,10 @@
12001-08-16 Gerd Moellmann <gerd@gnu.org>
2
3 * lazy-lock.el (lazy-lock-fontify-region): Widen the current
4 buffer in a save-restriction. Under one test case with Ediff,
5 window-scroll-functions are run with a window start that's
6 temporarily outside of the restriction.
7
12001-08-16 Andrew Innes <andrewi@gnu.org> 82001-08-16 Andrew Innes <andrewi@gnu.org>
2 9
3 * makefile.nt (DONTCOMPILE): Omit bindings.el. 10 * 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'."
883;; should use this function. For an example, see ps-print.el. 883;; should use this function. For an example, see ps-print.el.
884(defun lazy-lock-fontify-region (beg end) 884(defun lazy-lock-fontify-region (beg end)
885 ;; Fontify between BEG and END, where necessary, in the current buffer. 885 ;; Fontify between BEG and END, where necessary, in the current buffer.
886 (when (setq beg (text-property-any beg end 'lazy-lock nil)) 886 (save-restriction
887 (save-excursion 887 (widen)
888 (save-match-data 888 (when (setq beg (text-property-any beg end 'lazy-lock nil))
889 (save-buffer-state 889 (save-excursion
890 ;; Ensure syntactic fontification is always correct. 890 (save-match-data
891 (font-lock-beginning-of-syntax-function next) 891 (save-buffer-state
892 ;; Find successive unfontified regions between BEG and END. 892 ;; Ensure syntactic fontification is always correct.
893 (condition-case data 893 (font-lock-beginning-of-syntax-function next)
894 (do-while beg 894 ;; Find successive unfontified regions between BEG and END.
895 (setq next (or (text-property-any beg end 'lazy-lock t) end)) 895 (condition-case data
896 ;; Make sure the region end points are at beginning of line. 896 (do-while beg
897 (goto-char beg) 897 (setq next (or (text-property-any beg end 'lazy-lock t) end))
898 (unless (bolp) 898 ;; Make sure the region end points are at beginning of line.
899 (beginning-of-line) 899 (goto-char beg)
900 (setq beg (point))) 900 (unless (bolp)
901 (goto-char next) 901 (beginning-of-line)
902 (unless (bolp) 902 (setq beg (point)))
903 (forward-line) 903 (goto-char next)
904 (setq next (point))) 904 (unless (bolp)
905 ;; Fontify the region, then flag it as fontified. 905 (forward-line)
906 (font-lock-fontify-region beg next) 906 (setq next (point)))
907 (add-text-properties beg next '(lazy-lock t)) 907 ;; Fontify the region, then flag it as fontified.
908 (setq beg (text-property-any next end 'lazy-lock nil))) 908 (font-lock-fontify-region beg next)
909 ((error quit) (message "Fontifying region...%s" data)))))))) 909 (add-text-properties beg next '(lazy-lock t))
910 (setq beg (text-property-any next end 'lazy-lock nil)))
911 ((error quit) (message "Fontifying region...%s" data)))))))))
910 912
911(defun lazy-lock-fontify-chunk () 913(defun lazy-lock-fontify-chunk ()
912 ;; Fontify the nearest chunk, for stealth, in the current buffer. 914 ;; Fontify the nearest chunk, for stealth, in the current buffer.