summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Goaziou <mail@nicolasgoaziou.fr>2017-08-10 12:41:35 +0200
committerNicolas Goaziou <mail@nicolasgoaziou.fr>2017-08-10 12:41:35 +0200
commit313d22dec6cf661f9d2dde272d66e747502206e6 (patch)
tree566deadb2c72d41bce4ab8a223dd8caeba7a53a8
parent1876514e2680723ea694d6d52cb8ca01871fae10 (diff)
downloadorg-mode-313d22dec6cf661f9d2dde272d66e747502206e6.tar.gz
org.el: Fix org-open-at-point for tags.
lisp/org.el (org-open-at-point): Move case for tags up so that it's not shortcutted by the case for no valid context. TINYCHANGE
-rw-r--r--lisp/org.el43
1 files changed, 18 insertions, 25 deletions
diff --git a/lisp/org.el b/lisp/org.el
index 789978e..28fe14a 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -10777,23 +10777,24 @@ a timestamp or a link."
(value (org-element-property :value context)))
(cond
;; On a headline or an inlinetask, but not on a timestamp,
- ;; a link, a footnote reference or on tags.
- ((and (memq type '(headline inlinetask))
- ;; Not on tags.
- (let ((case-fold-search nil))
- (and (org-match-line org-complex-heading-regexp)
- (or (not (match-beginning 5))
- (< (point) (match-beginning 5))))))
- (let* ((data (org-offer-links-in-entry (current-buffer) (point) arg))
- (links (car data))
- (links-end (cdr data)))
- (if links
- (dolist (link (if (stringp links) (list links) links))
- (search-forward link nil links-end)
- (goto-char (match-beginning 0))
- (org-open-at-point))
- (require 'org-attach)
- (org-attach-reveal 'if-exists))))
+ ;; a link, a footnote reference.
+ ((memq type '(headline inlinetask))
+ (org-match-line org-complex-heading-regexp)
+ (if (and (match-beginning 5)
+ (>= (point) (match-beginning 5))
+ (< (point) (match-end 5)))
+ ;; On tags.
+ (org-tags-view arg (substring (match-string 5) 0 -1))
+ ;; Not on tags.
+ (pcase (org-offer-links-in-entry (current-buffer) (point) arg)
+ (`(nil . ,_)
+ (require 'org-attach)
+ (org-attach-reveal 'if-exists))
+ (`(,links . ,links-end)
+ (dolist (link (if (stringp links) (list links) links))
+ (search-forward link nil links-end)
+ (goto-char (match-beginning 0))
+ (org-open-at-point))))))
;; On a footnote reference or at definition's label.
((or (eq type 'footnote-reference)
(and (eq type 'footnote-definition)
@@ -10829,14 +10830,6 @@ a timestamp or a link."
(point)))
(user-error "No link found"))
((eq type 'timestamp) (org-follow-timestamp-link))
- ;; On tags within a headline or an inlinetask.
- ((and (memq type '(headline inlinetask))
- (let ((case-fold-search nil))
- (save-excursion (beginning-of-line)
- (looking-at org-complex-heading-regexp))
- (and (match-beginning 5)
- (>= (point) (match-beginning 5)))))
- (org-tags-view arg (substring (match-string 5) 0 -1)))
((eq type 'link)
;; When link is located within the description of another
;; link (e.g., an inline image), always open the parent