Tassilo Horn writes: > Remember to cover the basics, that is, what you expected to happen and > what in fact did happen. You don't know how to make a good report? See > > http://orgmode.org/manual/Feedback.html#Feedback > > Your bug report will be posted to the Org-mode mailing list. > ------------------------------------------------------------------------ > > If a footnote is the first thing in a line, then > org-footnote-renumber-fn:N will break. It does not error, but the > footnote turns into [fn:]. Here's a recipe. Let's say, you have this minimal org file: --8<---------------cut here---------------start------------->8--- this is a test file with a footnote [fn:1] * Footnotes [fn:1] test. --8<---------------cut here---------------end--------------->8--- As you can see, the footnote is the first thing in a line. Now calling org-footnote-renumber-fn:N produces: --8<---------------cut here---------------start------------->8--- this is a test file with a footnote [fn:] * Footnotes [fn:] test. --8<---------------cut here---------------end--------------->8--- This is a major bug, because in larger org documents chances are high that you don't notice the breakage at first. The problem is that: --8<---------------cut here---------------start------------->8--- (defun org-footnote-renumber-fn:N () "Renumber the simple footnotes like fn:17 into a sequence in the document." (interactive) (let (map i (n 0)) (save-excursion (save-restriction (widen) (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))) (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"))))))) --8<---------------cut here---------------end--------------->8--- I don't understand `string-match' test underlined above. In my case, the buffer-substring that is tested is the empty string "". That makes the test fail. Basically, the test ensures that the footnote is not the first thing in the line, but why? The assq check already ensures that the footnote definition lists produce no duplicates. Attached is a patch that simply deletes the check. It works fine for me. I also added an assertion that checks that you never replace a footnote with [fn:]. If the number after renumbering is nil, then an error is produced. > Emacs : GNU Emacs 24.0.50.1 (x86_64-pc-linux-gnu, GTK+ Version 2.22.1) > of 2011-03-12 on thinkpad > Package: Org-mode version 7.5 (release_7.5.77.g74268) Bye, Tassilo