changeset 108816:94d1d8a6dcfd

* net/tramp-compat.el (tramp-compat-delete-file): Use `symbol-value' for backward compatibility. * net/tramp.el (tramp-handle-make-symbolic-link) (tramp-handle-load) (tramp-do-copy-or-rename-file-via-buffer) (tramp-do-copy-or-rename-file-directly) (tramp-do-copy-or-rename-file-out-of-band) (tramp-handle-process-file, tramp-handle-call-process-region) (tramp-handle-shell-command, tramp-handle-file-local-copy) (tramp-handle-insert-file-contents, tramp-handle-write-region) (tramp-delete-temp-file-function): Use `delete-file' instead of `tramp-compat-delete-file'. * net/tramp-fish.el (tramp-fish-handle-delete-directory) (tramp-fish-handle-make-symbolic-link) (tramp-fish-handle-process-file): Use `delete-file' instead of `tramp-compat-delete-file'. * net/tramp-ftp.el (tramp-ftp-file-name-handler): Use `delete-file' instead of `tramp-compat-delete-file'. * net/tramp-gvfs.el (tramp-gvfs-handle-delete-file): Rename arg. (tramp-gvfs-handle-write-region): Use `delete-file' instead of `tramp-compat-delete-file'. * net/tramp-imap.el (tramp-imap-do-copy-or-rename-file): Use `delete-file' instead of `tramp-compat-delete-file'. * net/tramp-smb.el (tramp-smb-handle-copy-file) (tramp-smb-handle-file-local-copy, tramp-smb-handle-rename-file) (tramp-smb-handle-write-region): Use `delete-file' instead of `tramp-compat-delete-file'. (tramp-smb-handle-delete-directory): Use 'trash as arg.
author Michael Albinus <michael.albinus@gmx.de>
date Fri, 28 May 2010 15:28:36 +0200
parents 93729e1f822d
children a90103f99eea
files lisp/ChangeLog lisp/net/tramp-compat.el lisp/net/tramp-fish.el lisp/net/tramp-ftp.el lisp/net/tramp-gvfs.el lisp/net/tramp-imap.el lisp/net/tramp-smb.el lisp/net/tramp.el
diffstat 8 files changed, 75 insertions(+), 38 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Fri May 28 15:46:28 2010 +0900
+++ b/lisp/ChangeLog	Fri May 28 15:28:36 2010 +0200
@@ -1,3 +1,40 @@
+2010-05-28  Michael Albinus  <michael.albinus@gmx.de>
+
+	* net/tramp-compat.el (tramp-compat-delete-file): Use
+	`symbol-value' for backward compatibility.
+
+	* net/tramp.el (tramp-handle-make-symbolic-link)
+	(tramp-handle-load)
+	(tramp-do-copy-or-rename-file-via-buffer)
+	(tramp-do-copy-or-rename-file-directly)
+	(tramp-do-copy-or-rename-file-out-of-band)
+	(tramp-handle-process-file, tramp-handle-call-process-region)
+	(tramp-handle-shell-command, tramp-handle-file-local-copy)
+	(tramp-handle-insert-file-contents, tramp-handle-write-region)
+	(tramp-delete-temp-file-function): Use `delete-file' instead
+	of `tramp-compat-delete-file'.
+
+	* net/tramp-fish.el (tramp-fish-handle-delete-directory)
+	(tramp-fish-handle-make-symbolic-link)
+	(tramp-fish-handle-process-file): Use `delete-file' instead
+	of `tramp-compat-delete-file'.
+
+	* net/tramp-ftp.el (tramp-ftp-file-name-handler): Use
+	`delete-file' instead of `tramp-compat-delete-file'.
+
+	* net/tramp-gvfs.el (tramp-gvfs-handle-delete-file): Rename arg.
+	(tramp-gvfs-handle-write-region): Use `delete-file' instead of
+	`tramp-compat-delete-file'.
+
+	* net/tramp-imap.el (tramp-imap-do-copy-or-rename-file): Use
+	`delete-file' instead of `tramp-compat-delete-file'.
+
+	* net/tramp-smb.el (tramp-smb-handle-copy-file)
+	(tramp-smb-handle-file-local-copy, tramp-smb-handle-rename-file)
+	(tramp-smb-handle-write-region): Use `delete-file' instead of
+	`tramp-compat-delete-file'.
+	(tramp-smb-handle-delete-directory): Use 'trash as arg.
+
 2010-05-27  Chong Yidong  <cyd@stupidchicken.com>
 
 	* dired.el (dired-delete-file): New arg TRASH.
