From: Michael Albinus Date: Fri, 28 May 2010 13:28:36 +0000 (+0200) Subject: * net/tramp-compat.el (tramp-compat-delete-file): Use X-Git-Tag: emacs-pretest-24.0.90~104^2~275^2~438^2~181 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=eba082a2e478ed9d1c53d313413835d80ea1a49c;p=emacs.git * 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. --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index bc80b4cafe0..2ef684ad12e 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,40 @@ +2010-05-28 Michael Albinus + + * 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 * dired.el (dired-delete-file): New arg TRASH. diff --git a/lisp/net/tramp-compat.el b/lisp/net/tramp-compat.el index 530a8693490..a1ec3c9b89d 100644 --- a/lisp/net/tramp-compat.el +++ b/lisp/net/tramp-compat.el @@ -343,7 +343,7 @@ Add the extension of FILENAME, if existing." (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))))) diff --git a/lisp/net/tramp-fish.el b/lisp/net/tramp-fish.el index db5c8ad0b48..632b400e2b3 100644 --- a/lisp/net/tramp-fish.el +++ b/lisp/net/tramp-fish.el @@ -326,14 +326,14 @@ pass to the OPERATION." (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 @@ target of the symlink differ." 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 @@ target of the symlink differ." ;; 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))) diff --git a/lisp/net/tramp-ftp.el b/lisp/net/tramp-ftp.el index ca421cbaaa6..4c373cbcd82 100644 --- a/lisp/net/tramp-ftp.el +++ b/lisp/net/tramp-ftp.el @@ -182,7 +182,7 @@ pass to the OPERATION." (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 diff --git a/lisp/net/tramp-gvfs.el b/lisp/net/tramp-gvfs.el index 25dae77544d..f62eca8922b 100644 --- a/lisp/net/tramp-gvfs.el +++ b/lisp/net/tramp-gvfs.el @@ -533,9 +533,9 @@ is no information where to trace the message.") (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 @@ is no information where to trace the message.") "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)) diff --git a/lisp/net/tramp-imap.el b/lisp/net/tramp-imap.el index de8e58e7491..3e8883d2e07 100644 --- a/lisp/net/tramp-imap.el +++ b/lisp/net/tramp-imap.el @@ -267,8 +267,7 @@ of `copy' and `rename'." (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) diff --git a/lisp/net/tramp-smb.el b/lisp/net/tramp-smb.el index 54cccb49053..9c4d991d0e1 100644 --- a/lisp/net/tramp-smb.el +++ b/lisp/net/tramp-smb.el @@ -345,7 +345,7 @@ PRESERVE-UID-GID is completely ignored." (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 @@ PRESERVE-UID-GID is completely ignored." (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 @@ PRESERVE-UID-GID is completely ignored." 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 @@ target of the symlink differ." (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 @@ target of the symlink differ." 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 @@ errors for shares like \"C$/\", which are common in Microsoft Windows." 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 diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index a1aed599ae9..c3db23d7bf2 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el @@ -2544,7 +2544,7 @@ target of the symlink differ." 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 @@ target of the symlink differ." ;; 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 @@ KEEP-DATE is non-nil if NEWNAME should have the same timestamp as FILENAME." ;; 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 @@ the uid and gid from FILENAME." ;; 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 @@ The method used must be an out-of-band method." (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 @@ The method used must be an out-of-band method." ;; 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 @@ The method used must be an out-of-band method." (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 @@ beginning of local filename are not substituted." ;; 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 @@ Lisp error raised when PROGRAM is nil is trapped also, returning 1." (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 @@ Lisp error raised when PROGRAM is nil is trapped also, returning 1." (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 @@ Lisp error raised when PROGRAM is nil is trapped also, returning 1." (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 @@ Lisp error raised when PROGRAM is nil is trapped also, returning 1." ;; 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 @@ coding system might not be determined. This function repairs it." (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 @@ Returns a file name in `tramp-auto-save-directory' for autosaving this file." (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 @@ Returns a file name in `tramp-auto-save-directory' for autosaving this file." (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 @@ Returns a file name in `tramp-auto-save-directory' for autosaving this file." filename rem-dec))))) ;; Save exit. - (tramp-compat-delete-file tmpfile))) + (delete-file tmpfile))) ;; That's not expected. (t @@ -6372,7 +6373,7 @@ hosts, or files, disagree." "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)