From 7715d133347319dc8585601ac783faf2ee566f9d Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sat, 4 May 2013 09:12:04 +0100 Subject: Emacs: rename-current-buffer-file should use vc-rename-file when appropriate --- emacs/init.el | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/emacs/init.el b/emacs/init.el index c1407ac..41f9821 100644 --- a/emacs/init.el +++ b/emacs/init.el @@ -354,12 +354,14 @@ (let ((new-name (read-file-name "New name: " filename))) (if (get-buffer new-name) (error "A buffer named '%s' already exists!" new-name) - (rename-file filename new-name 1) - (rename-buffer new-name) - (set-visited-file-name new-name) - (set-buffer-modified-p nil) - (message "File '%s' successfully renamed to '%s'" - name (file-name-nondirectory new-name))))))) + (cond + ((vc-backend filename) (vc-rename-file filename new-name)) + (t (rename-file filename new-name t) + (rename-buffer new-name) + (set-visited-file-name new-name) + (set-buffer-modified-p nil) + (message "File '%s' successfully renamed to '%s'" + name (file-name-nondirectory new-name))))))))) (defun delete-current-buffer-file () "Removes file connected to current buffer and kills buffer." -- cgit 1.4.1