lang/org: use link abbrev for relative image attachment paths

This commit is contained in:
Henrik Lissner
2018-02-09 18:10:01 -05:00
parent 0d04afa63a
commit 39f519cdb8
2 changed files with 14 additions and 24 deletions

View File

@@ -42,9 +42,6 @@
(cond ((executable-find "maim") "maim -s %s")
((executable-find "scrot") "scrot -s %s")))))
;; Ensure that relative inline image paths are relative to the attachment folder.
(advice-add #'org-display-inline-images :around #'+org-attach*relative-to-attach-dir)
;; Handle non-image files a little differently. Images should be inserted
;; as-is, as image previews. Other files, like pdfs or zips, should be linked
;; to, with an icon indicating the type of file.
@@ -64,6 +61,8 @@
;;
(defun +org|init-attach ()
(setq org-attach-directory (expand-file-name +org-attach-dir +org-dir))
;; A shorter link to attachments
(push (cons "attach" (abbreviate-file-name org-attach-directory)) org-link-abbrev-alist)
(push (car (last (split-string +org-attach-dir "/" t)))
projectile-globally-ignored-directories)