# HG changeset patch # User Stefan Monnier # Date 1121229554 0 # Node ID dde987aec664599a3db309620ed56893be7743b4 # Parent 566a139a0315f5ab81796327b69abf741e239692 (font-lock-fontify-keywords-region): Avoid inf-loops when the matched text is empty. diff -r 566a139a0315 -r dde987aec664 lisp/font-lock.el --- a/lisp/font-lock.el Tue Jul 12 23:29:29 2005 +0000 +++ b/lisp/font-lock.el Wed Jul 13 04:39:14 2005 +0000 @@ -1473,7 +1473,11 @@ (while (and (< (point) end) (if (stringp matcher) (re-search-forward matcher end t) - (funcall matcher end))) + (funcall matcher end)) + ;; Beware empty string matches since they will + ;; loop indefinitely. + (or (> (point) (match-beginning 0)) + (progn (forward-char 1) t))) (when (and font-lock-multiline (>= (point) (save-excursion (goto-char (match-beginning 0))