changeset 102127:f90f4b810b03

(font-lock-fontify-syntactic-keywords-region): Make sure we stop when we reach the limit.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Thu, 19 Feb 2009 22:24:04 +0000
parents 69c0814ddb4e
children 671605a949ec
files lisp/ChangeLog lisp/font-lock.el
diffstat 2 files changed, 7 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Thu Feb 19 22:18:16 2009 +0000
+++ b/lisp/ChangeLog	Thu Feb 19 22:24:04 2009 +0000
@@ -1,5 +1,8 @@
 2009-02-19  Stefan Monnier  <monnier@iro.umontreal.ca>
 
+	* font-lock.el (font-lock-fontify-syntactic-keywords-region):
+	Make sure we stop when we reach the limit.
+
 	* progmodes/sh-script.el (sh-font-lock-quoted-subshell): ' inside
 	a "..." does not quote anything.
 
--- a/lisp/font-lock.el	Thu Feb 19 22:18:16 2009 +0000
+++ b/lisp/font-lock.el	Thu Feb 19 22:24:04 2009 +0000
@@ -1473,9 +1473,10 @@
       ;; Find an occurrence of `matcher' from `start' to `end'.
       (setq keyword (car keywords) matcher (car keyword))
       (goto-char start)
-      (while (if (stringp matcher)
-		 (re-search-forward matcher end t)
-	       (funcall matcher end))
+      (while (and (< (point) end)
+                  (if (stringp matcher)
+                      (re-search-forward matcher end t)
+                    (funcall matcher end)))
 	;; Apply each highlight to this instance of `matcher', which may be
 	;; specific highlights or more keywords anchored to `matcher'.
 	(setq highlights (cdr keyword))