diff options
author | Michael Albinus <michael.albinus@gmx.de> | 2010-05-05 12:20:23 +0200 |
---|---|---|
committer | Michael Albinus <michael.albinus@gmx.de> | 2010-05-05 12:20:23 +0200 |
commit | 66bdc86806b8995b0c321d21260056a1b64270b8 (patch) | |
tree | 0d25ac2484675a1351b7d24a8811ea2e68e9938e /lisp/net/tramp-compat.el | |
parent | 365f8d856c11b0684817aec977905b8831d4d973 (diff) | |
download | emacs-66bdc86806b8995b0c321d21260056a1b64270b8.tar.gz emacs-66bdc86806b8995b0c321d21260056a1b64270b8.tar.bz2 emacs-66bdc86806b8995b0c321d21260056a1b64270b8.zip |
Add FORCE argument to `delete-file'.
* net/ange-ftp.el (ange-ftp-del-tmp-name): Make it a defun,
forcing to delete the temporary file.
(ange-ftp-delete-file): Add FORCE arg.
(ange-ftp-rename-remote-to-remote)
(ange-ftp-rename-local-to-remote, ange-ftp-rename-remote-to-local)
(ange-ftp-load, ange-ftp-compress, ange-ftp-uncompress): Force
file deletion.
* net/tramp-compat.el (tramp-compat-delete-file): New defun.
* net/tramp.el (tramp-handle-delete-file): Add FORCE arg.
(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 `tramp-compat-delete-file'.
* net/tramp-fish.el (tramp-fish-handle-delete-file): Add FORCE arg.
(tramp-fish-handle-make-symbolic-link)
(tramp-fish-handle-process-file): Use `tramp-compat-delete-file'.
* net/tramp-ftp.el (tramp-ftp-file-name-handler): Use
`tramp-compat-delete-file'.
* net/tramp-gvfs.el (tramp-gvfs-handle-delete-file): Add FORCE arg.
(tramp-gvfs-handle-write-region): Use `tramp-compat-delete-file'.
* net/tramp-imap.el (tramp-imap-handle-delete-file): Add FORCE arg.
(tramp-imap-do-copy-or-rename-file): Use `tramp-compat-delete-file'.
* net/tramp-smb.el (tramp-smb-handle-delete-file): Add FORCE arg.
(tramp-smb-handle-copy-file, tramp-smb-handle-file-local-copy)
(tramp-smb-handle-rename-file, tramp-smb-handle-write-region): Use
`tramp-compat-delete-file'.
Diffstat (limited to 'lisp/net/tramp-compat.el')
-rw-r--r-- | lisp/net/tramp-compat.el | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/lisp/net/tramp-compat.el b/lisp/net/tramp-compat.el index 2d8f7535db0..fe4b3d4146a 100644 --- a/lisp/net/tramp-compat.el +++ b/lisp/net/tramp-compat.el @@ -317,6 +317,17 @@ Add the extension of FILENAME, if existing." (if keep-time (set-file-times newname (nth 5 (file-attributes directory)))))))) +;; FORCE has been introduced with Emacs 24.1. +(defun tramp-compat-delete-file (filename &optional force) + "Like `delete-file' for Tramp files (compat function)." + (condition-case nil + (funcall (symbol-function 'delete-file) filename force) + ;; This Emacs version does not support the FORCE flag. Setting + ;; `delete-by-moving-to-trash' shall give us the same effect. + (error + (let ((delete-by-moving-to-trash (null force))) + (delete-file filename))))) + ;; RECURSIVE has been introduced with Emacs 23.2. (defun tramp-compat-delete-directory (directory &optional recursive) "Like `delete-directory' for Tramp files (compat function)." |