From ce5a7f085ddaa67b3712884e6d86500ed075c399 Mon Sep 17 00:00:00 2001 From: Tassilo Horn Date: Sun, 20 Mar 2011 19:58:44 +0100 Subject: [PATCH] Fix renumbering for footnotes at BOL. --- lisp/org-footnote.el | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lisp/org-footnote.el b/lisp/org-footnote.el index 9dbd6be..3985469 100644 --- a/lisp/org-footnote.el +++ b/lisp/org-footnote.el @@ -570,13 +570,13 @@ and all references of a footnote label." (goto-char (point-min)) (while (re-search-forward "\\[fn:\\([0-9]+\\)[]:]" nil t) (setq i (string-to-number (match-string 1))) - (when (and (string-match "\\S-" (buffer-substring - (point-at-bol) (match-beginning 0))) - (not (assq i map))) + (when (not (assq i map)) (push (cons i (number-to-string (incf n))) map))) (goto-char (point-min)) (while (re-search-forward "\\(\\[fn:\\)\\([0-9]+\\)\\([]:]\\)" nil t) - (replace-match (concat "\\1" (cdr (assq (string-to-number (match-string 2)) map)) "\\3"))))))) + (setq i (cdr (assq (string-to-number (match-string 2)) map))) + (assert (progn i) t "Footnote has no number. Better undo renumbering!") + (replace-match (concat "\\1" i "\\3"))))))) (defun org-footnote-auto-adjust-maybe () "Renumber and/or sort footnotes according to user settings." -- 1.7.4.1