Fix #2932
This commit is contained in:
Henrik Lissner 2020-04-18 12:51:00 -04:00
parent afcdae4fff
commit 141a649e04
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395
2 changed files with 2 additions and 11 deletions

View file

@ -10,13 +10,3 @@
(rassq-delete-all '+org-dragndrop-download-dnd-fn
(copy-alist dnd-protocol-alist))))
(dnd-handle-one-url nil action uri))))
;;;###autoload
(defun +org-dragndrop-image-fn (protocol link _description)
"Return the image associated with the current attachment."
(let ((file (expand-file-name link org-attach-id-dir)))
(when (and (file-exists-p file) (image-type-from-file-name file))
(with-temp-buffer
(insert-file-contents file)
(goto-char (point-min))
(buffer-substring-no-properties (point) (point-max))))))

View file

@ -17,7 +17,8 @@
(after! org
;; A shorter link to attachments
(+org-def-link "download" org-attach-id-dir)
(org-link-set-parameters "download" :image-data-fun #'+org-dragndrop-image-fn))
(setf (alist-get "download" org-link-abbrev-alist nil nil #'equal)
(abbreviate-file-name org-attach-id-dir)))
:config
(setq org-download-image-dir org-attach-id-dir
org-download-link-format "[[download:%s]]\n"