emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

emacs-29 a54c7a8df0: Remove file-exists-in-trash-p


From: Paul Eggert
Subject: emacs-29 a54c7a8df0: Remove file-exists-in-trash-p
Date: Sat, 17 Dec 2022 17:53:29 -0500 (EST)

branch: emacs-29
commit a54c7a8df0ce08c1799bee48dca5e6a022fa0228
Author: Paul Eggert <eggert@cs.ucla.edu>
Commit: Paul Eggert <eggert@cs.ucla.edu>

    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.
---
 lisp/files.el | 14 +++-----------
 1 file changed, 3 insertions(+), 11 deletions(-)

diff --git a/lisp/files.el b/lisp/files.el
index cc7d7e2af9..f352d3a9a7 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."
 
 (declare-function system-move-file-to-trash "w32fns.c" (filename))
 
-(defun file-exists-in-trash-p (filename)
-  "Return non-nil if FILENAME exists in the trash.
-
-This is like `file-exists-p', but it also returns non-nil
-if FILENAME is a dangling symlink, to allow trashing such files."
-  (or (file-exists-p filename)
-      (file-symlink-p filename)))
-
 (defun move-file-to-trash (filename)
   "Move the file (or directory) named FILENAME to the trash.
 When `delete-by-moving-to-trash' is non-nil, this function is
@@ -8517,7 +8509,7 @@ Otherwise, trash FILENAME using the freedesktop.org 
conventions,
           (unless (file-directory-p trash-dir)
             (make-directory trash-dir t))
           ;; Ensure that the trashed file-name is unique.
-          (if (file-exists-in-trash-p new-fn)
+          (if (file-attributes new-fn)
               (let ((version-control t)
                     (backup-directory-alist nil))
                 (setq new-fn (car (find-backup-file-name new-fn)))))
@@ -8594,7 +8586,7 @@ Otherwise, trash FILENAME using the freedesktop.org 
conventions,
                  ;; We're checking further down whether the info file
                  ;; exists, but the file name may exist in the trash
                  ;; directory even if there is no info file for it.
-                 (when (file-exists-in-trash-p
+                 (when (file-attributes
                         (file-name-concat trash-files-dir files-base))
                    (setq overwrite t
                          files-base (file-name-nondirectory
@@ -8632,7 +8624,7 @@ Otherwise, trash FILENAME using the freedesktop.org 
conventions,
                 (let ((delete-by-moving-to-trash nil)
                       (new-fn (file-name-concat trash-files-dir files-base)))
                    (if (or (not is-directory)
-                           (not (file-exists-in-trash-p new-fn)))
+                           (not (file-attributes new-fn)))
                        (rename-file fn new-fn overwrite)
                      (copy-directory fn
                                      (file-name-as-directory new-fn)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]