From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nick Dokos Subject: Re: [Accepted] [O] Fix for infinite loop in org-html-protect Date: Fri, 11 Mar 2011 13:55:48 -0500 Message-ID: <5586.1299869748@alphaville.dokosmarshall.org> References: <19834.23619.813886.886825@gargle.gargle.HOWL> <20110311173824.A1BBD6A2C@myhost.localdomain> <4D7A6724.8020303@gmail.com> Reply-To: nicholas.dokos@hp.com Return-path: Received: from [140.186.70.92] (port=42329 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Py7Vc-0004XU-K4 for emacs-orgmode@gnu.org; Fri, 11 Mar 2011 13:56:21 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Py7Vb-0006sC-66 for emacs-orgmode@gnu.org; Fri, 11 Mar 2011 13:56:20 -0500 Received: from vms173013pub.verizon.net ([206.46.173.13]:40983) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Py7Vb-0006rs-1a for emacs-orgmode@gnu.org; Fri, 11 Mar 2011 13:56:19 -0500 Received: from alphaville.dokosmarshall.org ([unknown] [173.76.32.106]) by vms173013.mailsrvcs.net (Sun Java(tm) System Messaging Server 7u2-7.02 32bit (built Apr 16 2009)) with ESMTPA id <0LHW009IEPX0LE90@vms173013.mailsrvcs.net> for emacs-orgmode@gnu.org; Fri, 11 Mar 2011 12:56:02 -0600 (CST) In-reply-to: Message from Scott Frazer of "Fri, 11 Mar 2011 13:17:08 EST." <4D7A6724.8020303@gmail.com> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Scott Frazer Cc: Bastien Guerry , nicholas.dokos@hp.com, emacs-orgmode@gnu.org Scott Frazer wrote: > On 3/11/11 12:38 PM, Bastien Guerry wrote: > > >> > >> --- > >> lisp/org-html.el | 2 +- > >> 1 files changed, 1 insertions(+), 1 deletions(-) > >> > >> diff --git a/lisp/org-html.el b/lisp/org-html.el > >> index c60c90d..2312b21 100644 > >> --- a/lisp/org-html.el > >> +++ b/lisp/org-html.el > >> @@ -2186,7 +2186,7 @@ Possible conversions are set in `org-export-html-protect-char-alist'." > >> (let ((start 0)) > >> (while (string-match (car c) s start) > >> (setq s (replace-match (cdr c) t t s) > >> - start (match-beginning 0))))) > >> + start (1+ (match-beginning 0)))))) > >> s)) > >> > >> (defun org-html-expand (string) > >> > > I think there might be a second bug in that function that I had to fix myself. > I don't know the proper way to create/submit a patch, but instead of this: > > (while (setq c (pop cl)) > (while (string-match (car c) s start) > > I think you need this: > > (while (setq c (pop cl)) > (setq start 0) > (while (string-match (car c) s start) > > i.e. you need to start over at the beginning of the line each time you go > through the list of protected chars, or else you'll start from the last > replacement location. > There is a (let ((start 0))... around the (while (string-match...)..) and inside the outer loop, so every time the inner loop is finished, start is recreated and initialized to 0 for the next iteration of the outer loop. At least, that's the case in latest git. Nick