Subject: bug#12488: closed (Re: bug#12488: 24.2.50; vc-delete-file and vc-rename-file should default to the current buffer's file)

From: [email-masked] (GNU bug Tracking System)
Date: Sun, 02 Dec 2012 21:20:02 +0000

Your bug report

#12488: 24.2.50; vc-delete-file and vc-rename-file should default to the current buffer's file

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
12488: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=12488
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#12488: 24.2.50; vc-delete-file and vc-rename-file should default to the current buffer's file
From: Dmitry Gutov <[email-masked]>
To: Chong Yidong <[email-masked]>
Cc: [email-masked]
Date: Mon, 03 Dec 2012 01:17:27 +0400
List-Id: <debbugs-submit.debbugs.gnu.org>

On 01.12.2012 10:05, Chong Yidong wrote:
> Dmitry Gutov <[email-masked]> writes:
>
>> Do you think I can add commands like `vc-rename-this-file' and
>> vc-delete-this-file' instead? And then replace `vc-rename-file' in VC
>> menu with the first one and add the second one below it?
>>
>> Because `vc-rename-file' is likely the only command in that menu that
>> acts on a single file, but does't automatically use the one the
>> current buffer visits.
>
> I'd rather not have this kind of duplication of commands.  It's more
> consistent with other Emacs commands to offer the current file as the
> minibuffer default.

Ok, I installed the original patch with updated docstrings.

Subject: 24.2.50; vc-delete-file and vc-rename-file should default to the current buffer's file
From: Dmitry Gutov <[email-masked]>
To: [email-masked]
Date: Sat, 22 Sep 2012 22:00:56 +0400
List-Id: <debbugs-submit.debbugs.gnu.org>

Tags: patch

Can I go ahead and install this?

=== modified file 'lisp/ChangeLog'
--- lisp/ChangeLog	2012-09-22 15:24:26 +0000
+++ lisp/ChangeLog	2012-09-22 17:55:12 +0000
@@ -1,3 +1,8 @@
+2012-09-22  Dmitry Gutov  <[email-masked]>
+
+	* vc/vc.el (vc-delete-file, vc-rename-file): Default to the
+	current buffer's file name if it's under version control.
+
  2012-09-22  Chong Yidong  <[email-masked]>

  	* repeat.el (repeat): Doc fix (Bug#12348).

=== modified file 'lisp/vc/vc.el'
--- lisp/vc/vc.el	2012-09-13 18:23:33 +0000
+++ lisp/vc/vc.el	2012-09-22 17:56:40 +0000
@@ -2562,8 +2562,11 @@

  ;;;###autoload
  (defun vc-delete-file (file)
-  "Delete file and mark it as such in the version control system."
-  (interactive "fVC delete file: ")
+  "Delete file and mark it as such in the version control system.
+Default to the current buffer's file name if it's under version control."
+  (interactive (list (read-file-name "VC delete file: " nil
+                                     (when (vc-backend buffer-file-name)
+                                       buffer-file-name) t)))
    (setq file (expand-file-name file))
    (let ((buf (get-file-buffer file))
          (backend (vc-backend file)))
@@ -2601,8 +2604,12 @@

  ;;;###autoload
  (defun vc-rename-file (old new)
-  "Rename file OLD to NEW in both work area and repository."
-  (interactive "fVC rename file: \nFRename to: ")
+  "Rename file OLD to NEW in both work area and repository.
+OLD defaults to the current buffer's file name if it's under version 
control."
+  (interactive (list (read-file-name "VC rename file: " nil
+                                     (when (vc-backend buffer-file-name)
+                                       buffer-file-name) t)
+                     (read-file-name "Rename 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))