branch: externals/org
commit 6310bcd5ed1ed285d894ea60de9b9f05428d0b3d
Merge: 8f40da6bf6 d7b5c19daa
Author: Ihor Radchenko <[email protected]>
Commit: Ihor Radchenko <[email protected]>

    Merge branch 'bugfix'
---
 lisp/org.el | 21 ++++++++++++---------
 1 file changed, 12 insertions(+), 9 deletions(-)

diff --git a/lisp/org.el b/lisp/org.el
index f50f0cff3d..8ef7c45e7f 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -20942,15 +20942,18 @@ SEPARATOR is the string to insert after each link."
                    ('private (or org-yank-dnd-default-attach-method
                                  org-attach-method)))))
     (if separatep
-        (funcall
-         (pcase method
-           ('cp #'copy-file)
-           ('mv #'rename-file)
-           ('ln #'add-name-to-file)
-           ('lns #'make-symbolic-link))
-         filename
-         (expand-file-name (file-name-nondirectory filename)
-                           org-yank-image-save-method))
+        (progn
+          (unless (file-directory-p org-yank-image-save-method)
+            (make-directory org-yank-image-save-method t))
+          (funcall
+           (pcase method
+             ('cp #'copy-file)
+             ('mv #'rename-file)
+             ('ln #'add-name-to-file)
+             ('lns #'make-symbolic-link))
+           filename
+           (expand-file-name (file-name-nondirectory filename)
+                             org-yank-image-save-method)))
       (org-attach-attach filename nil method))
     (insert
      (org-link-make-string

Reply via email to