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:
parent
2c0935cb62
commit
6159068b4d
3 changed files with 54 additions and 36 deletions
|
@ -16,12 +16,14 @@
|
|||
|
||||
(after! org
|
||||
;; A shorter link to attachments
|
||||
(+org-def-link "download" org-attach-id-dir)
|
||||
(setf (alist-get "download" org-link-abbrev-alist nil nil #'equal)
|
||||
(abbreviate-file-name org-attach-id-dir)))
|
||||
(+org-define-basic-link "download" 'org-attach-id-dir
|
||||
:image-data-fun #'+org-image-file-data-fn
|
||||
:requires 'org-download))
|
||||
:config
|
||||
(setq org-download-image-dir org-attach-id-dir
|
||||
org-download-link-format "[[download:%s]]\n"
|
||||
(unless org-download-image-dir
|
||||
(setq org-download-image-dir (expand-file-name (or org-attach-id-dir "")
|
||||
org-directory)))
|
||||
(setq org-download-link-format "[[download:%s]]\n"
|
||||
org-download-method 'attach
|
||||
org-download-heading-lvl nil
|
||||
org-download-timestamp "_%Y%m%d_%H%M%S"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue