Accidentally sent this message off-list. Trying again:
On Fri, Apr 17 2020, Sharon Kimble wrote:
org-footnote can't tell that footnote 1 ([fn:1]) at the
beginning is in
the right place when confronted with footnote 1 ([fn:1])
half-way
through!
No, obviously, so you'll have to renumber the footnotes in the
second file
before you merge the two files.
Which is why I'm looking for some other solution, and I believe
that it might be able to be achieved programmatically.
Unfortunately my
lisp skills are almost nil, hence my request for someone to
help.
I use the following function for renumbering stuff such as
footnotes:
#+begin_src emacs-lisp
(defun jk-renumber-counters (start regexp)
"Renumber counters.
Renumbering starts at START. REGEXP describes the counters to be
renumbered. The actual number must be enclosed in a group."
(save-excursion
(goto-char (point-min))
;; because we incf the counter before using it, we need to
adjust:
(let ((counter (1- start))
(counters (make-hash-table :test 'equal))
fn)
(while (re-search-forward regexp nil t)
(setq fn (match-string 1))
(replace-match (or (gethash fn counters)
(puthash fn (format "%s" (cl-incf
counter)) counters))
nil nil nil 1)))))
#+end_src
In your case, you should be able to call this function with:
M-: (jk-renumber-footnotes 355 "\\[fn:\\([0-9]+\\)\\]") RET
Change «355» to the number you want to start the footnotes in the
second file
with.
If you already merged the two files and don't want to separate
them again, you
could take out the line `(goto-char (point-min))`, put point at
the position
where you want to start renumbering footnotes and then call the
function. But
I'd play it safe and renumber the footnotes before merging the
files.
HTH
--
Joost Kremers
Life has its moments