Rewrite org-download/attach systems

+ Cut down on unnecessary code & advice
+ Fix 'attach and 'download methods for org-download so that a) their
  links actually work and b) inline previews of their links show up.
+ Allow users to only set org-attach-id-dir (which will be mirrored to
  org-download-image-dir, unless the user has changed it).
+ Prevent a few edge cases where org-attach-id-dir or
  org-download-image-dir were blank.
This commit is contained in:
Henrik Lissner 2020-04-25 01:27:25 -04:00
parent adbe9041ce
commit 8c1525e3d8
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395
3 changed files with 44 additions and 56 deletions

View file

@ -367,11 +367,10 @@ underlying, modified buffer. This fixes that."
(defun +org-init-attachments-h ()
"Sets up org's attachment system."
;; Centralized attachments directory
(setq org-attach-id-dir (doom-path org-directory org-attach-id-dir)
;; Store a link to attachments when they are attached
org-attach-store-link-p t
;; Inherit attachment properties from parent nodes
org-attach-use-inheritance t)
(unless org-attach-id-dir
(setq org-attach-id-dir (expand-file-name ".attach/" org-directory)))
(setq org-attach-store-link-p t ; store link when attaching files
org-attach-use-inheritance t) ; inherit attachment properties from parent nodes
(after! projectile
(add-to-list 'projectile-globally-ignored-directories org-attach-id-dir)))
@ -932,9 +931,8 @@ compelling reason, so..."
org-capture
:preface
;; Change org defaults (should be set before org loads)
(setq org-directory "~/org/"
org-attach-id-dir ".attach/"
org-publish-timestamp-directory (concat doom-cache-dir "org-timestamps/")
(defvar org-attach-id-dir nil) ; set later
(setq org-publish-timestamp-directory (concat doom-cache-dir "org-timestamps/")
org-preview-latex-image-directory (concat doom-cache-dir "org-latex/"))
;; Make most of the default modules opt-in, because I sincerely doubt most