Function: org-footnote-action
org-footnote-action is an autoloaded, interactive and byte-compiled
function defined in org-footnote.el.gz.
Signature
(org-footnote-action &optional SPECIAL)
Documentation
Do the right thing for footnotes.
When at a footnote reference, jump to the definition.
When at a definition, jump to the references if they exist, offer to create them otherwise.
When neither at definition or reference, create a new footnote, interactively if possible.
With prefix arg SPECIAL, or when no footnote can be created, offer additional commands in a menu.
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/org/org-footnote.el.gz
;;;; End-user interface
;;;###autoload
(defun org-footnote-action (&optional special)
"Do the right thing for footnotes.
When at a footnote reference, jump to the definition.
When at a definition, jump to the references if they exist, offer
to create them otherwise.
When neither at definition or reference, create a new footnote,
interactively if possible.
With prefix arg SPECIAL, or when no footnote can be created,
offer additional commands in a menu."
(interactive "P")
(let* ((context (and (not special) (org-element-context)))
(type (org-element-type context)))
(cond
;; On white space after element, insert a new footnote.
((and context
(> (point)
(save-excursion
(goto-char (org-element-property :end context))
(skip-chars-backward " \t")
(point))))
(org-footnote-new))
((eq type 'footnote-reference)
(let ((label (org-element-property :label context)))
(cond
;; Anonymous footnote: move point at the beginning of its
;; definition.
((not label)
(goto-char (org-element-property :contents-begin context)))
;; Check if a definition exists: then move to it.
((let ((p (nth 1 (org-footnote-get-definition label))))
(when p (org-footnote-goto-definition label p))))
;; No definition exists: offer to create it.
((yes-or-no-p (format "No definition for %s. Create one? " label))
(let ((p (org-footnote-create-definition label)))
(or (ignore-errors (org-footnote-goto-definition label p))
;; Since definition was created outside current scope,
;; edit it remotely.
(org-edit-footnote-reference)))))))
((eq type 'footnote-definition)
(org-footnote-goto-previous-reference
(org-element-property :label context)))
((or special (not (org-footnote--allow-reference-p)))
(message "Footnotes: [s]ort | [r]enumber fn:N | [S]=r+s | [n]ormalize | \
\[d]elete")
(pcase (read-char-exclusive)
(?s (org-footnote-sort))
(?r (org-footnote-renumber-fn:N))
(?S (org-footnote-renumber-fn:N)
(org-footnote-sort))
(?n (org-footnote-normalize))
(?d (org-footnote-delete))
(char (error "No such footnote command %c" char))))
(t (org-footnote-new)))))