emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Nick Dokos <nicholas.dokos@hp.com>
To: Scott Frazer <frazer.scott@gmail.com>
Cc: Bastien Guerry <bzg@altern.org>,
	nicholas.dokos@hp.com, emacs-orgmode@gnu.org
Subject: Re: [Accepted] [O] Fix for infinite loop in org-html-protect
Date: Fri, 11 Mar 2011 13:55:48 -0500	[thread overview]
Message-ID: <5586.1299869748@alphaville.dokosmarshall.org> (raw)
In-Reply-To: Message from Scott Frazer <frazer.scott@gmail.com> of "Fri, 11 Mar 2011 13:17:08 EST." <4D7A6724.8020303@gmail.com>

Scott Frazer <frazer.scott@gmail.com> 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

  reply	other threads:[~2011-03-11 18:56 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-11 17:30 [PATCH] Fix for infinite loop in org-html-protect Kim Rutherford
2011-03-11 17:38 ` [Accepted] [O] " Bastien Guerry
2011-03-11 18:17   ` Scott Frazer
2011-03-11 18:55     ` Nick Dokos [this message]
2011-03-11 19:12       ` Scott Frazer
2011-03-11 17:39 ` [PATCH] " Bastien

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5586.1299869748@alphaville.dokosmarshall.org \
    --to=nicholas.dokos@hp.com \
    --cc=bzg@altern.org \
    --cc=emacs-orgmode@gnu.org \
    --cc=frazer.scott@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.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).