diff options
author | Tassilo Horn <tassilo@member.fsf.org> | 2011-09-29 14:19:58 +0000 |
---|---|---|
committer | Nicolas Goaziou <n.goaziou@gmail.com> | 2011-09-29 15:55:30 +0200 |
commit | 2e2bd083dac993b1f7a2ae09029602fe683d367e (patch) | |
tree | 5ffb395c9b1e9a2eb0a4ee9d4b7c6cfd54db23c4 | |
parent | c00fe037be229c643dd0ab10643d178ff2f9da1b (diff) | |
download | org-mode-2e2bd083dac993b1f7a2ae09029602fe683d367e.tar.gz |
Fix renumbering for footnotes at BOL.
Hi all,
org-footnote-renumber-fn:N invalidates footnotes that appear as the
first thing on a line. Here's a test file including the recipe.
--8<---------------cut here---------------start------------->8---
* Bla
This is a line in which the following footnote that is inserted exactly
[fn:1] is the first thing in that line. And now invoke
org-footnote-renumber-fn:N and see it breaking.
* Footnotes
[fn:1] Test
--8<---------------cut here---------------end--------------->8---
Note, that in larger org files, it's likely that you don't even notice
that the footnotes break.
Once I added a patch on patchwork that fixed this issue, and that's
shown as "accepted".
http://patchwork.newartisans.com/patch/705/
I think, I've marked it as deferred or so myself because I've thought
the issue was fixed in the meantime, but that doesn't seem to be true.
Here's an updated patch.
-rw-r--r-- | lisp/org-footnote.el | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/lisp/org-footnote.el b/lisp/org-footnote.el index 46a2c43..c219051 100644 --- a/lisp/org-footnote.el +++ b/lisp/org-footnote.el @@ -895,16 +895,12 @@ If LABEL is non-nil, delete that footnote instead." (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))) + (replace-match (concat "\\1" i "\\3"))))))) (defun org-footnote-auto-adjust-maybe () "Renumber and/or sort footnotes according to user settings." |