[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] master a26e33a: Fix Bug#26763
From: |
Michael Albinus |
Subject: |
[Emacs-diffs] master a26e33a: Fix Bug#26763 |
Date: |
Wed, 3 May 2017 15:49:41 -0400 (EDT) |
branch: master
commit a26e33a1a776affcbf8cdd012297d48999ba8e80
Author: Michael Albinus <address@hidden>
Commit: Michael Albinus <address@hidden>
Fix Bug#26763
* lisp/files.el (delete-directory): Call file name handler
with `trash' argument.
* lisp/net/ange-ftp.el (ange-ftp-delete-directory):
* lisp/net/tramp-sh.el (tramp-sh-handle-delete-directory):
Add TRASH arg. Implement it. (Bug#26763)
(tramp-get-remote-trash): Check for `delete-by-moving-to-trash'.
* lisp/net/tramp-adb.el (tramp-adb-handle-delete-directory):
* lisp/net/tramp-smb.el (tramp-smb-handle-delete-directory):
Add _TRASH arg.
---
lisp/files.el | 2 +-
lisp/net/ange-ftp.el | 8 ++++----
lisp/net/tramp-adb.el | 2 +-
lisp/net/tramp-sh.el | 15 +++++++++------
lisp/net/tramp-smb.el | 2 +-
5 files changed, 16 insertions(+), 13 deletions(-)
diff --git a/lisp/files.el b/lisp/files.el
index 0978fa2..d193749 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -5477,7 +5477,7 @@ RECURSIVE if DIRECTORY is nonempty."
(let ((handler (find-file-name-handler directory 'delete-directory)))
(cond
(handler
- (funcall handler 'delete-directory directory recursive))
+ (funcall handler 'delete-directory directory recursive trash))
((and delete-by-moving-to-trash trash)
;; Only move non-empty dir to trash if recursive deletion was
;; requested. This mimics the non-`delete-by-moving-to-trash'
diff --git a/lisp/net/ange-ftp.el b/lisp/net/ange-ftp.el
index cd0ae8d..7b8b3fc 100644
--- a/lisp/net/ange-ftp.el
+++ b/lisp/net/ange-ftp.el
@@ -4128,15 +4128,15 @@ directory, so that Emacs will know its current
contents."
(ange-ftp-add-file-entry dir t))
(ange-ftp-real-make-directory dir)))))
-(defun ange-ftp-delete-directory (dir &optional recursive)
+(defun ange-ftp-delete-directory (dir &optional recursive trash)
(if (file-directory-p dir)
(let ((parsed (ange-ftp-ftp-name dir)))
(if recursive
(mapc
(lambda (file)
(if (file-directory-p file)
- (ange-ftp-delete-directory file recursive)
- (delete-file file)))
+ (ange-ftp-delete-directory file recursive trash)
+ (delete-file file trash)))
;; We do not want to delete "." and "..".
(directory-files
dir 'full "^\\([^.]\\|\\.\\([^.]\\|\\..\\)\\).*")))
@@ -4170,7 +4170,7 @@ directory, so that Emacs will know its current contents."
dir
(cdr result))))
(ange-ftp-delete-file-entry dir t))
- (ange-ftp-real-delete-directory dir recursive)))
+ (ange-ftp-real-delete-directory dir recursive trash)))
(error "Not a directory: %s" dir)))
;; Make a local copy of FILE and return its name.
diff --git a/lisp/net/tramp-adb.el b/lisp/net/tramp-adb.el
index 240e017..a80bc0b 100644
--- a/lisp/net/tramp-adb.el
+++ b/lisp/net/tramp-adb.el
@@ -521,7 +521,7 @@ Emacs dired can't find files."
(tramp-flush-file-property v (file-name-directory localname))
(tramp-flush-directory-property v localname)))
-(defun tramp-adb-handle-delete-directory (directory &optional recursive)
+(defun tramp-adb-handle-delete-directory (directory &optional recursive _trash)
"Like `delete-directory' for Tramp files."
(setq directory (expand-file-name directory))
(with-parsed-tramp-file-name (file-truename directory) nil
diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el
index 475f2b9..71afb9a 100644
--- a/lisp/net/tramp-sh.el
+++ b/lisp/net/tramp-sh.el
@@ -2566,7 +2566,7 @@ The method used must be an out-of-band method."
(tramp-shell-quote-argument localname))
"Couldn't make directory %s" dir))))
-(defun tramp-sh-handle-delete-directory (directory &optional recursive)
+(defun tramp-sh-handle-delete-directory (directory &optional recursive trash)
"Like `delete-directory' for Tramp files."
(setq directory (expand-file-name directory))
(with-parsed-tramp-file-name directory nil
@@ -2574,7 +2574,8 @@ The method used must be an out-of-band method."
(tramp-flush-directory-property v localname)
(tramp-barf-unless-okay
v (format "cd / && %s %s"
- (if recursive "rm -rf" "rmdir")
+ (or (and trash (tramp-get-remote-trash v))
+ (if recursive "rm -rf" "rmdir"))
(tramp-shell-quote-argument localname))
"Couldn't delete %s" directory)))
@@ -5394,10 +5395,12 @@ Nonexistent directories are removed from spec."
result))))
(defun tramp-get-remote-trash (vec)
- "Determine remote `trash' command."
- (with-tramp-connection-property vec "trash"
- (tramp-message vec 5 "Finding a suitable `trash' command")
- (tramp-find-executable vec "trash" (tramp-get-remote-path vec))))
+ "Determine remote `trash' command.
+This command is returned only if `delete-by-moving-to-trash' is non-nil."
+ (and delete-by-moving-to-trash
+ (with-tramp-connection-property vec "trash"
+ (tramp-message vec 5 "Finding a suitable `trash' command")
+ (tramp-find-executable vec "trash" (tramp-get-remote-path vec)))))
(defun tramp-get-remote-touch (vec)
"Determine remote `touch' command."
diff --git a/lisp/net/tramp-smb.el b/lisp/net/tramp-smb.el
index 4205376..014e1e8 100644
--- a/lisp/net/tramp-smb.el
+++ b/lisp/net/tramp-smb.el
@@ -617,7 +617,7 @@ PRESERVE-UID-GID and PRESERVE-EXTENDED-ATTRIBUTES are
completely ignored."
(tramp-compat-file-attribute-modification-time
(file-attributes filename))))))
-(defun tramp-smb-handle-delete-directory (directory &optional recursive)
+(defun tramp-smb-handle-delete-directory (directory &optional recursive _trash)
"Like `delete-directory' for Tramp files."
(setq directory (directory-file-name (expand-file-name directory)))
(when (file-exists-p directory)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] master a26e33a: Fix Bug#26763,
Michael Albinus <=