(defun delete-file (filename &optional trash)
"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.q
+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.
(null current-prefix-arg)))
(if (and (file-directory-p filename) (not (file-symlink-p filename)))
(signal 'file-error (list "Removing old name: is a directory" filename)))
- (let* ((filename (expand-file-name filename)) (handler (find-file-name-handler filename 'delete-file)))
+ (let* ((handler (find-file-name-handler filename 'delete-file)))
(cond (handler (funcall handler 'delete-file filename trash))
((and delete-by-moving-to-trash trash) (move-file-to-trash filename))
(t (delete-file-internal filename)))))
}
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.
+ doc: /* Delete file named FILENAME; internal use only.
+If it is a symlink, remove the symlink.
If file has multiple names, it continues to exist with the other names. */)
(Lisp_Object filename)
{
Lisp_Object encoded_file;
+ filename = Fexpand_file_name (filename, Qnil);
encoded_file = ENCODE_FILE (filename);
if (unlink (SSDATA (encoded_file)) != 0 && errno != ENOENT)
{
Lisp_Object tem;
- tem = internal_condition_case_2 (Fdelete_file, filename, Qnil,
+ tem = internal_condition_case_2 (Fdelete_file_internal, filename,
Qt, internal_delete_file_1);
return NILP (tem);
}