((and org-footnote-section (eq major-mode 'org-mode))
(goto-char (point-min))
(if (re-search-forward
- (concat "^\\*[ \t]+" (regexp-quote org-footnote-section)
- "[ \t]*$") nil t)
+ (concat "^\\*[ \t]+" (regexp-quote org-footnote-section)
+ "[ \t]*$") nil t)
(delete-region (match-beginning 0) (org-end-of-subtree t t)))
;; A new footnote section is inserted by default at the end of
;; the buffer.
(unless (bolp) (newline)))
;; No footnote section set: Footnotes will be added at the end
;; of the section containing their first reference.
- ((eq major-mode 'org-mode))
+ ;; Nevertheless, in an export situation, set insertion point to
+ ;; `point-max' by default.
+ ((eq major-mode 'org-mode)
+ (when export-props
+ (goto-char (point-max))
+ (skip-chars-backward " \r\t\n")
+ (forward-line)
+ (delete-region (point) (point-max))))
(t
;; Remove any left-over tag in the buffer, if one is set up.
(when org-footnote-tag-for-non-org-mode-files