From: Po Lu Date: Sun, 6 Aug 2023 13:45:44 +0000 (+0800) Subject: Merge remote-tracking branch 'origin/master' into feature/android X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=7ffc5f86e4636f9837a46ea75bee7475caaf5c04;p=emacs.git Merge remote-tracking branch 'origin/master' into feature/android --- 7ffc5f86e4636f9837a46ea75bee7475caaf5c04 diff --cc src/fileio.c index b37748b8225,e49a4a3836b..b815a1bdd79 --- a/src/fileio.c +++ b/src/fileio.c @@@ -2565,42 -2462,16 +2565,17 @@@ DEFUN ("delete-directory-internal", Fde return Qnil; } - DEFUN ("delete-file", Fdelete_file, Sdelete_file, 1, 2, - "(list (read-file-name \ - (if (and delete-by-moving-to-trash (null current-prefix-arg)) \ - \"Move file to trash: \" \"Delete file: \") \ - nil default-directory (confirm-nonexistent-file-or-buffer)) \ - (null current-prefix-arg))", + DEFUN ("delete-file-internal", Fdelete_file_internal, Sdelete_file_internal, 1, 1, 0, doc: /* Delete file named FILENAME. If it is a symlink, remove the symlink. - If file has multiple names, it continues to exist with the other names. - TRASH non-nil means to trash the file instead of deleting, provided - `delete-by-moving-to-trash' is non-nil. - - When called interactively, TRASH is t if no prefix argument is given. - With a prefix argument, TRASH is nil. */) - (Lisp_Object filename, Lisp_Object trash) + If file has multiple names, it continues to exist with the other names. */) + (Lisp_Object filename) { - Lisp_Object handler; Lisp_Object encoded_file; - if (!NILP (Ffile_directory_p (filename)) - && NILP (Ffile_symlink_p (filename))) - xsignal2 (Qfile_error, - build_string ("Removing old name: is a directory"), - filename); - filename = Fexpand_file_name (filename, Qnil); - - handler = Ffind_file_name_handler (filename, Qdelete_file); - if (!NILP (handler)) - return call3 (handler, Qdelete_file, filename, trash); - - if (delete_by_moving_to_trash && !NILP (trash)) - return call1 (Qmove_file_to_trash, filename); - encoded_file = ENCODE_FILE (filename); - if (unlink (SSDATA (encoded_file)) != 0 && errno != ENOENT) + if (emacs_unlink (SSDATA (encoded_file)) != 0 + && errno != ENOENT) report_file_error ("Removing old name", filename); return Qnil; }