Fix last change of 'delete-file'
* src/fileio.c (Fdelete_file_internal): Expand file name here, as all primitives must. (internal_delete_file): Adjust to the fact that Fdelete_file was renamed. * lisp/files.el (delete-file): Don't expand-file-name here, as the called primitives already do. Fix typo in doc string.
This commit is contained in:
parent
10a7615b5d
commit
400df210ce
2 changed files with 6 additions and 4 deletions
|
@ -6354,7 +6354,7 @@ non-nil and if FN fails due to a missing file or directory."
|
|||
|
||||
(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.
|
||||
|
||||
|
@ -6367,7 +6367,7 @@ With a prefix argument, TRASH is 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)))))
|
||||
|
|
|
@ -2463,12 +2463,14 @@ DEFUN ("delete-directory-internal", Fdelete_directory_internal,
|
|||
}
|
||||
|
||||
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)
|
||||
|
@ -2492,7 +2494,7 @@ internal_delete_file (Lisp_Object filename)
|
|||
{
|
||||
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);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue