mirror of
https://github.com/doomemacs/doomemacs
synced 2025-09-18 16:06:56 -05:00
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:
@@ -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)))))
|
||||
|
Reference in New Issue
Block a user