diff lisp/net/tramp-ftp.el @ 85024:ef71cdab0d5c

* net/tramp.el (top): Add tramp-compat to `tramp-unload-hook'. (tramp-file-name-handler-alist): Add `tramp-handle-insert-file-contents-literally'. Neded for XEmacs. (tramp-make-temp-file): Use `make-temp-name'. `make-temp-file', used before, creates the file already, which is not desired. (tramp-do-copy-or-rename-file-directly): Simplify handling of temporary file. (tramp-handle-insert-file-contents): Assign the result in the short track case. (tramp-handle-insert-file-contents-literally): New defun. (tramp-completion-mode-p): Revert change from 2007-09-24. Checking for `return' etc as last character is not sufficient, for example in dired-mode when entering <g> (revert-buffer) or <s> (dired-sort). * net/tramp-compat.el (top): Add also compatibility code for loading appropriate timer package. (tramp-compat-copy-tree): Check for `subrp' and `symbol-file' in order to avoid autoloading problems. * net/tramp-fish.el: * net/tramp-smb.el: Move further compatibility code to tramp-compat.el. * net/tramp-ftp.el (tramp-ftp-file-name-handler): Handle the case where the second parameter of `copy-file' or `rename-file' is a remote file but not via ftp.
author Michael Albinus <michael.albinus@gmx.de>
date Wed, 03 Oct 2007 10:54:03 +0000
parents 6e5814967ffb
children a42b8750a992
line wrap: on
line diff
--- a/lisp/net/tramp-ftp.el	Tue Oct 02 22:07:41 2007 +0000
+++ b/lisp/net/tramp-ftp.el	Wed Oct 03 10:54:03 2007 +0000
@@ -149,6 +149,19 @@
 	    (with-parsed-tramp-file-name (car args) nil
 	      (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
+       ;; ange-ftp for correct handling.
+       ((and (memq operation '(copy-file rename-file))
+	     (file-remote-p (cadr args))
+	     (not (tramp-ftp-file-name-p (cadr args))))
+	(let* ((filename (car args))
+	       (newname (cadr args))
+	       (tmpfile (tramp-make-temp-file filename))
+	       (args (cddr args)))
+	  (apply operation filename tmpfile args)
+	  (rename-file tmpfile newname (car args))))
        ;; Normally, the handlers must be discarded.
        (t (let* ((inhibit-file-name-handlers
 		  (list 'tramp-file-name-handler