From 434f8c111b1fef3528bcc98a6e96c2d60705ff9a Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Thu, 19 Feb 2009 22:24:04 +0000 Subject: [PATCH] (font-lock-fontify-syntactic-keywords-region): Make sure we stop when we reach the limit. --- lisp/ChangeLog | 3 +++ lisp/font-lock.el | 7 ++++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index cd977569914..fb1ed4ab8f3 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,8 @@ 2009-02-19 Stefan Monnier + * 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. diff --git a/lisp/font-lock.el b/lisp/font-lock.el index 9c1775b25cb..ccbf09b75ea 100644 --- a/lisp/font-lock.el +++ b/lisp/font-lock.el @@ -1473,9 +1473,10 @@ START should be at the beginning of a line." ;; 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)) -- 2.39.5