(elpher-go url))
;; Use elpher to open gopher, finger and gemini links
-(with-eval-after-load 'browse-url
- ;; For recent version of `browse-url' package
- (if (boundp 'browse-url-default-handlers)
- (add-to-list
- 'browse-url-default-handlers
- '("^\\(gopher\\|finger\\|gemini\\)://" . elpher-browse-url-elpher))
- ;; Patch browse-url-default-browser for older ones
- (advice-add 'browse-url-default-browser :before-while
- (lambda (url &rest _args)
- (let ((scheme (downcase (car (split-string url ":" t)))))
- (if (member scheme '("gemini" "gopher" "finger"))
- ;; `elpher-go' always returns nil, which will stop the
- ;; advice chain here in a before-while
- (elpher-go url)
- ;; chain must continue, then return t.
- t))))))
+;; For recent version of `browse-url' package
+(if (boundp 'browse-url-default-handlers)
+ (add-to-list
+ 'browse-url-default-handlers
+ '("^\\(gopher\\|finger\\|gemini\\)://" . elpher-browse-url-elpher))
+ ;; Patch browse-url-default-browser for older ones
+ (advice-add 'browse-url-default-browser :before-while
+ (lambda (url &rest _args)
+ (let ((scheme (downcase (car (split-string url ":" t)))))
+ (if (member scheme '("gemini" "gopher" "finger"))
+ ;; `elpher-go' always returns nil, which will stop the
+ ;; advice chain here in a before-while
+ (elpher-go url)
+ ;; chain must continue, then return t.
+ t)))))
;; Register "gemini://" as a URI scheme so `browse-url' does the right thing
(with-eval-after-load 'thingatpt