]> git.eshelyaron.com Git - emacs.git/commitdiff
Improve Tramp's copy-directory
authorMichael Albinus <michael.albinus@gmx.de>
Tue, 5 Nov 2019 11:58:47 +0000 (12:58 +0100)
committerMichael Albinus <michael.albinus@gmx.de>
Tue, 5 Nov 2019 11:58:47 +0000 (12:58 +0100)
* lisp/net/tramp-adb.el (tramp-adb-file-name-handler-alist):
* lisp/net/tramp-gvfs.el (tramp-gvfs-file-name-handler-alist):
* lisp/net/tramp-rclone.el (tramp-rclone-file-name-handler-alist):
* lisp/net/tramp-sudoedit.el (tramp-sudoedit-file-name-handler-alist):
Add `copy-directory'.

* lisp/net/tramp.el (tramp-handle-copy-directory): New defun.

lisp/net/tramp-adb.el
lisp/net/tramp-gvfs.el
lisp/net/tramp-rclone.el
lisp/net/tramp-sudoedit.el
lisp/net/tramp.el

index e3098190e2ba9e09fd072b6331a2e47c7d5d0237..a4f5760f72e6017fc6ee278030d89555bc43e917 100644 (file)
@@ -94,7 +94,7 @@ It is used for TCP/IP devices."
   '((access-file . tramp-handle-access-file)
     (add-name-to-file . tramp-handle-add-name-to-file)
     ;; `byte-compiler-base-file-name' performed by default handler.
-    ;; `copy-directory' performed by default handler.
+    (copy-directory . tramp-handle-copy-directory)
     (copy-file . tramp-adb-handle-copy-file)
     (delete-directory . tramp-adb-handle-delete-directory)
     (delete-file . tramp-adb-handle-delete-file)
index 6f5cade4c63b15aa96551c56bcea716e7d9e9e79..dbda24b9ac1099c6ac654fc7211152893ed481b4 100644 (file)
@@ -535,7 +535,7 @@ It has been changed in GVFS 1.14.")
   '((access-file . tramp-handle-access-file)
     (add-name-to-file . tramp-handle-add-name-to-file)
     ;; `byte-compiler-base-file-name' performed by default handler.
-    ;; `copy-directory' performed by default handler.
+    (copy-directory . tramp-handle-copy-directory)
     (copy-file . tramp-gvfs-handle-copy-file)
     (delete-directory . tramp-gvfs-handle-delete-directory)
     (delete-file . tramp-gvfs-handle-delete-file)
index 2b3799ef008255258416f405603f2c24ea4e827a..56afdba7421b626f50edbc59caa77e9de9713a9e 100644 (file)
@@ -70,7 +70,7 @@
   '((access-file . tramp-handle-access-file)
     (add-name-to-file . tramp-handle-add-name-to-file)
     ;; `byte-compiler-base-file-name' performed by default handler.
-    ;; `copy-directory' performed by default handler.
+    (copy-directory . tramp-handle-copy-directory)
     (copy-file . tramp-rclone-handle-copy-file)
     (delete-directory . tramp-rclone-handle-delete-directory)
     (delete-file . tramp-rclone-handle-delete-file)
index 2d9d7ff78921f1f0a1edf5adf01b04034ead9e40..e7a892c746595b70f8fc4866a6f210d7a1b756ef 100644 (file)
@@ -66,7 +66,7 @@ See `tramp-actions-before-shell' for more info.")
   '((access-file . tramp-handle-access-file)
     (add-name-to-file . tramp-sudoedit-handle-add-name-to-file)
     (byte-compiler-base-file-name . ignore)
-    ;; `copy-directory' performed by default handler.
+    (copy-directory . tramp-handle-copy-directory)
     (copy-file . tramp-sudoedit-handle-copy-file)
     (delete-directory . tramp-sudoedit-handle-delete-directory)
     (delete-file . tramp-sudoedit-handle-delete-file)
index 88ff36d98ea5625512a400bda5f23c71f5433ddd..acb5a93687c2b3df7f4089d0671e7a41e86debec 100644 (file)
@@ -3016,6 +3016,20 @@ User is always nil."
      filename newname 'ok-if-already-exists 'keep-time
      'preserve-uid-gid 'preserve-permissions)))
 
+(defun tramp-handle-copy-directory
+  (directory newname &optional keep-date parents copy-contents)
+  "Like `copy-directory' for Tramp files."
+  ;; `directory-files' creates `newname' before running this check.
+  ;; So we do it ourselves.
+  (unless (file-exists-p directory)
+    (tramp-error
+     (tramp-dissect-file-name directory) tramp-file-missing
+     "No such file or directory" directory))
+  ;; We must do it file-wise.
+  (tramp-run-real-handler
+   'copy-directory
+   (list directory newname keep-date parents copy-contents)))
+
 (defun tramp-handle-directory-file-name (directory)
   "Like `directory-file-name' for Tramp files."
   ;; If localname component of filename is "/", leave it unchanged.