summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEli Zaretskii <eliz@gnu.org>2018-11-10 22:14:42 +0200
committerEli Zaretskii <eliz@gnu.org>2018-11-10 22:14:42 +0200
commit1a3d471d87ea459bc2c2d704c5578e6977e68e83 (patch)
tree40ff8ac7f9a27940786a8215dc7547713f495c47
parent663613a1c096080837066ebb8c8b67e85d66d648 (diff)
downloademacs-1a3d471d87ea459bc2c2d704c5578e6977e68e83.tar.gz
emacs-1a3d471d87ea459bc2c2d704c5578e6977e68e83.tar.bz2
emacs-1a3d471d87ea459bc2c2d704c5578e6977e68e83.zip
Make 'move-file-to-trash' behave according to the documentation
* lisp/files.el (move-file-to-trash): Behave like the doc string says: check whether 'system-move-file-to-trash' is defined before testing that 'trash-directory' is non-nil. (Bug#33335)
-rw-r--r--lisp/files.el8
1 files changed, 4 insertions, 4 deletions
diff --git a/lisp/files.el b/lisp/files.el
index ad032832ec5..0f0c7d1559a 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -7393,7 +7393,10 @@ Otherwise, trash FILENAME using the freedesktop.org conventions,
like the GNOME, KDE and XFCE desktop environments. Emacs only
moves files to \"home trash\", ignoring per-volume trashcans."
(interactive "fMove file to trash: ")
- (cond (trash-directory
+ ;; If `system-move-file-to-trash' is defined, use it.
+ (cond ((fboundp 'system-move-file-to-trash)
+ (system-move-file-to-trash filename))
+ (trash-directory
;; If `trash-directory' is non-nil, move the file there.
(let* ((trash-dir (expand-file-name trash-directory))
(fn (directory-file-name (expand-file-name filename)))
@@ -7412,9 +7415,6 @@ Otherwise, trash FILENAME using the freedesktop.org conventions,
(setq new-fn (car (find-backup-file-name new-fn)))))
(let (delete-by-moving-to-trash)
(rename-file fn new-fn))))
- ;; If `system-move-file-to-trash' is defined, use it.
- ((fboundp 'system-move-file-to-trash)
- (system-move-file-to-trash filename))
;; Otherwise, use the freedesktop.org method, as specified at
;; http://freedesktop.org/wiki/Specifications/trash-spec
(t