From mboxrd@z Thu Jan 1 00:00:00 1970 From: Scott Frazer Subject: Re: [Accepted] [O] Fix for infinite loop in org-html-protect Date: Fri, 11 Mar 2011 13:17:08 -0500 Message-ID: <4D7A6724.8020303@gmail.com> References: <19834.23619.813886.886825@gargle.gargle.HOWL> <20110311173824.A1BBD6A2C@myhost.localdomain> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Return-path: Received: from [140.186.70.92] (port=50929 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Py6sl-0004zf-RE for emacs-orgmode@gnu.org; Fri, 11 Mar 2011 13:16:13 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Py6sk-0006SR-MD for emacs-orgmode@gnu.org; Fri, 11 Mar 2011 13:16:11 -0500 Received: from sj-iport-3.cisco.com ([171.71.176.72]:14617) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Py6sk-0006SD-CQ for emacs-orgmode@gnu.org; Fri, 11 Mar 2011 13:16:10 -0500 In-Reply-To: <20110311173824.A1BBD6A2C@myhost.localdomain> 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: Bastien Guerry Cc: emacs-orgmode@gnu.org 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. Scott