Commit 8719abec authored by Chong Yidong's avatar Chong Yidong

Fix rename-file to handle directory renaming properly (Bug#3353).

* fileio.c (Frename_file): Call copy-directory and delete-directory
for directories, in order to handle cross-device renaming.
parent 7d82a738
2010-01-27 David De La Harpe Golden <david@harpegolden.net>
* fileio.c (Frename_file): Call copy-directory and
delete-directory for directories, in order to handle cross-device
renaming (Bug#3353).
2010-01-25 Jan Djärv <jan.h.d@swipnet.se>
* xfns.c (Fx_create_frame): If frame height is too big, try
......@@ -9323,7 +9329,7 @@
(syms_of_xterm): Don't declare it any more.
(x_draw_glyph_string): Adjust to the new name.
2008-06-10 David De La Harpe Golden <david@harpegolden.net> (tiny change)
2008-06-10 David De La Harpe Golden <david@harpegolden.net>
* xterm.c (x_underline_minimum_display_offset): New var.
(x_draw_glyph_string): Use it.
......
......@@ -215,6 +215,12 @@ Lisp_Object Qdelete_by_moving_to_trash;
/* Lisp function for moving files to trash. */
Lisp_Object Qmove_file_to_trash;
/* Lisp function for recursively copying directories. */
Lisp_Object Qcopy_directory;
/* Lisp function for recursively deleting directories. */
Lisp_Object Qdelete_directory;
extern Lisp_Object Vuser_login_name;
#ifdef WINDOWSNT
......@@ -2241,7 +2247,11 @@ This is what happens in interactive use with M-x. */)
&& (NILP (Fstring_equal (Fdowncase (file), Fdowncase (newname))))
#endif
)
newname = Fexpand_file_name (Ffile_name_nondirectory (file), newname);
{
Lisp_Object fname = NILP (Ffile_directory_p (file))
? file : Fdirectory_file_name (file);
newname = Fexpand_file_name (Ffile_name_nondirectory (fname), newname);
}
else
newname = Fexpand_file_name (newname, Qnil);
......@@ -2279,15 +2289,21 @@ This is what happens in interactive use with M-x. */)
NILP (ok_if_already_exists) ? Qnil : Qt);
else
#endif
if (Ffile_directory_p (file))
call4 (Qcopy_directory, file, newname, Qt, Qnil);
else
/* We have already prompted if it was an integer, so don't
have copy-file prompt again. */
Fcopy_file (file, newname,
/* We have already prompted if it was an integer,
so don't have copy-file prompt again. */
NILP (ok_if_already_exists) ? Qnil : Qt,
Qt, Qt);
count = SPECPDL_INDEX ();
specbind (Qdelete_by_moving_to_trash, Qnil);
Fdelete_file (file);
if (Ffile_directory_p (file))
call2 (Qdelete_directory, file, Qt);
else
Fdelete_file (file);
unbind_to (count, Qnil);
}
else
......@@ -5727,6 +5743,10 @@ When non-nil, the function `move-file-to-trash' will be used by
Qdelete_by_moving_to_trash = intern_c_string ("delete-by-moving-to-trash");
Qmove_file_to_trash = intern_c_string ("move-file-to-trash");
staticpro (&Qmove_file_to_trash);
Qcopy_directory = intern_c_string ("copy-directory");
staticpro (&Qcopy_directory);
Qdelete_directory = intern_c_string ("delete-directory");
staticpro (&Qdelete_directory);
defsubr (&Sfind_file_name_handler);
defsubr (&Sfile_name_directory);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment