diff --git a/src/ChangeLog b/src/ChangeLog index c9241258c2272dbc48818e0839484653a31fed02..55d4ce23f82353bdcb0369d582e9a4b69252eea5 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2008-09-20 Glenn Morris + + * fileio.c (Frename_file): Avoid copying to trash if a rename involves + a delete. (Bug#964). + 2008-09-20 Eli Zaretskii * keyboard.c (Fset_quit_char, Fset_input_meta_mode) diff --git a/src/fileio.c b/src/fileio.c index a5541d544f24aa330d339dfb5e33cbed61551151..6a9364d37bc542b3a1a5dd6e657f56d34c7715b7 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -2231,6 +2231,7 @@ This is what happens in interactive use with M-x. */) { if (errno == EXDEV) { + int count; #ifdef S_IFLNK symlink_target = Ffile_symlink_p (file); if (! NILP (symlink_target)) @@ -2244,7 +2245,10 @@ This is what happens in interactive use with M-x. */) NILP (ok_if_already_exists) ? Qnil : Qt, Qt, Qt); + count = SPECPDL_INDEX (); + specbind (intern ("delete-by-moving-to-trash"), Qnil); Fdelete_file (file); + unbind_to (count, Qnil); } else report_file_error ("Renaming", list2 (file, newname));