diff options
author | Nicolas Goaziou <n.goaziou@gmail.com> | 2014-02-27 18:29:23 +0100 |
---|---|---|
committer | Nicolas Goaziou <n.goaziou@gmail.com> | 2014-02-27 18:38:49 +0100 |
commit | 5dd8058c0c779a5b099d473ef885228c7a2c2773 (patch) | |
tree | c0cc7ba812264b381f5ca236d9b8323f5a6ea33f | |
parent | 8b2d3645ac655f734d4c9812dd80520330b2edbc (diff) | |
download | org-mode-5dd8058c0c779a5b099d473ef885228c7a2c2773.tar.gz |
Change `org-open-at-point' behaviour in footnote definitions
* lisp/org.el (org-open-at-point): In a footnote definition, return to
footnote reference only when point is on the footnote label.
-rw-r--r-- | lisp/org.el | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/lisp/org.el b/lisp/org.el index 836935f..eb65d08 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -10598,13 +10598,18 @@ is used internally by `org-open-link-from-string'." (eval cmd)) (error (progn (widen) (eval cmd))))))) (t (browse-url-at-point)))))) - ;; On a footnote reference or in a footnote definition. + ;; On a footnote reference or at a footnote definition's label. ((or (eq type 'footnote-reference) - (let ((parent context)) - (while (and (setq parent (org-element-property :parent parent)) - (not (eq (org-element-type parent) - 'footnote-definition)))) - parent)) + (and (eq type 'footnote-definition) + (save-excursion + ;; Do not validate action when point is on the + ;; spaces right after the footnote label, in order + ;; to be on par with behaviour on links. + (skip-chars-forward " \t") + (let ((begin (org-element-property :contents-begin context))) + (if begin (< (point) begin) + (= (line-beginning-position) + (org-element-property :post-affiliated context))))))) (org-footnote-action)) (t (user-error "No link found")))) (move-marker org-open-link-marker nil) |