X-Git-Url: https://thelambdalab.xyz/gitweb/index.cgi?p=elpher.git;a=blobdiff_plain;f=elpher.el;h=8a420e16309678369ff3d138d3e330234597698c;hp=662e451ff7638fb23178788db045fde42338aa86;hb=dbc47ac2e135a0220ebe2f208f37843d89881f7c;hpb=3cb3110e90a8f9f71bd49e6bbd2781f2e9a50285 diff --git a/elpher.el b/elpher.el index 662e451..8a420e1 100644 --- a/elpher.el +++ b/elpher.el @@ -81,7 +81,6 @@ (require 'nsm) (require 'gnutls) (require 'socks) -(require 'ol) ;;; ANSI colors or XTerm colors @@ -1783,8 +1782,7 @@ If ADDRESS is already bookmarked, update the label only." ;; Avoid byte compilation warnings. (eval-when-compile (declare-function org-link-store-props "ol") - (declare-function org-link-set-parameters "ol") - (defvar thing-at-point-uri-schemes)) + (declare-function org-link-set-parameters "ol")) (defun elpher-org-link-store () "Store link to an `elpher' page in `org'." @@ -1806,9 +1804,10 @@ If ADDRESS is already bookmarked, update the label only." (string-match-p "^finger://.+" link)) (elpher-go (string-remove-prefix "elpher:" link)))) -(org-link-set-parameters "elpher" - :store #'elpher-org-link-store - :follow #'elpher-org-link-follow) +(with-eval-after-load 'org + (org-link-set-parameters "elpher" + :store #'elpher-org-link-store + :follow #'elpher-org-link-follow)) ;;;###autoload (defun elpher-browse-url-elpher (url &rest _args) @@ -1816,12 +1815,25 @@ If ADDRESS is already bookmarked, update the label only." (interactive (browse-url-interactive-arg "Elpher URL: ")) (elpher-go url)) -(add-to-list - 'browse-url-default-handlers - '("^\\(gopher\\|finger\\|gemini\\)://" . elpher-browse-url-elpher)) +;; Use elpher to open gopher, finger and gemini links +(with-eval-after-load 'browse-url + (add-to-list + 'browse-url-default-handlers + '("^\\(gopher\\|finger\\|gemini\\)://" . elpher-browse-url-elpher))) + +;; Avoid byte compilation warnings. +(eval-when-compile + (defvar thing-at-point-uri-schemes) + (defvar mu4e~view-beginning-of-url-regexp)) ;; Register "gemini://" as a URI scheme so `browse-url' does the right thing -(add-to-list 'thing-at-point-uri-schemes "gemini://") +(with-eval-after-load 'thingatpt + (add-to-list 'thing-at-point-uri-schemes "gemini://")) + +(with-eval-after-load 'mu4e-view + ;; Make mu4e aware of the gemini world + (setq mu4e~view-beginning-of-url-regexp + "\\(?:https?\\|gopher\\|finger\\|gemini\\)://\\|mailto:")) ;;; Interactive procedures ;;