aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Eggert2022-12-17 14:41:48 -0800
committerPaul Eggert2022-12-17 14:53:19 -0800
commita54c7a8df0ce08c1799bee48dca5e6a022fa0228 (patch)
tree0e9bbfb8e5cf237cc267ea5bdf363360e5a814bc
parent3e02029642c2c4c329c95d1a1381ab4a83a606b5 (diff)
downloademacs-a54c7a8df0ce08c1799bee48dca5e6a022fa0228.tar.gz
emacs-a54c7a8df0ce08c1799bee48dca5e6a022fa0228.zip
Remove file-exists-in-trash-p
* lisp/files.el (file-exists-in-trash-p): Remove, as this name is not suitable for users. All uses replaced by file-attributes, which is good enough here.
-rw-r--r--lisp/files.el14
1 files changed, 3 insertions, 11 deletions
diff --git a/lisp/files.el b/lisp/files.el
index cc7d7e2af94..f352d3a9a7e 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -8479,14 +8479,6 @@ If the value is nil, Emacs uses a freedesktop.org-style trashcan."
8479 8479
8480(declare-function system-move-file-to-trash "w32fns.c" (filename)) 8480(declare-function system-move-file-to-trash "w32fns.c" (filename))
8481 8481
8482(defun file-exists-in-trash-p (filename)
8483 "Return non-nil if FILENAME exists in the trash.
8484
8485This is like `file-exists-p', but it also returns non-nil
8486if FILENAME is a dangling symlink, to allow trashing such files."
8487 (or (file-exists-p filename)
8488 (file-symlink-p filename)))
8489
8490(defun move-file-to-trash (filename) 8482(defun move-file-to-trash (filename)
8491 "Move the file (or directory) named FILENAME to the trash. 8483 "Move the file (or directory) named FILENAME to the trash.
8492When `delete-by-moving-to-trash' is non-nil, this function is 8484When `delete-by-moving-to-trash' is non-nil, this function is
@@ -8517,7 +8509,7 @@ Otherwise, trash FILENAME using the freedesktop.org conventions,
8517 (unless (file-directory-p trash-dir) 8509 (unless (file-directory-p trash-dir)
8518 (make-directory trash-dir t)) 8510 (make-directory trash-dir t))
8519 ;; Ensure that the trashed file-name is unique. 8511 ;; Ensure that the trashed file-name is unique.
8520 (if (file-exists-in-trash-p new-fn) 8512 (if (file-attributes new-fn)
8521 (let ((version-control t) 8513 (let ((version-control t)
8522 (backup-directory-alist nil)) 8514 (backup-directory-alist nil))
8523 (setq new-fn (car (find-backup-file-name new-fn))))) 8515 (setq new-fn (car (find-backup-file-name new-fn)))))
@@ -8594,7 +8586,7 @@ Otherwise, trash FILENAME using the freedesktop.org conventions,
8594 ;; We're checking further down whether the info file 8586 ;; We're checking further down whether the info file
8595 ;; exists, but the file name may exist in the trash 8587 ;; exists, but the file name may exist in the trash
8596 ;; directory even if there is no info file for it. 8588 ;; directory even if there is no info file for it.
8597 (when (file-exists-in-trash-p 8589 (when (file-attributes
8598 (file-name-concat trash-files-dir files-base)) 8590 (file-name-concat trash-files-dir files-base))
8599 (setq overwrite t 8591 (setq overwrite t
8600 files-base (file-name-nondirectory 8592 files-base (file-name-nondirectory
@@ -8632,7 +8624,7 @@ Otherwise, trash FILENAME using the freedesktop.org conventions,
8632 (let ((delete-by-moving-to-trash nil) 8624 (let ((delete-by-moving-to-trash nil)
8633 (new-fn (file-name-concat trash-files-dir files-base))) 8625 (new-fn (file-name-concat trash-files-dir files-base)))
8634 (if (or (not is-directory) 8626 (if (or (not is-directory)
8635 (not (file-exists-in-trash-p new-fn))) 8627 (not (file-attributes new-fn)))
8636 (rename-file fn new-fn overwrite) 8628 (rename-file fn new-fn overwrite)
8637 (copy-directory fn 8629 (copy-directory fn
8638 (file-name-as-directory new-fn) 8630 (file-name-as-directory new-fn)