summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam Steingold <sds@gnu.org>2008-06-12 16:56:43 +0000
committerSam Steingold <sds@gnu.org>2008-06-12 16:56:43 +0000
commit260c15b4b936e4673d066abf6a93f124ef1c8566 (patch)
tree01d249fd5a4df41fe1ffaad9a4095042f342bd49
parenta81a17c5fab3f1f12faf500066f4a200e66c9283 (diff)
downloademacs-260c15b4b936e4673d066abf6a93f124ef1c8566.tar.gz
emacs-260c15b4b936e4673d066abf6a93f124ef1c8566.tar.bz2
emacs-260c15b4b936e4673d066abf6a93f124ef1c8566.zip
(vc-rename-file): DTRT when the destination is a directory name and the source is a file.
-rw-r--r--lisp/ChangeLog5
-rw-r--r--lisp/vc.el5
2 files changed, 10 insertions, 0 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index e0a8f6dbb7e..ef77c4312f2 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,8 @@
+2008-06-12 Sam Steingold <sds@gnu.org>
+
+ * vc.el (vc-rename-file): DTRT when the destination is a directory
+ name and the source is a file.
+
2008-06-12 Chong Yidong <cyd@stupidchicken.com>
* menu-bar.el (menu-set-font): Renamed x-font-dialog to
diff --git a/lisp/vc.el b/lisp/vc.el
index d334d0e081b..1d53b277677 100644
--- a/lisp/vc.el
+++ b/lisp/vc.el
@@ -2497,6 +2497,11 @@ backend to NEW-BACKEND, and unregister FILE from the current backend.
(defun vc-rename-file (old new)
"Rename file OLD to NEW, and rename its master file likewise."
(interactive "fVC rename file: \nFRename to: ")
+ ;; in CL I would have said (setq new (merge-pathnames new old))
+ (let ((old-base (file-name-nondirectory old)))
+ (when (and (not (string= "" old-base))
+ (string= "" (file-name-nondirectory new)))
+ (setq new (concat new old-base))))
(let ((oldbuf (get-file-buffer old)))
(when (and oldbuf (buffer-modified-p oldbuf))
(error "Please save files before moving them"))