Function: org-footnote--collect-definitions
org-footnote--collect-definitions is a byte-compiled function defined
in org-footnote.el.gz.
Signature
(org-footnote--collect-definitions &optional DELETE)
Documentation
Collect all footnote definitions in current buffer.
Return an alist where associations follow the pattern
(LABEL . DEFINITION)
with LABEL and DEFINITION being, respectively, the label and the definition of the footnote, as strings.
When optional argument DELETE is non-nil, delete the definition while collecting them.
Source Code
;; Defined in /usr/src/emacs/lisp/org/org-footnote.el.gz
(defun org-footnote--collect-definitions (&optional delete)
"Collect all footnote definitions in current buffer.
Return an alist where associations follow the pattern
(LABEL . DEFINITION)
with LABEL and DEFINITION being, respectively, the label and the
definition of the footnote, as strings.
When optional argument DELETE is non-nil, delete the definition
while collecting them."
(org-with-wide-buffer
(goto-char (point-min))
(let (definitions seen)
(while (re-search-forward org-footnote-definition-re nil t)
(backward-char)
(let ((element (org-element-at-point)))
(let ((label (org-element-property :label element)))
(when (and (eq (org-element-type element) 'footnote-definition)
(not (member label seen)))
(push label seen)
(let* ((beg (progn
(goto-char (org-element-property :begin element))
(skip-chars-backward " \r\t\n")
(if (bobp) (point) (line-beginning-position 2))))
(end (progn
(goto-char (org-element-property :end element))
(skip-chars-backward " \r\t\n")
(line-beginning-position 2)))
(def (org-trim (buffer-substring-no-properties beg end))))
(push (cons label def) definitions)
(when delete (delete-region beg end)))))))
definitions)))