summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Guerry <bzg@altern.org>2012-12-20 09:39:35 +0100
committerBastien Guerry <bzg@altern.org>2012-12-20 09:39:35 +0100
commit14ffe22b8fa0190e9b0b5ab0a22dd8ac76f9f003 (patch)
tree85429e8cb32926fafc3a40a16e3fab48e035b72f
parent963ede0a9d9f439f9ef4e5f0a4c5b01ddf07ca42 (diff)
downloadorg-mode-14ffe22b8fa0190e9b0b5ab0a22dd8ac76f9f003.tar.gz
org.el (org-open-at-point): Handle non-links correctly.
* org.el (org-open-at-point): Throw the correct error on non-links. Use `user-error' instead of `error'. This fixes a bug introduced in ad35e2. Thanks to Samuel Loury for spotting this and for submitting a patch.
-rw-r--r--lisp/org.el15
1 files changed, 8 insertions, 7 deletions
diff --git a/lisp/org.el b/lisp/org.el
index 82a099f..50b8113 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -9697,12 +9697,13 @@ application the system uses for this file type."
(throw 'match t))
(save-excursion
- (when (or (org-in-regexp org-angle-link-re)
- (and (goto-char (car (org-in-regexp org-plain-link-re)))
- (save-match-data (not (looking-back "\\[\\[")))))
- (setq type (match-string 1)
- path (org-link-unescape (match-string 2)))
- (throw 'match t)))
+ (let ((linkpos (org-in-regexp org-angle-link-re)))
+ (when (or linkpos
+ (and linkpos (goto-char (car klpos))
+ (save-match-data (not (looking-back "\\[\\[")))))
+ (setq type (match-string 1)
+ path (org-link-unescape (match-string 2)))
+ (throw 'match t))))
(save-excursion
(when (org-in-regexp (org-re "\\(:[[:alnum:]_@#%:]+\\):[ \t]*$"))
(setq type "tags"
@@ -9715,7 +9716,7 @@ application the system uses for this file type."
path (match-string 1))
(throw 'match t)))
(unless path
- (error "No link found"))
+ (user-error "No link found"))
;; switch back to reference buffer
;; needed when if called in a temporary buffer through