emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/org d2a110ffe2: org-attach-attach: Allow attaching dire


From: ELPA Syncer
Subject: [elpa] externals/org d2a110ffe2: org-attach-attach: Allow attaching directories using 'cp method
Date: Thu, 21 Jul 2022 07:57:44 -0400 (EDT)

branch: externals/org
commit d2a110ffe2df5c6ee40612d0c4b3929b5e5b51c6
Author: Ihor Radchenko <yantar92@gmail.com>
Commit: Ihor Radchenko <yantar92@gmail.com>

    org-attach-attach: Allow attaching directories using 'cp method
    
    * lisp/org-attach.el (org-attach-attach): Use `copy-directory' when
    FILE is a directory.  Remove trailing slash before processing.
---
 lisp/org-attach.el | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/lisp/org-attach.el b/lisp/org-attach.el
index c41d3df26f..fe49af6f3c 100644
--- a/lisp/org-attach.el
+++ b/lisp/org-attach.el
@@ -520,12 +520,17 @@ METHOD may be `cp', `mv', `ln', `lns' or `url' default 
taken from
     current-prefix-arg
     nil))
   (setq method (or method org-attach-method))
+  (when (file-directory-p file)
+    (setq file (directory-file-name file)))
   (let ((basename (file-name-nondirectory file)))
     (let* ((attach-dir (org-attach-dir 'get-create))
            (attach-file (expand-file-name basename attach-dir)))
       (cond
        ((eq method 'mv) (rename-file file attach-file))
-       ((eq method 'cp) (copy-file file attach-file))
+       ((eq method 'cp)
+        (if (file-directory-p file)
+            (copy-directory file attach-file nil nil t)
+          (copy-file file attach-file)))
        ((eq method 'ln) (add-name-to-file file attach-file))
        ((eq method 'lns) (make-symbolic-link file attach-file 1))
        ((eq method 'url)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]