--- a/lisp/net/tramp-compat.el	Fri May 28 15:46:28 2010 +0900
+++ b/lisp/net/tramp-compat.el	Fri May 28 15:28:36 2010 +0200
@@ -343,7 +343,7 @@
     (wrong-number-of-arguments
      (let ((delete-by-moving-to-trash
 	    (and (boundp 'delete-by-moving-to-trash)
-		 delete-by-moving-to-trash
+		 (symbol-value 'delete-by-moving-to-trash)
 		 trash)))
        (delete-file filename)))))
 
--- a/lisp/net/tramp-fish.el	Fri May 28 15:46:28 2010 +0900
+++ b/lisp/net/tramp-fish.el	Fri May 28 15:28:36 2010 +0200
@@ -326,14 +326,14 @@
 	 (lambda (file)
 	   (if (file-directory-p file)
 	       (tramp-compat-delete-directory file recursive)
-	     (tramp-compat-delete-file file)))
+	     (delete-file file)))
 	 ;; We do not want to delete "." and "..".
 	 (directory-files
 	  directory 'full "^\\([^.]\\|\\.\\([^.]\\|\\..\\)\\).*")))
     (with-parsed-tramp-file-name
-     (directory-file-name (expand-file-name directory)) nil
-     (tramp-flush-directory-property v localname)
-     (tramp-fish-send-command-and-check v (format "#RMD %s" localname)))))
+	(directory-file-name (expand-file-name directory)) nil
+      (tramp-flush-directory-property v localname)
+      (tramp-fish-send-command-and-check v (format "#RMD %s" localname)))))
 
 (defun tramp-fish-handle-delete-file (filename &optional trash)
   "Like `delete-file' for Tramp files."
@@ -660,7 +660,7 @@
 			  localname)))))
 	  (tramp-error
 	   v 'file-already-exists "File %s already exists" localname)
-	(tramp-compat-delete-file linkname)))
+	(delete-file linkname)))
 
     ;; If FILENAME is a Tramp name, use just the localname component.
     (when (tramp-tramp-file-p filename)
@@ -839,8 +839,8 @@
       ;; Provide error file.
       (when tmpstderr (rename-file tmpstderr (cadr destination) t))
       ;; Cleanup.
-      (when tmpinput (tramp-compat-delete-file tmpinput))
-      (when tmpoutput (tramp-compat-delete-file tmpoutput))
+      (when tmpinput (delete-file tmpinput))
+      (when tmpoutput (delete-file tmpoutput))
       ;; Return exit status.
       ret)))
 
--- a/lisp/net/tramp-ftp.el	Fri May 28 15:46:28 2010 +0900
+++ b/lisp/net/tramp-ftp.el	Fri May 28 15:28:36 2010 +0200
@@ -182,7 +182,7 @@
 	  (unwind-protect
 	      (rename-file tmpfile newname (car args))
 	    ;; Cleanup.
-	    (ignore-errors (tramp-compat-delete-file tmpfile)))))
+	    (ignore-errors (delete-file tmpfile)))))
 
        ;; Normally, the handlers must be discarded.
        ;; `inhibit-file-name-handlers' isn't sufficient, because the
--- a/lisp/net/tramp-gvfs.el	Fri May 28 15:46:28 2010 +0900
+++ b/lisp/net/tramp-gvfs.el	Fri May 28 15:28:36 2010 +0200
@@ -533,9 +533,9 @@
   (tramp-compat-delete-directory
    (tramp-gvfs-fuse-file-name directory) recursive))
 
-(defun tramp-gvfs-handle-delete-file (filename &optional tramp)
+(defun tramp-gvfs-handle-delete-file (filename &optional trash)
   "Like `delete-file' for Tramp files."
-  (tramp-compat-delete-file (tramp-gvfs-fuse-file-name filename) tramp))
+  (tramp-compat-delete-file (tramp-gvfs-fuse-file-name filename) trash))
 
 (defun tramp-gvfs-handle-directory-files
   (directory &optional full match nosort)
@@ -742,7 +742,7 @@
 		   "gvfs-save" tmpfile (tramp-get-buffer v) nil
 		   (tramp-gvfs-url-file-name filename)))
 	       (signal (car err) (cdr err)))
-	   (tramp-compat-delete-file tmpfile)))))
+	   (delete-file tmpfile)))))
 
     ;; Set file modification time.
     (when (or (eq visit t) (stringp visit))
--- a/lisp/net/tramp-imap.el	Fri May 28 15:46:28 2010 +0900
+++ b/lisp/net/tramp-imap.el	Fri May 28 15:28:36 2010 +0200
@@ -267,8 +267,7 @@
 	    (insert-file-contents filename)
 	    (write-region (point-min) (point-max) newname)))))
 
