DnD: Create directory when `org-yank-image-save-method' is a directory
* lisp/org.el (org--dnd-attach-file): Make sure that target directory is created before copying file when `org-yank-image-save-method' is set to specific directory (not 'attach). Reported-by: ISouthRain <isouthrain@qq.com> Link: https://orgmode.org/list/tencent_AABB2DEBF7ABFBC795348C288E0EBFCFDD0A@qq.com
This commit is contained in:
parent
96113f3b59
commit
d7b5c19daa
21
lisp/org.el
21
lisp/org.el
|
@ -20941,15 +20941,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
|
||||
|
|
Loading…
Reference in New Issue