summaryrefslogtreecommitdiff
path: root/lisp/net/tramp-sudoedit.el
diff options
context:
space:
mode:
authorMichael Albinus <michael.albinus@gmx.de>2023-01-08 19:24:17 +0100
committerMichael Albinus <michael.albinus@gmx.de>2023-01-08 19:24:17 +0100
commitec105a45c9f8b56ade9e76324960a726eaf24038 (patch)
tree64471dbedd8f639a5dc15a2dbd6dd86f02ef61a9 /lisp/net/tramp-sudoedit.el
parent5d1e14bd8b9a11ab860937d3ab97248ddeef30b1 (diff)
downloademacs-ec105a45c9f8b56ade9e76324960a726eaf24038.tar.gz
Add remote-file-name-inhibit-delete-by-moving-to-trash
* doc/emacs/files.texi (Misc File Ops): * doc/lispref/files.texi (Changing Files): * doc/misc/tramp.texi (Frequently Asked Questions): * etc/NEWS: Explain remote-file-name-inhibit-delete-by-moving-to-trash. * lisp/files.el (remote-file-name-inhibit-delete-by-moving-to-trash): New defcustom. (Bug#60460) * lisp/net/ange-ftp.el (ange-ftp-delete-file): * lisp/net/tramp.el (tramp-skeleton-delete-directory): Handle `remote-file-name-inhibit-delete-by-moving-to-trash'. (tramp-skeleton-delete-file): New defmacro. * lisp/net/tramp-adb.el (tramp-adb-handle-delete-file): * lisp/net/tramp-fuse.el (tramp-fuse-handle-delete-file): * lisp/net/tramp-gvfs.el (tramp-gvfs-handle-delete-file): * lisp/net/tramp-sh.el (tramp-sh-handle-delete-file): * lisp/net/tramp-smb.el (tramp-smb-handle-delete-file): * lisp/net/tramp-sudoedit.el (tramp-sudoedit-handle-delete-file): Use it. * lisp/net/tramp-crypt.el (tramp-crypt-handle-delete-directory) (tramp-crypt-handle-delete-file): Rearrange. * lisp/net/tramp-fuse.el (tramp-fuse-handle-delete-directory): Use `tramp-skeleton-delete-directory'. * test/lisp/net/tramp-tests.el (remote-file-name-inhibit-delete-by-moving-to-trash): Declare. (tramp-test07-file-exists-p, tramp-test14-delete-directory) (tramp-test48-unload): Extend tests.
Diffstat (limited to 'lisp/net/tramp-sudoedit.el')
-rw-r--r--lisp/net/tramp-sudoedit.el19
1 files changed, 8 insertions, 11 deletions
diff --git a/lisp/net/tramp-sudoedit.el b/lisp/net/tramp-sudoedit.el
index c4e1d32f525..2660dbb1fac 100644
--- a/lisp/net/tramp-sudoedit.el
+++ b/lisp/net/tramp-sudoedit.el
@@ -347,17 +347,14 @@ absolute file names."
(defun tramp-sudoedit-handle-delete-file (filename &optional trash)
"Like `delete-file' for Tramp files."
- (with-parsed-tramp-file-name (expand-file-name filename) nil
- (tramp-flush-file-properties v localname)
- (if (and delete-by-moving-to-trash trash)
- (move-file-to-trash filename)
- (unless (tramp-sudoedit-send-command
- v "rm" "-f" (file-name-unquote localname))
- ;; Propagate the error.
- (with-current-buffer (tramp-get-connection-buffer v)
- (goto-char (point-min))
- (tramp-error-with-buffer
- nil v 'file-error "Couldn't delete %s" filename))))))
+ (tramp-skeleton-delete-file filename trash
+ (unless (tramp-sudoedit-send-command
+ v "rm" "-f" (file-name-unquote localname))
+ ;; Propagate the error.
+ (with-current-buffer (tramp-get-connection-buffer v)
+ (goto-char (point-min))
+ (tramp-error-with-buffer
+ nil v 'file-error "Couldn't delete %s" filename)))))
(defun tramp-sudoedit-handle-expand-file-name (name &optional dir)
"Like `expand-file-name' for Tramp files.