org-src: Fix editing remotely empty footnote definitions

* lisp/org-src.el (org-src--element-contents-area):
(org-edit-footnote-reference): Take into consideration
that :contents-begin and :contents-end may be nil.

Reported-by: Rasmus <rasmus@gmx.us>
<http://permalink.gmane.org/gmane.emacs.orgmode/97262>
This commit is contained in:
Nicolas Goaziou 2015-04-28 00:22:20 +02:00
parent 7b8dacc348
commit 21b6b1d9a2

View file

@ -274,10 +274,10 @@ positions."
(let ((type (org-element-type element)))
(cond
((eq type 'footnote-definition)
(cons (org-with-wide-buffer
(goto-char (org-element-property :post-affiliated element))
(search-forward "]"))
(org-element-property :contents-end element)))
(let ((beg (org-with-wide-buffer
(goto-char (org-element-property :post-affiliated element))
(search-forward "]"))))
(cons beg (or (org-element-property :contents-end element) beg))))
((org-element-property :contents-begin element)
(cons (org-element-property :contents-begin element)
(org-element-property :contents-end element)))
@ -705,13 +705,14 @@ If BUFFER is non-nil, test it instead."
'read-only "Cannot edit footnote label"
'front-sticky t
'rear-nonsticky t)
(org-with-wide-buffer
(buffer-substring-no-properties
(progn
(goto-char (org-element-property :contents-begin definition))
(skip-chars-backward " \r\t\n")
(point))
(org-element-property :contents-end definition))))
(and (org-element-property :contents-begin definition)
(org-with-wide-buffer
(buffer-substring-no-properties
(progn
(goto-char (org-element-property :contents-begin definition))
(skip-chars-backward " \r\t\n")
(point))
(org-element-property :contents-end definition)))))
'remote))
;; Report success.
t))