-    (when (eq op 'rename)
-      (tramp-compat-delete-file filename))))
+    (when (eq op 'rename) (delete-file filename))))
 
 ;; TODO: revise this much
 (defun tramp-imap-handle-expand-file-name (name &optional dir)
--- a/lisp/net/tramp-smb.el	Fri May 28 15:46:28 2010 +0900
+++ b/lisp/net/tramp-smb.el	Fri May 28 15:28:36 2010 +0200
@@ -345,7 +345,7 @@
 	  (condition-case err
 	      (rename-file tmpfile newname ok-if-already-exists)
 	    ((error quit)
-	     (tramp-compat-delete-file tmpfile)
+	     (delete-file tmpfile)
 	     (signal (car err) (cdr err))))
 
 	;; Remote newname.
@@ -382,7 +382,7 @@
 	 (lambda (file)
 	   (if (file-directory-p file)
 	       (tramp-compat-delete-directory file recursive)
-	     (tramp-compat-delete-file file t)))
+	     (tramp-compat-delete-file file 'trash)))
 	 ;; We do not want to delete "." and "..".
 	 (directory-files
 	  directory 'full "^\\([^.]\\|\\.\\([^.]\\|\\..\\)\\).*")))
@@ -611,7 +611,7 @@
 		 v (format "get \"%s\" \"%s\""
 			   (tramp-smb-get-localname v) tmpfile))
 	  ;; Oops, an error.  We shall cleanup.
-	  (tramp-compat-delete-file tmpfile)
+	  (delete-file tmpfile)
 	  (tramp-error
 	   v 'file-error "Cannot make local copy of file `%s'" filename)))
       tmpfile)))
@@ -861,7 +861,7 @@
 	  (condition-case err
 	      (rename-file tmpfile newname ok-if-already-exists)
 	    ((error quit)
-	     (tramp-compat-delete-file tmpfile)
+	     (delete-file tmpfile)
 	     (signal (car err) (cdr err))))
 
 	;; Remote newname.
@@ -882,7 +882,7 @@
 			     filename (tramp-smb-get-localname v)))
 	    (tramp-error v 'file-error "Cannot rename `%s'" filename)))))
 
-    (tramp-compat-delete-file filename)))
+    (delete-file filename)))
 
 (defun tramp-smb-handle-set-file-modes (filename mode)
   "Like `set-file-modes' for Tramp files."
@@ -946,7 +946,7 @@
 		     v (format "put %s \"%s\""
 			       tmpfile (tramp-smb-get-localname v)))
 	      (tramp-error v 'file-error "Cannot write `%s'" filename))
-	  (tramp-compat-delete-file tmpfile)))
+	  (delete-file tmpfile)))
 
       (unless (equal curbuf (current-buffer))
 	(tramp-error
--- a/lisp/net/tramp.el	Fri May 28 15:46:28 2010 +0900
+++ b/lisp/net/tramp.el	Fri May 28 15:28:36 2010 +0200
@@ -2544,7 +2544,7 @@
 			    l-localname)))))
 	    (tramp-error
 	     l 'file-already-exists "File %s already exists" l-localname)
-	  (tramp-compat-delete-file linkname)))
+	  (delete-file linkname)))
 
       ;; If FILENAME is a Tramp name, use just the localname component.
       (when (tramp-tramp-file-p filename)
@@ -2593,7 +2593,7 @@
 	    ;; MUST-SUFFIX doesn't exist on XEmacs, so let it default to nil.
 	    (unwind-protect
 		(load local-copy noerror t t)
-	      (tramp-compat-delete-file local-copy)))))
+	      (delete-file local-copy)))))
       t)))
 
 ;; Localname manipulation functions that grok Tramp localnames...
