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;
}