From: Jens Östlund Date: Sat, 8 May 2021 19:49:28 +0000 (+0200) Subject: Integrate with `browse-url` X-Git-Tag: v3.0.0~22^2~38^2 X-Git-Url: https://thelambdalab.xyz/gitweb/index.cgi?a=commitdiff_plain;h=a09131b14410b52740478b98b5e874badde3ba4e;p=elpher.git Integrate with `browse-url` Enable opening gopher, gemini and finger links in Elpher by using `browse-url`. As part of this functionality "gemini://" is registered as a `thing-at-point` URI scheme so gemini links are interpreted as URLs. --- diff --git a/elpher.el b/elpher.el index 4c34f52..1292de8 100644 --- a/elpher.el +++ b/elpher.el @@ -1663,6 +1663,21 @@ If ADDRESS is already bookmarked, update the label only." (not (equal (elpher-bookmark-url bookmark) url))) (elpher-load-bookmarks))))) +;;; Integrations +;; + +(defun browse-url-elpher (url &rest _args) + "Browse URL. This function is used by `browse-url'." + (interactive (browse-url-interactive-arg "Elpher URL: ")) + (elpher-go url)) + +(with-eval-after-load "browse-url" + ;; Use elpher to open gopher, finger and gemini links + (add-to-list 'browse-url-default-handlers + '("^\\(gopher\\|finger\\|gemini\\)://" . browse-url-elpher)) + ;; Register "gemini://" as a URI scheme so `browse-url' does the right thing + (add-to-list 'thing-at-point-uri-schemes "gemini://")) + ;;; Interactive procedures ;;