@@ -3769,7 +3769,7 @@
   ;; Set the mode.
   (set-file-modes newname (tramp-default-file-modes filename))
   ;; If the operation was `rename', delete the original file.
-  (unless (eq op 'copy) (tramp-compat-delete-file filename)))
+  (unless (eq op 'copy) (delete-file filename)))
 
 (defun tramp-do-copy-or-rename-file-directly
  (op filename newname ok-if-already-exists keep-date preserve-uid-gid)
@@ -3924,7 +3924,7 @@
 
 		;; Save exit.
 		(condition-case nil
-		    (tramp-compat-delete-file tmpfile)
+		    (delete-file tmpfile)
 		  (error)))))))))
 
       ;; Set the time and mode. Mask possible errors.
@@ -3964,7 +3964,7 @@
 		  (if dir-flag
 		      (tramp-compat-delete-directory
 		       (expand-file-name ".." tmpfile) 'recursive)
-		    (tramp-compat-delete-file tmpfile))
+		    (delete-file tmpfile))
 		(error))))
 
 	;; Expand hops.  Might be necessary for gateway methods.
@@ -4082,7 +4082,7 @@
       ;; If the operation was `rename', delete the original file.
       (unless (eq op 'copy)
 	(if (file-regular-p filename)
-	    (tramp-compat-delete-file filename)
+	    (delete-file filename)
 	  (tramp-compat-delete-directory filename 'recursive))))))
 
 (defun tramp-handle-make-directory (dir &optional parents)
@@ -4114,6 +4114,7 @@
 
 (defun tramp-handle-delete-file (filename &optional trash)
   "Like `delete-file' for Tramp files."
+  ;; TRASH needs to be implemented.  See `move-file-to-trash'.
   (setq filename (expand-file-name filename))
   (with-parsed-tramp-file-name filename nil
     (tramp-flush-file-property v (file-name-directory localname))
@@ -4629,7 +4630,7 @@
 
       ;; Cleanup.  We remove all file cache values for the connection,
       ;; because the remote process could have changed them.
-      (when tmpinput (tramp-compat-delete-file tmpinput))
+      (when tmpinput (delete-file tmpinput))
 
       ;; `process-file-side-effects' has been introduced with GNU
       ;; Emacs 23.2.  If set to `nil', no remote file will be changed
@@ -4666,7 +4667,7 @@
     (when delete (delete-region start end))
     (unwind-protect
 	(apply 'call-process program tmpfile buffer display args)
-      (tramp-compat-delete-file tmpfile))))
+      (delete-file tmpfile))))
 
 (defun tramp-handle-shell-command
   (command &optional output-buffer error-buffer)
@@ -4731,7 +4732,7 @@
 	(when (listp buffer)
 	  (with-current-buffer error-buffer
 	    (insert-file-contents (cadr buffer)))
-	  (tramp-compat-delete-file (cadr buffer)))
+	  (delete-file (cadr buffer)))
 	(if current-buffer-p
 	    ;; This is like exchange-point-and-mark, but doesn't
 	    ;; activate the mark.  It is cleaner to avoid activation,
@@ -4813,7 +4814,7 @@
 		    (unwind-protect
 			(tramp-call-local-coding-command
 			 loc-dec tmpfile2 tmpfile)
-		      (tramp-compat-delete-file tmpfile2)))))
+		      (delete-file tmpfile2)))))
 
 	      ;; Set proper permissions.
 	      (set-file-modes tmpfile (tramp-default-file-modes filename))
@@ -4826,7 +4827,7 @@
 
 	;; Error handling.
 	((error quit)
-	 (tramp-compat-delete-file tmpfile)
+	 (delete-file tmpfile)
 	 (signal (car err) (cdr err))))
 
       (run-hooks 'tramp-handle-file-local-copy-hook)
@@ -4961,9 +4962,9 @@
 	    (set-buffer-modified-p nil))
 	  (when (and (stringp local-copy)
 		     (or remote-copy (null tramp-temp-buffer-file-name)))
-	    (tramp-compat-delete-file local-copy))
+	    (delete-file local-copy))
 	  (when (stringp remote-copy)
-	    (tramp-compat-delete-file
+	    (delete-file
 	     (tramp-make-tramp-file-name method user host remote-copy))))))
 
     ;; Result.
@@ -5154,7 +5155,7 @@
 		 (list start end tmpfile append 'no-message lockname confirm))
 	      ((error quit)
 	       (setq tramp-temp-buffer-file-name nil)
-	       (tramp-compat-delete-file tmpfile)
+	       (delete-file tmpfile)
 	       (signal (car err) (cdr err))))
 
 	    ;; Now, `last-coding-system-used' has the right value.  Remember it.
@@ -5198,13 +5199,13 @@
 			(copy-file tmpfile filename t)
 		      ((error quit)
 		       (setq tramp-temp-buffer-file-name nil)
-		       (tramp-compat-delete-file tmpfile)
+		       (delete-file tmpfile)
 		       (signal (car err) (cdr err)))))
 		(setq tramp-temp-buffer-file-name nil)
 		;; Don't rename, in order to keep context in SELinux.
 		(unwind-protect
 		    (copy-file tmpfile filename t)
-		  (tramp-compat-delete-file tmpfile))))
+		  (delete-file tmpfile))))
 
 	     ;; Use inline file transfer.
 	     (rem-dec
@@ -5289,7 +5290,7 @@
 			  filename rem-dec)))))
 
 		;; Save exit.
-		(tramp-compat-delete-file tmpfile)))
+		(delete-file tmpfile)))
 
 	     ;; That's not expected.
 	     (t
@@ -6372,7 +6373,7 @@
   "Remove temporary files related to current buffer."
   (when (stringp tramp-temp-buffer-file-name)
     (condition-case nil
-	(tramp-compat-delete-file tramp-temp-buffer-file-name)
+	(delete-file tramp-temp-buffer-file-name)
       (error nil))))
 
 (add-hook 'kill-buffer-hook 'tramp-delete-temp-file-function)