From 260c15b4b936e4673d066abf6a93f124ef1c8566 Mon Sep 17 00:00:00 2001 From: Sam Steingold Date: Thu, 12 Jun 2008 16:56:43 +0000 Subject: [PATCH] (vc-rename-file): DTRT when the destination is a directory name and the source is a file. --- lisp/ChangeLog | 5 +++++ lisp/vc.el | 5 +++++ 2 files changed, 10 insertions(+) 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 + + * 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 --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")) -- 2.39.2