[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Fwd: Emacs hangs when "foo\\|\\|bar" is in `font-lock-keywords'
From: |
Stefan Monnier |
Subject: |
Re: Fwd: Emacs hangs when "foo\\|\\|bar" is in `font-lock-keywords' |
Date: |
Mon, 11 Jul 2005 17:44:01 -0400 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) |
> You could describe this as user-error, but I think it might be easy
> to make Font Lock bulletproof against null-matches in the regexps,
> at least enough to avoid infinite loops.
> Could someone please look at this and ack to me?
Would that do the trick,
Stefan
Index: lisp/font-lock.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/font-lock.el,v
retrieving revision 1.268
diff -u -r1.268 font-lock.el
--- lisp/font-lock.el 4 Jul 2005 23:08:54 -0000 1.268
+++ lisp/font-lock.el 11 Jul 2005 21:43:36 -0000
@@ -1473,8 +1473,12 @@
(while (and (< (point) end)
(if (stringp matcher)
(re-search-forward matcher end t)
- (funcall matcher end)))
- (when (and font-lock-multiline
+ (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))
(forward-line 1) (point))))
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: Fwd: Emacs hangs when "foo\\|\\|bar" is in `font-lock-keywords',
Stefan Monnier <=