Function: org-footnote-delete

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

Signature

(org-footnote-delete &optional LABEL)

Documentation

Delete the footnote at point.

This will remove the definition (even multiple definitions if they exist) and all references of a footnote label.

If LABEL is non-nil, delete that footnote instead.

Source Code

;; Defined in /usr/src/emacs/lisp/org/org-footnote.el.gz
(defun org-footnote-delete (&optional label)
  "Delete the footnote at point.
This will remove the definition (even multiple definitions if they exist)
and all references of a footnote label.

If LABEL is non-nil, delete that footnote instead."
  (catch 'done
    (org-preserve-local-variables
     (let* ((nref 0) (ndef 0) x
	    ;; 1. Determine LABEL of footnote at point.
	    (label (cond
		    ;; LABEL is provided as argument.
		    (label)
		    ;; Footnote reference at point.  If the footnote is
		    ;; anonymous, delete it and exit instead.
		    ((setq x (org-footnote-at-reference-p))
		     (or (car x)
			 (progn
			   (delete-region (nth 1 x) (nth 2 x))
			   (message "Anonymous footnote removed")
			   (throw 'done t))))
		    ;; Footnote definition at point.
		    ((setq x (org-footnote-at-definition-p))
		     (car x))
		    (t (error "Don't know which footnote to remove")))))
       ;; 2. Now that LABEL is non-nil, find every reference and every
       ;; definition, and delete them.
       (setq nref (org-footnote-delete-references label)
	     ndef (org-footnote-delete-definitions label))
       ;; 3. Verify consistency of footnotes and notify user.
       (org-footnote-auto-adjust-maybe)
       (message "%d definition(s) of and %d reference(s) of footnote %s removed"
		ndef nref label)))))