From a09131b14410b52740478b98b5e874badde3ba4e Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jens=20=C3=96stlund?= Date: Sat, 8 May 2021 21:49:28 +0200 Subject: [PATCH] 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. --- elpher.el | 15 +++++++++++++++ 1 file changed, 15 insertions(+) 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 ;; -- 2.20.1