diff options
author | Michael Albinus <michael.albinus@gmx.de> | 2019-11-05 12:58:47 +0100 |
---|---|---|
committer | Michael Albinus <michael.albinus@gmx.de> | 2019-11-05 12:58:47 +0100 |
commit | d270d7d4ad8693202777ce29363947d38899bf6c (patch) | |
tree | cc856043bb2580bf90e1c22018f3b0fce76f916f | |
parent | 91c732f687a61ba130acf38d5142bec6369ebd68 (diff) | |
download | emacs-d270d7d4ad8693202777ce29363947d38899bf6c.tar.gz emacs-d270d7d4ad8693202777ce29363947d38899bf6c.tar.bz2 emacs-d270d7d4ad8693202777ce29363947d38899bf6c.zip |
Improve Tramp's copy-directory
* 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.
-rw-r--r-- | lisp/net/tramp-adb.el | 2 | ||||
-rw-r--r-- | lisp/net/tramp-gvfs.el | 2 | ||||
-rw-r--r-- | lisp/net/tramp-rclone.el | 2 | ||||
-rw-r--r-- | lisp/net/tramp-sudoedit.el | 2 | ||||
-rw-r--r-- | lisp/net/tramp.el | 14 |
5 files changed, 18 insertions, 4 deletions
diff --git a/lisp/net/tramp-adb.el b/lisp/net/tramp-adb.el index e3098190e2b..a4f5760f72e 100644 --- a/lisp/net/tramp-adb.el +++ b/lisp/net/tramp-adb.el @@ -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) diff --git a/lisp/net/tramp-gvfs.el b/lisp/net/tramp-gvfs.el index 6f5cade4c63..dbda24b9ac1 100644 --- a/lisp/net/tramp-gvfs.el +++ b/lisp/net/tramp-gvfs.el @@ -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) diff --git a/lisp/net/tramp-rclone.el b/lisp/net/tramp-rclone.el index 2b3799ef008..56afdba7421 100644 --- a/lisp/net/tramp-rclone.el +++ b/lisp/net/tramp-rclone.el @@ -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) diff --git a/lisp/net/tramp-sudoedit.el b/lisp/net/tramp-sudoedit.el index 2d9d7ff7892..e7a892c7465 100644 --- a/lisp/net/tramp-sudoedit.el +++ b/lisp/net/tramp-sudoedit.el @@ -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) diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index 88ff36d98ea..acb5a93687c 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el @@ -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. |