[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] /srv/bzr/emacs/trunk r99390: Fix rename-file to handle dir
From: |
Chong Yidong |
Subject: |
[Emacs-diffs] /srv/bzr/emacs/trunk r99390: Fix rename-file to handle directory renaming properly (Bug#3353). |
Date: |
Tue, 26 Jan 2010 23:08:41 -0500 |
User-agent: |
Bazaar (2.0.2) |
------------------------------------------------------------
revno: 99390
committer: Chong Yidong <address@hidden>
branch nick: trunk
timestamp: Tue 2010-01-26 23:08:41 -0500
message:
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.
modified:
src/ChangeLog
src/fileio.c
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog 2010-01-25 07:45:12 +0000
+++ b/src/ChangeLog 2010-01-27 04:08:41 +0000
@@ -1,3 +1,9 @@
+2010-01-27 David De La Harpe Golden <address@hidden>
+
+ * 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 <address@hidden>
* 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 <address@hidden> (tiny change)
+2008-06-10 David De La Harpe Golden <address@hidden>
* xterm.c (x_underline_minimum_display_offset): New var.
(x_draw_glyph_string): Use it.
=== modified file 'src/fileio.c'
--- a/src/fileio.c 2010-01-13 04:33:42 +0000
+++ b/src/fileio.c 2010-01-27 04:08:41 +0000
@@ -215,6 +215,12 @@
/* 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 @@
&& (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 @@
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 @@
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);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] /srv/bzr/emacs/trunk r99390: Fix rename-file to handle directory renaming properly (Bug#3353).,
Chong Yidong <=