From: Glenn Morris Date: Sat, 20 Sep 2008 21:41:05 +0000 (+0000) Subject: (Frename_file): Avoid copying to trash if a rename involves a delete. (Bug#964). X-Git-Tag: emacs-pretest-23.0.90~2825 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=6bddfc97687ba69eb9199f25a16197a1bd5cc3d3;p=emacs.git (Frename_file): Avoid copying to trash if a rename involves a delete. (Bug#964). --- diff --git a/src/ChangeLog b/src/ChangeLog index c9241258c22..55d4ce23f82 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 a5541d544f2..6a9364d37bc 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));