emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Accepted] [O] Fix for infinite loop in org-html-protect


From: Scott Frazer
Subject: Re: [Accepted] [O] Fix for infinite loop in org-html-protect
Date: Fri, 11 Mar 2011 13:17:08 -0500
User-agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.2.15) Gecko/20110303 Thunderbird/3.1.9

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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]