diff options
author | Nicolas Goaziou <n.goaziou@gmail.com> | 2011-09-29 22:53:45 +0200 |
---|---|---|
committer | Nicolas Goaziou <n.goaziou@gmail.com> | 2011-09-29 22:53:45 +0200 |
commit | 0e9d401519c020af29a7e35da7acfca25e6c3be4 (patch) | |
tree | 13a4bdd9a71193d03fc81722cb5221bfdbc6c0b2 | |
parent | a77117ba80114001c7641c31db1f4b07c56af5b9 (diff) | |
download | org-mode-0e9d401519c020af29a7e35da7acfca25e6c3be4.tar.gz |
org-footnote: Fix an infloop
* lisp/org-footnote.el (org-footnote-renumber-fn:N): Fix an infloop
introduced by commit 1effad02beb79b2fb26506bd4142cb74bbe3a906.
-rw-r--r-- | lisp/org-footnote.el | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/lisp/org-footnote.el b/lisp/org-footnote.el index d54a0f8..64e7cc3 100644 --- a/lisp/org-footnote.el +++ b/lisp/org-footnote.el @@ -891,15 +891,16 @@ If LABEL is non-nil, delete that footnote instead." (org-with-wide-buffer (goto-char (point-min)) (while (re-search-forward "\\[fn:\\([0-9]+\\)[]:]" nil t) - (goto-char (match-beginning 0)) - ;; Ensure match is a footnote reference or definition. - (when (or (and (bolp) (save-match-data (org-footnote-at-definition-p))) - (save-match-data (org-footnote-at-reference-p))) - (let ((new-val (or (cdr (assoc (match-string 1) map)) - (number-to-string (incf n))))) - (unless (assoc (match-string 1) map) - (push (cons (match-string 1) new-val) map)) - (replace-match new-val nil nil nil 1))))))) + (save-excursion + (goto-char (match-beginning 0)) + ;; Ensure match is a footnote reference or definition. + (when (or (and (bolp) (save-match-data (org-footnote-at-definition-p))) + (save-match-data (org-footnote-at-reference-p))) + (let ((new-val (or (cdr (assoc (match-string 1) map)) + (number-to-string (incf n))))) + (unless (assoc (match-string 1) map) + (push (cons (match-string 1) new-val) map)) + (replace-match new-val nil nil nil 1)))))))) (defun org-footnote-auto-adjust-maybe () "Renumber and/or sort footnotes according to user settings." |