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:
parent
adbe9041ce
commit
8c1525e3d8
3 changed files with 44 additions and 56 deletions
|
@ -42,7 +42,7 @@ PATH (a string) can be an url, a local file path, or a base64 encoded datauri."
|
|||
(unless (eq major-mode 'org-mode)
|
||||
(user-error "Not in an org buffer"))
|
||||
(require 'org-download)
|
||||
(condition-case ex
|
||||
(condition-case-unless-debug e
|
||||
(let ((raw-uri (url-unhex-string path)))
|
||||
(cond ((string-match-p "^data:image/png;base64," path)
|
||||
(org-download-dnd-base64 path nil))
|
||||
|
@ -56,4 +56,4 @@ PATH (a string) can be an url, a local file path, or a base64 encoded datauri."
|
|||
;; insert the link
|
||||
(org-download-insert-link raw-uri new-path)))))
|
||||
(error
|
||||
(user-error "Failed to attach file: %s" (error-message-string ex)))))
|
||||
(user-error "Failed to attach file: %s" (error-message-string e)))))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue