Mercurial > emacs
changeset 95853:174293e3d9fc
(vc-rename-file): DTRT when the destination is a directory name and the source is a file.
author | Sam Steingold <sds@gnu.org> |
---|---|
date | Thu, 12 Jun 2008 16:56:43 +0000 |
parents | 35f0faee6e04 |
children | 9ca85a90dfac |
files | lisp/ChangeLog lisp/vc.el |
diffstat | 2 files changed, 10 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/lisp/ChangeLog Thu Jun 12 15:30:04 2008 +0000 +++ b/lisp/ChangeLog Thu Jun 12 16:56:43 2008 +0000 @@ -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
--- a/lisp/vc.el Thu Jun 12 15:30:04 2008 +0000 +++ b/lisp/vc.el Thu Jun 12 16:56:43 2008 +0000 @@ -2497,6 +2497,11 @@ (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"))