From 2d4b14482c92997b3c97731795e1eb6f054fecf6 Mon Sep 17 00:00:00 2001 From: Artur Malabarba Date: Thu, 15 Jan 2015 19:13:33 -0200 Subject: Hitting RET on link buttons calls sx-open-link --- sx-button.el | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'sx-button.el') diff --git a/sx-button.el b/sx-button.el index 5a2f052..e00b086 100644 --- a/sx-button.el +++ b/sx-button.el @@ -98,9 +98,9 @@ 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)))))) + (sx-open-link url))) ;;; Help-echo definitions -- cgit v1.2.3 From ade5fe434b5fd031db8cd4e601f26f2933354ab2 Mon Sep 17 00:00:00 2001 From: Artur Malabarba Date: Thu, 12 Feb 2015 14:18:55 -0200 Subject: Compiler warnings --- sx-button.el | 10 +++++----- sx.el | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'sx-button.el') diff --git a/sx-button.el b/sx-button.el index 5a2f052..46855e7 100644 --- a/sx-button.el +++ b/sx-button.el @@ -77,23 +77,23 @@ This is usually a link's URL, or the content of a code block." (point) 'sx-button-copy-type) content))))) -(defun sx-button-edit-this (text-or-marker &optional major-mode) - "Open a temp buffer populated with the string TEXT-OR-MARKER using MAJOR-MODE. +(defun sx-button-edit-this (text-or-marker &optional majormode) + "Open a temp buffer populated with the string TEXT-OR-MARKER using MAJORMODE. When given a marker (or interactively), use the 'sx-button-copy and the 'sx-mode text-properties under the marker. These are usually part of a code-block." (interactive (list (point-marker))) ;; Buttons receive markers. (when (markerp text-or-marker) - (setq major-mode (get-text-property text-or-marker 'sx-mode)) + (setq majormode (get-text-property text-or-marker 'sx-mode)) (unless (setq text-or-marker (get-text-property text-or-marker 'sx-button-copy)) (sx-message "Nothing of interest here."))) (with-current-buffer (pop-to-buffer (generate-new-buffer "*sx temp buffer*")) (insert text-or-marker) - (when major-mode - (funcall major-mode)))) + (when majormode + (funcall majormode)))) (defun sx-button-follow-link (&optional pos) "Follow link at POS. If POS is nil, use `point'." diff --git a/sx.el b/sx.el index 33b36b6..73d874f 100644 --- a/sx.el +++ b/sx.el @@ -204,7 +204,7 @@ is intentionally skipped." (while (and ;; We're not at the end. (cdr-safe tail) ;; We're not at the right place. - (,(or predicate #'<) x (cadr tail))) + (funcall (or ,predicate #'<) x (cadr tail))) (setq tail (cdr tail))) (setcdr tail (cons x (cdr tail))))) -- cgit v1.2.3 From b7d1d7c47e6bbb907df90ee078ef18ba47412b75 Mon Sep 17 00:00:00 2001 From: Artur Malabarba Date: Thu, 12 Feb 2015 18:54:41 -0200 Subject: Try sx-open-link, THEN do sx-visit-externally --- sx-button.el | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'sx-button.el') diff --git a/sx-button.el b/sx-button.el index e00b086..992c654 100644 --- a/sx-button.el +++ b/sx-button.el @@ -100,7 +100,12 @@ usually part of a code-block." (interactive) (let ((url (or (get-text-property (or pos (point)) 'sx-button-url) (sx-user-error "No url under point: %s" (or pos (point)))))) - (sx-open-link url))) + ;; 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 -- cgit v1.2.3 From cb29144eb54eb8541f469995a13909ec0bdb1c1d Mon Sep 17 00:00:00 2001 From: Artur Malabarba Date: Sat, 14 Feb 2015 15:46:39 -0200 Subject: Fix declare-function --- sx-button.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sx-button.el') diff --git a/sx-button.el b/sx-button.el index 8a4bcc0..9f6d3b3 100644 --- a/sx-button.el +++ b/sx-button.el @@ -169,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 -- cgit v1.2.3