org-src: Refuse to edit remotely inline footnotes

* lisp/org-src.el (org-edit-footnote-reference): Throw an error when
  definition is inline.
This commit is contained in:
Nicolas Goaziou 2015-04-26 14:57:36 +02:00
parent ca2b398396
commit 9d4b3e356f
1 changed files with 33 additions and 34 deletions

View File

@ -681,22 +681,21 @@ If BUFFER is non-nil, test it instead."
"Edit definition of footnote reference at point." "Edit definition of footnote reference at point."
(interactive) (interactive)
(let ((context (org-element-context))) (let ((context (org-element-context)))
(cond ((not (and (eq (org-element-type context) 'footnote-reference) (unless (and (eq (org-element-type context) 'footnote-reference)
(< (point) (< (point)
(org-with-wide-buffer (org-with-wide-buffer
(goto-char (org-element-property :end context)) (goto-char (org-element-property :end context))
(skip-chars-backward " \t") (skip-chars-backward " \t")
(point))))) (point))))
(user-error "Not on a footnote reference")) (user-error "Not on a footnote reference"))
((eq (org-element-property :type context) 'inline)
(user-error "Cannot edit inline footnotes"))
(t
(let* ((label (org-element-property :label context)) (let* ((label (org-element-property :label context))
(definition (definition
(org-with-wide-buffer (org-with-wide-buffer
(org-footnote-goto-definition label) (org-footnote-goto-definition label)
(beginning-of-line) (beginning-of-line)
(org-element-at-point)))) (org-element-at-point))))
(unless (eq (org-element-type definition) 'footnote-definition)
(user-error "Cannot edit remotely inline footnotes"))
(org-src--edit-element (org-src--edit-element
definition (format "*Edit footnote [%s]*" label) definition (format "*Edit footnote [%s]*" label)
#'org-mode #'org-mode
@ -715,7 +714,7 @@ If BUFFER is non-nil, test it instead."
(org-element-property :contents-end definition)))) (org-element-property :contents-end definition))))
'remote)) 'remote))
;; Report success. ;; Report success.
t)))) t))
(defun org-edit-table.el () (defun org-edit-table.el ()
"Edit \"table.el\" table at point. "Edit \"table.el\" table at point.