# HG changeset patch # User Sam Steingold # Date 1213289803 0 # Node ID 174293e3d9fc65e0d57818c4116b1b431219eda8 # Parent 35f0faee6e04db80b6eef00fc0338e0a20f152f5 (vc-rename-file): DTRT when the destination is a directory name and the source is a file. diff -r 35f0faee6e04 -r 174293e3d9fc lisp/ChangeLog --- 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 + + * vc.el (vc-rename-file): DTRT when the destination is a directory + name and the source is a file. + 2008-06-12 Chong Yidong * menu-bar.el (menu-set-font): Renamed x-font-dialog to diff -r 35f0faee6e04 -r 174293e3d9fc lisp/vc.el --- 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"))