summaryrefslogtreecommitdiff
path: root/eww-conf.el
diff options
context:
space:
mode:
authorJSDurand <mmemmew@gmail.com>2022-08-29 21:45:51 +0800
committerJSDurand <mmemmew@gmail.com>2022-08-29 21:45:51 +0800
commit1b8e0b62d4ba6a9aa505fc52f520608c7682fd46 (patch)
treea7e95e391ddce4d28d7a52e12ee0c8d68ca25197 /eww-conf.el
parente46eef2a70c675a0cb62cc35bbf50ec3d31f6ee0 (diff)
eww: integrate with elpher
* eww-conf.el: ("elpher", eww-open-elpher, #'eww-browse-url, #'eww): Add integration with Elpher. So far it seems nice.
Diffstat (limited to 'eww-conf.el')
-rw-r--r--eww-conf.el15
1 files changed, 15 insertions, 0 deletions
diff --git a/eww-conf.el b/eww-conf.el
index 1b3f76b..dae5a7a 100644
--- a/eww-conf.el
+++ b/eww-conf.el
@@ -32,6 +32,21 @@ If ARG is nil, open in EWW. Otherwise, open in an external browser."
(arg (funcall browse-url-secondary-browser-function url))
((eww-browse-url url))))
+;;; Elpher integration
+
+(use-package "elpher" 'elpher)
+
+(defun eww-open-elpher (old url &rest args)
+ "Use Elpher to open the URL if needed."
+ (cond
+ ((member (url-type (url-generic-parse-url url))
+ (list "gemini" "gopher"))
+ (elpher-go url))
+ ((apply old (cons url args)))))
+
+(advice-add #'eww-browse-url :around #'eww-open-elpher)
+(advice-add #'eww :around #'eww-open-elpher)
+
;;; Use pdf-view to view PDF files if available.
(setq mailcap-prefer-mailcap-viewers nil)