aboutsummaryrefslogtreecommitdiff
path: root/sx-button.el
diff options
context:
space:
mode:
authorArtur Malabarba <bruce.connor.am@gmail.com>2015-02-21 17:53:52 -0200
committerArtur Malabarba <bruce.connor.am@gmail.com>2015-02-21 17:53:52 -0200
commit85dc0ab2137d793a43967e8771933161b1701c47 (patch)
tree3c2afaee1470e22cc31eff3d1a629a2a278791b2 /sx-button.el
parent5f2a058a088229264c9e900527c7be7d915b43b9 (diff)
parentca121c0c65e0e689af2ee859fdd8ebea8bc44bc5 (diff)
Merge branch 'master' into images
Diffstat (limited to 'sx-button.el')
-rw-r--r--sx-button.el13
1 files changed, 9 insertions, 4 deletions
diff --git a/sx-button.el b/sx-button.el
index 1d4eb4f..9f6d3b3 100644
--- a/sx-button.el
+++ b/sx-button.el
@@ -98,9 +98,14 @@ usually part of a code-block."
(defun sx-button-follow-link (&optional pos)
"Follow link at POS. If POS is nil, use `point'."
(interactive)
- (browse-url
- (or (get-text-property (or pos (point)) 'sx-button-url)
- (sx-user-error "No url under point: %s" (or pos (point))))))
+ (let ((url (or (get-text-property (or pos (point)) 'sx-button-url)
+ (sx-user-error "No url under point: %s" (or pos (point))))))
+ ;; If we didn't recognize the link, this errors immediately. If
+ ;; we mistakenly recognize it, it will error when we try to fetch
+ ;; whatever we thought it was.
+ (condition-case nil (sx-open-link url)
+ ;; When it errors, don't blame the user, just visit externally.
+ (error (sx-visit-externally url)))))
;;; Help-echo definitions
@@ -164,7 +169,7 @@ usually part of a code-block."
'face 'sx-user-name
:supertype 'sx-button)
-(declare-function sx-search-tag-at-point "sx-tag")
+(declare-function sx-search-tag-at-point "sx-search")
(define-button-type 'sx-button-tag
'action #'sx-search-tag-at-point
'help-echo sx-button--tag-help-echo