From: Daniel Semyonov Date: Wed, 30 Jun 2021 23:09:45 +0000 (+0300) Subject: Remove 'with-eval-after-load' block for 'browse-url' X-Git-Tag: v3.0.0~22^2~9 X-Git-Url: https://thelambdalab.xyz/gitweb/index.cgi?a=commitdiff_plain;h=7a1b1e2c9e9cc877b4378fddb94bed48d9955c4b;p=elpher.git Remove 'with-eval-after-load' block for 'browse-url' It is not necessary (tested with 'emacs -Q'). --- diff --git a/elpher.el b/elpher.el index d9046bc..90f7672 100644 --- a/elpher.el +++ b/elpher.el @@ -1870,22 +1870,21 @@ paramter elpher, where link is self-contained." (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