Function: org-footnote--clear-footnote-section
org-footnote--clear-footnote-section is a byte-compiled function
defined in org-footnote.el.gz.
Signature
(org-footnote--clear-footnote-section)
Documentation
Remove all footnote sections in buffer and create a new one.
New section is created at the end of the buffer. Leave point within the new section.
Source Code
;; Defined in /usr/src/emacs/lisp/org/org-footnote.el.gz
(defun org-footnote--clear-footnote-section ()
"Remove all footnote sections in buffer and create a new one.
New section is created at the end of the buffer. Leave point
within the new section."
(when org-footnote-section
(goto-char (point-min))
(let ((regexp (format "^\\*+ +%s[ \t]*$"
(regexp-quote org-footnote-section))))
(while (re-search-forward regexp nil t)
(delete-region
(match-beginning 0)
(org-end-of-subtree t t))))
(goto-char (point-max))
;; Clean-up blank lines at the end of the buffer.
(skip-chars-backward " \r\t\n")
(unless (bobp)
(forward-line)
(when (eolp) (insert "\n")))
(delete-region (point) (point-max))
(when (and (cdr (assq 'heading org-blank-before-new-entry))
(zerop (save-excursion (org-back-over-empty-lines))))
(insert "\n"))
(insert "* " org-footnote-section "\n")))