diff lisp/net/tramp-ftp.el @ 86204:7d7472ea9c0a

* net/tramp.el (tramp-completion-reread-directory-timeout): New defcustom. (tramp-handle-file-name-all-completions): Flush directory contents from cache regularly. (tramp-set-auto-save-file-modes): Check also for `buffer-modified-p'. (tramp-open-connection-setup-interactive-shell): Call `tramp-cleanup-connection' via funcall. * net/tramp-ftp.el (tramp-ftp-file-name-handler): Temp file is already created when copying.
author Michael Albinus <michael.albinus@gmx.de>
date Sun, 18 Nov 2007 10:24:51 +0000
parents 7f134b676a0c
children 107ccd98fa12 53108e6cea98
line wrap: on
line diff
--- a/lisp/net/tramp-ftp.el	Sat Nov 17 18:23:01 2007 +0000
+++ b/lisp/net/tramp-ftp.el	Sun Nov 18 10:24:51 2007 +0000
@@ -152,6 +152,7 @@
 	      (aset v 0 tramp-ftp-method)
 	      (tramp-set-connection-property v "started" t))
 	  nil))
+
        ;; If the second argument of `copy-file' or `rename-file' is a
        ;; remote file name but via FTP, ange-ftp doesn't check this.
        ;; We must copy it locally first, because there is no place in
@@ -163,8 +164,16 @@
 	       (newname (cadr args))
 	       (tmpfile (tramp-compat-make-temp-file filename))
 	       (args (cddr args)))
-	  (apply operation filename tmpfile args)
-	  (rename-file tmpfile newname (car args))))
+	  ;; We must set `ok-if-already-exists' to t in the first
+	  ;; step, because the temp file has been created already.
+	  (if (eq operation 'copy-file)
+	      (apply operation filename tmpfile t (cdr args))
+	    (apply operation filename tmpfile t))
+	  (unwind-protect
+	      (rename-file tmpfile newname (car args))
+	    ;; Cleanup.
+	    (ignore-errors (delete-file tmpfile)))))
+
        ;; Normally, the handlers must be discarded.
        (t (let* ((inhibit-file-name-handlers
 		  (list 'tramp-file-name-handler