# HG changeset patch # User Glenn Morris # Date 1221946854 0 # Node ID 75edb944833f89276d0019c23a2dd0717c82b8a9 # Parent 99266150cba5ae581e13620fe59e5f6abd3a6eb0 (Frename_file): Avoid copying to trash if a rename involves a delete. (Bug#964). diff -r 99266150cba5 -r 75edb944833f src/fileio.c --- a/src/fileio.c Sat Sep 20 21:29:03 2008 +0000 +++ b/src/fileio.c Sat Sep 20 21:40:54 2008 +0000 @@ -2231,6 +2231,7 @@ { if (errno == EXDEV) { + int count; #ifdef S_IFLNK symlink_target = Ffile_symlink_p (file); if (! NILP (symlink_target)) @@ -2244,7 +2245,10 @@ 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));