Function: org-footnote-delete-definitions

org-footnote-delete-definitions is a byte-compiled function defined in org-footnote.el.gz.

Signature

(org-footnote-delete-definitions LABEL)

Documentation

Delete every definition of the footnote LABEL.

Return the number of footnotes removed.

Source Code

;; Defined in /usr/src/emacs/lisp/org/org-footnote.el.gz
(defun org-footnote-delete-definitions (label)
  "Delete every definition of the footnote LABEL.
Return the number of footnotes removed."
  (save-excursion
    (goto-char (point-min))
    (let ((def-re (format "^\\[fn:%s\\]" (regexp-quote label)))
	  (ndef 0))
      (while (re-search-forward def-re nil t)
	(pcase (org-footnote-at-definition-p)
	  (`(,_ ,start ,end ,_)
	   ;; Remove the footnote, and all blank lines before it.
	   (delete-region (progn
			    (goto-char start)
			    (skip-chars-backward " \r\t\n")
			    (if (bobp) (point) (line-beginning-position 2)))
			  (progn
			    (goto-char end)
			    (skip-chars-backward " \r\t\n")
			    (if (bobp) (point) (line-beginning-position 2))))
	   (cl-incf ndef))))
      ndef)))