1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-12-25 10:47:00 +00:00

(vc-rename-file): DTRT when the destination is a directory name and the source is a file.

This commit is contained in:
Sam Steingold 2008-06-12 16:56:43 +00:00
parent a81a17c5fa
commit 260c15b4b9
2 changed files with 10 additions and 0 deletions

View 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

View 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"))