diff options
author | Steven Allen <steven@stebalien.com> | 2025-05-20 07:55:48 -0700 |
---|---|---|
committer | Vasilij Schneidermann <mail@vasilij.de> | 2025-06-15 12:51:15 +0200 |
commit | 933816c190633fa1f2f0667ba105d1311572b3c6 (patch) | |
tree | 23a45982e79a49d79ce57f4b1efc9f9120a1f20f | |
parent | cdf1a56a8a001ddcbd72fc64fc1248e2997dc7d4 (diff) |
Autoload org-link handlers
This ensures that the org-link handlers are loaded along with org-mode
_without_ unnecessarily loading all of nov.
-rw-r--r-- | nov.el | 22 |
1 files changed, 13 insertions, 9 deletions
@@ -1001,6 +1001,7 @@ See also `nov-bookmark-make-record'." ;;; Org interop +;;;###autoload (defun nov-org-link-follow (path) "Follow nov: link designated by PATH." (if (string-match "^\\(.*\\)::\\([0-9]+\\):\\([0-9]+\\)$" path) @@ -1010,6 +1011,7 @@ See also `nov-bookmark-make-record'." (nov--find-file file index point)) (error "Invalid nov.el link"))) +;;;###autoload (defun nov-org-link-store () "Store current EPUB location as nov: link." (when (and (eq major-mode 'nov-mode) nov-file-name) @@ -1034,15 +1036,17 @@ See also `nov-bookmark-make-record'." :publisher (alist-get 'publisher nov-metadata) :description description)))) -(cond - ((fboundp 'org-link-set-parameters) - (org-link-set-parameters - "nov" - :follow 'nov-org-link-follow - :store 'nov-org-link-store)) - ((fboundp 'org-add-link-type) - (org-add-link-type "nov" 'nov-org-link-follow) - (add-hook 'org-store-link-functions 'nov-org-link-store))) +;;;###autoload +(with-eval-after-load 'org + (cond + ((fboundp 'org-link-set-parameters) + (org-link-set-parameters + "nov" + :follow 'nov-org-link-follow + :store 'nov-org-link-store)) + ((fboundp 'org-add-link-type) + (org-add-link-type "nov" 'nov-org-link-follow) + (add-hook 'org-store-link-functions 'nov-org-link-store)))) ;;; Imenu interop |