From 14ffe22b8fa0190e9b0b5ab0a22dd8ac76f9f003 Mon Sep 17 00:00:00 2001 From: Bastien Guerry Date: Thu, 20 Dec 2012 09:39:35 +0100 Subject: [PATCH] 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. --- lisp/org.el | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/lisp/org.el b/lisp/org.el index 82a099fa3..50b8113d5 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