diff --git a/contrib/lisp/org-e-latex.el b/contrib/lisp/org-e-latex.el index 7697b1672..14f21e230 100644 --- a/contrib/lisp/org-e-latex.el +++ b/contrib/lisp/org-e-latex.el @@ -1371,13 +1371,9 @@ CONTENTS is nil. INFO is a plist holding contextual information." thereis (memq (org-element-type parent) '(footnote-reference footnote-definition table-cell))) "\\footnotemark") - ;; Otherwise, define it with \footnote command. If no definition - ;; is available, notify it with an intrusive fallback one. + ;; Otherwise, define it with \footnote command. (t - (let ((def (or (org-export-get-footnote-definition footnote-reference info) - '("FOOTNOTE DEFINITION NOT FOUND.")))) - (unless (eq (org-element-type def) 'org-data) - (setq def (cons 'org-data (cons nil def)))) + (let ((def (org-export-get-footnote-definition footnote-reference info))) (concat (format "\\footnote{%s}" (org-trim (org-export-data def info))) ;; Retrieve all footnote references within the footnote and diff --git a/contrib/lisp/org-export.el b/contrib/lisp/org-export.el index 35a1bd8fa..db78b9086 100644 --- a/contrib/lisp/org-export.el +++ b/contrib/lisp/org-export.el @@ -3267,10 +3267,13 @@ INFO is the plist used as a communication channel." (defun org-export-get-footnote-definition (footnote-reference info) "Return definition of FOOTNOTE-REFERENCE as parsed data. -INFO is the plist used as a communication channel." +INFO is the plist used as a communication channel. If no such +definition can be found, return the \"DEFINITION NOT FOUND\" +string." (let ((label (org-element-property :label footnote-reference))) (or (org-element-property :inline-definition footnote-reference) - (cdr (assoc label (plist-get info :footnote-definition-alist)))))) + (cdr (assoc label (plist-get info :footnote-definition-alist))) + "DEFINITION NOT FOUND."))) (defun org-export-get-footnote-number (footnote info) "Return number associated to a footnote. diff --git a/testing/lisp/test-org-export.el b/testing/lisp/test-org-export.el index 858ccda8c..1a91a8c7e 100644 --- a/testing/lisp/test-org-export.el +++ b/testing/lisp/test-org-export.el @@ -850,7 +850,13 @@ Paragraph[fn:1]" (org-export-backend-translate-table 'test))) (forward-line) (should (equal "ParagraphOut of scope\n" - (org-export-as 'test 'subtree))))))) + (org-export-as 'test 'subtree))))) + ;; 6. Footnotes without a definition should be provided a fallback + ;; definition. + (should + (org-test-with-parsed-data "[fn:1]" + (org-export-get-footnote-definition + (org-element-map tree 'footnote-reference 'identity info t) info)))))