summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Goaziou <mail@nicolasgoaziou.fr>2016-05-20 22:04:11 +0200
committerNicolas Goaziou <mail@nicolasgoaziou.fr>2016-05-20 22:04:11 +0200
commite234643d92c92e61ce98c5db1bc5394c35a72eb6 (patch)
tree13e120531f7f99936fdd9c850467791c4474fd28
parent0a98500363f711d0b7d873ad64490b549ce72725 (diff)
downloadorg-mode-e234643d92c92e61ce98c5db1bc5394c35a72eb6.tar.gz
Fix `org-open-at-point-global'
* lisp/org.el (org-open-at-point-global): Handle any external link looking like an Org link or time-stamp. Reported-by: Uwe Brauer <oub@mat.ucm.es> <http://permalink.gmane.org/gmane.emacs.orgmode/107220>
-rw-r--r--lisp/org.el22
1 files changed, 12 insertions, 10 deletions
diff --git a/lisp/org.el b/lisp/org.el
index f4c2a73..a971cb1 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -10567,11 +10567,18 @@ This is saved in case the need arises to restore it.")
;;;###autoload
(defun org-open-at-point-global ()
- "Follow a link like Org-mode does.
-This command can be called in any mode to follow a link that has
-Org-mode syntax."
+ "Follow a link or time-stamp like Org mode does.
+This command can be called in any mode to follow an external link
+or a time-stamp that has Org mode syntax. Its behavior is
+undefined when called on internal links (e.g., fuzzy links).
+Raise an error when there is nothing to follow. "
(interactive)
- (org-run-like-in-org-mode 'org-open-at-point))
+ (cond ((org-in-regexp org-any-link-re)
+ (org-open-link-from-string (match-string-no-properties 0)))
+ ((or (org-in-regexp org-ts-regexp-both nil t)
+ (org-in-regexp org-tsr-regexp-both nil t))
+ (org-follow-timestamp-link))
+ (t (user-error "No link found"))))
;;;###autoload
(defun org-open-link-from-string (s &optional arg reference-buffer)
@@ -10648,12 +10655,7 @@ link in a property drawer line."
;; Exception: open timestamps and links in properties
;; drawers, keywords and comments.
((memq type '(comment comment-block keyword node-property))
- (cond ((org-in-regexp org-any-link-re)
- (org-open-link-from-string (match-string-no-properties 0)))
- ((or (org-in-regexp org-ts-regexp-both nil t)
- (org-in-regexp org-tsr-regexp-both nil t))
- (org-follow-timestamp-link))
- (t (user-error "No link found"))))
+ (call-interactively #'org-open-at-point-global))
;; On a headline or an inlinetask, but not on a timestamp,
;; a link, a footnote reference or on tags.
((and (memq type '(headline inlinetask))