Function: org-footnote-get-definition

org-footnote-get-definition is a byte-compiled function defined in org-footnote.el.gz.

Signature

(org-footnote-get-definition LABEL)

Documentation

Return label, boundaries and definition of the footnote LABEL.

Source Code

;; Defined in /usr/src/emacs/lisp/org/org-footnote.el.gz
(defun org-footnote-get-definition (label)
  "Return label, boundaries and definition of the footnote LABEL."
  (let* ((label (regexp-quote (org-footnote-normalize-label label)))
	 (re (format "^\\[fn:%s\\]\\|.\\[fn:%s:" label label)))
    (org-with-wide-buffer
     (goto-char (point-min))
     (catch 'found
       (while (re-search-forward re nil t)
	 (let* ((datum (progn (backward-char) (org-element-context)))
		(type (org-element-type datum)))
	   (when (memq type '(footnote-definition footnote-reference))
	     (throw 'found
		    (list
		     label
		     (org-element-property :begin datum)
		     (org-element-property :end datum)
		     (let ((cbeg (org-element-property :contents-begin datum)))
		       (if (not cbeg) ""
			 (replace-regexp-in-string
			  "[ \t\n]*\\'"
			  ""
			  (buffer-substring-no-properties
			   cbeg
			   (org-element-property :contents-end datum))))))))))
       nil))))