diff options
author | Nicolas Goaziou <mail@nicolasgoaziou.fr> | 2015-05-04 09:38:32 +0200 |
---|---|---|
committer | Nicolas Goaziou <mail@nicolasgoaziou.fr> | 2015-05-04 09:38:32 +0200 |
commit | 8f394624b8e160ccd6c1a5726c180ff9e8a0ff20 (patch) | |
tree | 89f59191bf65552c6c2df88c564e7deb16a4c9fd | |
parent | c8e3873a5efc68f62304e376aef031137542f0be (diff) | |
download | org-mode-8f394624b8e160ccd6c1a5726c180ff9e8a0ff20.tar.gz |
org-footnote: Fix type error when creating a new footnote
* lisp/org-footnote.el (org-footnote-get-definition): Fix type error
when creating a new footnote.
When footnote definition is new, contents are nil.
-rw-r--r-- | lisp/org-footnote.el | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/lisp/org-footnote.el b/lisp/org-footnote.el index f4c3f7e..d484de0 100644 --- a/lisp/org-footnote.el +++ b/lisp/org-footnote.el @@ -350,15 +350,18 @@ If no footnote is found, return nil." (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) - (replace-regexp-in-string - "[ \t\n]*\\'" - "" - (buffer-substring-no-properties - (org-element-property :contents-begin datum) - (org-element-property :contents-end datum)))))))) + (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)))) (defun org-footnote-goto-definition (label) |