]> git.eshelyaron.com Git - emacs.git/commitdiff
(vc-rename-file): DTRT when the destination is a directory name and the source is...
authorSam Steingold <sds@gnu.org>
Thu, 12 Jun 2008 16:56:43 +0000 (16:56 +0000)
committerSam Steingold <sds@gnu.org>
Thu, 12 Jun 2008 16:56:43 +0000 (16:56 +0000)
lisp/ChangeLog
lisp/vc.el

index e0a8f6dbb7ede0731c5bab5511f327bff233414b..ef77c4312f253ebe764e4f744b943209f7f766fc 100644 (file)
@@ -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
index d334d0e081beae9e46b4bd4b561cdfda45320ed3..1d53b277677cbdede460cb4d7abd08977e4e2a03 100644 (file)
@@ -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"))