* [daniel@brockman.se: Emacs hangs when "foo\\|\\|bar" is in `font-lock-keywords']
@ 2005-06-28 4:17 Richard M. Stallman
2005-07-11 21:44 ` Fwd: Emacs hangs when "foo\\|\\|bar" is in `font-lock-keywords' Stefan Monnier
0 siblings, 1 reply; 2+ messages in thread
From: Richard M. Stallman @ 2005-06-28 4:17 UTC (permalink / raw)
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?
------- Start of forwarded message -------
To: emacs-pretest-bug@gnu.org
From: Daniel Brockman <daniel@brockman.se>
Date: Sun, 26 Jun 2005 22:54:51 +0200
Subject: Emacs hangs when "foo\\|\\|bar" is in `font-lock-keywords'
Sender: emacs-pretest-bug-bounces+rms=gnu.org@gnu.org
X-Spam-Checker-Version: SpamAssassin 2.63 (2004-01-11) on monty-python
X-Spam-Level:
X-Spam-Status: No, hits=0.1 required=5.0 tests=RCVD_IN_SORBS autolearn=no
version=2.63
Steps to reproduce:
C-u 1 M-x font-lock-mode RET
M-: (add-to-list 'font-lock-keywords "foo\\|\\|bar") RET
M-x font-lock-fontify-buffer RET
This causes Emacs to hang in a busy loop.
In GNU Emacs 22.0.50.1 (i386-pc-linux-gnu, X toolkit, Xaw3d scroll bars)
of 2005-05-21 on wigwam, modified by Debian
Distributor `The XFree86 Project, Inc', version 11.0.40300001
configured using `configure '--build' 'i386-linux' '--host' 'i386-linux' '--prefix=/usr' '--sharedstatedir=/var/lib' '--libexecdir=/usr/lib' '--localstatedir=/var' '--infodir=/usr/share/info' '--mandir=/usr/share/man' '--with-pop=yes' '--with-gif' '--enable-locallisppath=/etc/emacs-snapshot:/etc/emacs:/usr/local/share/emacs/22.0.50/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/22.0.50/site-lisp:/usr/share/emacs/site-lisp:/usr/share/emacs/22.0.50/leim' '--with-x=yes' '--with-x-toolkit=athena' '--with-toolkit-scroll-bars' 'CFLAGS=-DDEBIAN -g -O2' 'build_alias=i386-linux' 'host_alias=i386-linux''
Important settings:
value of $LC_ALL: nil
value of $LC_COLLATE: nil
value of $LC_CTYPE: nil
value of $LC_MESSAGES: nil
value of $LC_MONETARY: nil
value of $LC_NUMERIC: nil
value of $LC_TIME: nil
value of $LANG: en_US.UTF-8
locale-coding-system: utf-8
default-enable-multibyte-characters: t
Major mode: Summary
Minor modes in effect:
display-time-mode: t
erc-track-mode: t
erc-truncate-mode: t
erc-services-mode: t
erc-ring-mode: t
erc-pcomplete-mode: t
erc-notify-mode: t
erc-netsplit-mode: t
erc-log-mode: t
erc-fill-mode: t
erc-stamp-mode: t
erc-button-mode: t
erc-autojoin-mode: t
erc-smiley-mode: t
erc-irccontrols-mode: t
erc-noncommands-mode: t
erc-readonly-mode: t
minibuffer-electric-default-mode: t
server-mode: t
show-paren-mode: t
mouse-wheel-mode: t
tooltip-mode: t
auto-compression-mode: t
global-font-lock-mode: t
font-lock-mode: t
unify-8859-on-encoding-mode: t
utf-translate-cjk-mode: t
temp-buffer-resize-mode: t
column-number-mode: t
line-number-mode: t
next-error-follow-minor-mode: Fol
Recent input:
t o SPC C-h C-h C-h C-h C-h C-h C-h C-h C-h C-h C-h
C-h w h e r e <backspace> <backspace> <backspace> <backspace>
<backspace> t o SPC d r o p SPC r a n d o m SPC e l
i s C-h C-h C-h C-h f i l e s SPC i n t C-h <return>
C-c g <f1> v <up> <return> C-x 1 <down> <down> <down>
<down> <down> <down> <down> <down> <down> <down> <down>
<down> <down> <down> <down> <down> <down> <down> <down>
<down> <down> <up> <up> <return> <return> M-x r e p
o r <tab> RET
Recent messages:
Checking new news...done
Type C-x 1 to remove help window. C-M-v to scroll the help.
Retrieving newsgroup: gmane.emacs.devel...
Loading gnus-ml...done
Opening nntp server on news.gmane.org...done
Fetching headers for gmane.emacs.devel...done
Scoring...done
Scoring...done
Generating summary...done
Loading emacsbug...done
- --
Daniel Brockman <daniel@brockman.se>
So really, we all have to ask ourselves:
Am I waiting for RMS to do this? --TTN.
_______________________________________________
Emacs-pretest-bug mailing list
Emacs-pretest-bug@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-pretest-bug
------- End of forwarded message -------
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Fwd: Emacs hangs when "foo\\|\\|bar" is in `font-lock-keywords'
2005-06-28 4:17 [daniel@brockman.se: Emacs hangs when "foo\\|\\|bar" is in `font-lock-keywords'] Richard M. Stallman
@ 2005-07-11 21:44 ` Stefan Monnier
0 siblings, 0 replies; 2+ messages in thread
From: Stefan Monnier @ 2005-07-11 21:44 UTC (permalink / raw)
Cc: emacs-devel
> 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))))
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2005-07-11 21:44 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-06-28 4:17 [daniel@brockman.se: Emacs hangs when "foo\\|\\|bar" is in `font-lock-keywords'] Richard M. Stallman
2005-07-11 21:44 ` Fwd: Emacs hangs when "foo\\|\\|bar" is in `font-lock-keywords' Stefan Monnier
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).