Rewrite custom org link types

This should fix a few issues with links (like org-download links)
resolving to the incorrect org-directory or org-id-attach-dir (because
it's resolved too early).

I've also simplified and refactored the API to make it easier to grok.
This commit is contained in:
Henrik Lissner 2020-04-24 20:41:56 -04:00
parent 2c0935cb62
commit 6159068b4d
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395
3 changed files with 54 additions and 36 deletions

View file

@ -397,15 +397,15 @@ underlying, modified buffer. This fixes that."
'("wolfram" . "https://wolframalpha.com/input/?i=%s")
'("doom-repo" . "https://github.com/hlissner/doom-emacs/%s"))
(+org-def-link "org" org-directory)
(+org-def-link "doom" doom-emacs-dir)
(+org-def-link "doom-docs" doom-docs-dir)
(+org-def-link "doom-modules" doom-modules-dir)
(+org-define-basic-link "org" 'org-directory)
(+org-define-basic-link "doom" 'doom-emacs-dir)
(+org-define-basic-link "doom-docs" 'doom-docs-dir)
(+org-define-basic-link "doom-modules" 'doom-modules-dir)
;; Allow inline image previews of http(s)? urls or data uris
(org-link-set-parameters "http" :image-data-fun #'+org-image-link)
(org-link-set-parameters "https" :image-data-fun #'+org-image-link)
(org-link-set-parameters "img" :image-data-fun #'+org-inline-data-image)
(org-link-set-parameters "http" :image-data-fun #'+org-http-image-data-fn)
(org-link-set-parameters "https" :image-data-fun #'+org-http-image-data-fn)
(org-link-set-parameters "img" :image-data-fun #'+org-inline-image-data-fn)
;; Add support for youtube links + previews
(require 'org-yt nil t))