Thanks for the update.
Rasmus <[email protected]> writes:
> I see. I disagree that it's more since it's directly inside a loop over
> org-footnote-re. So if we are not at a footnote-{reference,definition}
> it's probably a bug in the regexp.
Pleonasm.
Note that the regexp can match even if not at a footnote reference:
#+begin_example
int x = k[1]
#+end_example
>> [fn: ref with space]
>
> While your comment excels in preciseness the terseness makes it hard to
> appreciate its depth. In my org-installation "[fn: ref with space]" is
> not a valid footnote.
Actually, I wanted to say it wasn't valid, then changed my mind, and
eventually forgot to remove it from my mail.
In a thousand years, scholars might debate over the secret meaning
behind these symbols.
>> This marker is not necessary since you're not going to add contents
>> before (point-min) anyway. A plain number is enough.
>
> I might if I include *Bar here:
>
> * Foo
> [1] foo
>
> * Bar
> Baz[1]
I'm not sure to understand. Would you mind elaborating?
> + (unless included
> + (org-with-wide-buffer
> + (goto-char (point-max))
> + (unless (bolp) (insert "\n"))
> + (maphash (lambda (ref def) (insert (format "[%s] %s\n" ref
> def)))
> + footnotes)))))))))))
The more I look at it, the more I'm seduced by
(unless included
(org-with-wide-buffer
(goto-char (point-max))
(maphash (lambda (ref def) (insert (format "\n[%s] %s\n" ref def)))
footnotes)))))))))))
I'm really nitpicking, tho.
> ;; Append ID to all footnote references and definitions, so they
> ;; become file specific and cannot collide with footnotes in other
> ;; included files.
> + ;; Further, collect relevant footnotes outside of LINES.
You can include it in the previous paragraph, or insert a blank comment
line, as it wouldn't survive a M-q.
> + (goto-char (1+ (org-element-property :begin reference)))
> + (when label
Shouldn't these two lines be inverted?
> + (let* ((definition (org-footnote-get-definition label))
> + (beginning (copy-marker (nth 1 definition))))
Actually, BEGINNING doesn't need to be a marker either: you always
modify buffer after it.
Regards,