From: plugd Date: Fri, 6 May 2022 11:59:16 +0000 (+0200) Subject: Added spartan to integrations. X-Git-Url: https://thelambdalab.xyz/gitweb/index.cgi?a=commitdiff_plain;h=refs%2Fheads%2Fspartan;p=elpher.git Added spartan to integrations. --- diff --git a/elpher.el b/elpher.el index f582e45..e503a5c 100644 --- a/elpher.el +++ b/elpher.el @@ -2227,9 +2227,10 @@ of gemini, gopher or finger." (let* ((url (elpher-info-current)) (desc (car elpher-current-page)) (protocol (cond - ((string-prefix-p "gemini:" url) "gemini") ((string-prefix-p "gopher:" url) "gopher") ((string-prefix-p "finger:" url) "finger") + ((string-prefix-p "gemini:" url) "gemini") + ((string-prefix-p "spartan:" url) "spartan") (t "elpher")))) (when (equal "elpher" protocol) ;; Weird link. Or special inner link? @@ -2265,6 +2266,11 @@ supports the old protocol elpher, where the link is self-contained." :export (lambda (link description format _plist) (elpher-org-export-link link description format "gopher")) :follow (lambda (link _arg) (elpher-org-follow-link link "gopher"))) + (org-link-set-parameters + "spartan" + :export (lambda (link description format _plist) + (elpher-org-export-link link description format "spartan")) + :follow (lambda (link _arg) (elpher-org-follow-link link "spartan"))) (org-link-set-parameters "finger" :export (lambda (link description format _plist) @@ -2286,7 +2292,7 @@ supports the old protocol elpher, where the link is self-contained." (if (boundp 'browse-url-default-handlers) (add-to-list 'browse-url-default-handlers - '("^\\(gopher\\|finger\\|gemini\\)://" . elpher-browse-url-elpher)) + '("^\\(gopher\\|finger\\|gemini\\|spartan\\)://" . elpher-browse-url-elpher)) ;; Patch `browse-url-browser-function' for older ones. The value of ;; that variable is `browse-url-default-browser' by default, so ;; that's the function that gets advised. If the value is an alist, @@ -2297,7 +2303,7 @@ supports the old protocol elpher, where the link is self-contained." (lambda (url &rest _args) "Handle gemini, gopher, and finger schemes using Elpher." (let ((scheme (downcase (car (split-string url ":" t))))) - (if (member scheme '("gemini" "gopher" "finger")) + (if (member scheme '("gopher" "gemini" "spartan" "finger")) ;; `elpher-go' always returns nil, which will stop the ;; advice chain here in a before-while (elpher-go url) @@ -2312,13 +2318,13 @@ supports the old protocol elpher, where the link is self-contained." ;; Make mu4e aware of the gemini world (setq mu4e~view-beginning-of-url-regexp - "\\(?:https?\\|gopher\\|finger\\|gemini\\)://\\|mailto:") + "\\(?:https?\\|gopher\\|finger\\|gemini\\|spartan\\)://\\|mailto:") ;;; eww: ;; Let elpher handle gemini, gopher links in eww buffer. (setq eww-use-browse-url - "\\`mailto:\\|\\(\\`gemini\\|\\`gopher\\|\\`finger\\)://") + "\\`mailto:\\|\\(\\`gemini\\|\\`gopher\\|\\`finger\\|\\`spartan\\)://") ;;; Interactive procedures