GNU bug report logs - #12488
24.2.50; vc-delete-file and vc-rename-file should default to the current buffer's file

Previous Next

Package: emacs;

Reported by: Dmitry Gutov <dgutov <at> yandex.ru>

Date: Sat, 22 Sep 2012 18:03:01 UTC

Severity: wishlist

Tags: patch

Found in version 24.2.50

Done: Dmitry Gutov <dgutov <at> yandex.ru>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 12488 in the body.
You can then email your comments to 12488 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#12488; Package emacs. (Sat, 22 Sep 2012 18:03:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Dmitry Gutov <dgutov <at> yandex.ru>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sat, 22 Sep 2012 18:03:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Dmitry Gutov <dgutov <at> yandex.ru>
To: bug-gnu-emacs <at> gnu.org
Subject: 24.2.50; vc-delete-file and vc-rename-file should default to the
	current buffer's file
Date: Sat, 22 Sep 2012 22:00:56 +0400
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  <dgutov <at> yandex.ru>
+
+	* 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  <cyd <at> gnu.org>

 	* 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))




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#12488; Package emacs. (Fri, 30 Nov 2012 04:34:02 GMT) Full text and rfc822 format available.

Message #8 received at 12488 <at> debbugs.gnu.org (full text, mbox):

From: Chong Yidong <cyd <at> gnu.org>
To: Dmitry Gutov <dgutov <at> yandex.ru>
Cc: 12488 <at> debbugs.gnu.org
Subject: Re: bug#12488: 24.2.50;
	vc-delete-file and vc-rename-file should default to the current
	buffer's file
Date: Fri, 30 Nov 2012 12:31:41 +0800
Dmitry Gutov <dgutov <at> yandex.ru> writes:

> +Default to the current buffer's file name if it's under version control."

> +OLD defaults to the current buffer's file name if it's under version
>  control."

These seem to imply that the current buffer's name is always used if
it's under version control, rather than simply being the default for
reading the file name.  It should instead say something like "If called
interactively, read FILE, defaulting to ..."

Otherwise the patch looks OK for the trunk.  Thanks.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#12488; Package emacs. (Fri, 30 Nov 2012 21:29:01 GMT) Full text and rfc822 format available.

Message #11 received at 12488 <at> debbugs.gnu.org (full text, mbox):

From: Dmitry Gutov <dgutov <at> yandex.ru>
To: Chong Yidong <cyd <at> gnu.org>
Cc: 12488 <at> debbugs.gnu.org
Subject: Re: bug#12488: 24.2.50; vc-delete-file and vc-rename-file should
	default to the current buffer's file
Date: Sat, 01 Dec 2012 01:26:39 +0400
Hi Chong,

On 30.11.2012 8:31, Chong Yidong wrote:
> Dmitry Gutov <dgutov <at> yandex.ru> writes:
>
>> +Default to the current buffer's file name if it's under version control."
>
>> +OLD defaults to the current buffer's file name if it's under version
>>   control."
>
> These seem to imply that the current buffer's name is always used if
> it's under version control, rather than simply being the default for
> reading the file name.  It should instead say something like "If called
> interactively, read FILE, defaulting to ..."
>
> Otherwise the patch looks OK for the trunk.  Thanks.

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.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#12488; Package emacs. (Sat, 01 Dec 2012 06:09:02 GMT) Full text and rfc822 format available.

Message #14 received at 12488 <at> debbugs.gnu.org (full text, mbox):

From: Chong Yidong <cyd <at> gnu.org>
To: Dmitry Gutov <dgutov <at> yandex.ru>
Cc: 12488 <at> debbugs.gnu.org
Subject: Re: bug#12488: 24.2.50;
	vc-delete-file and vc-rename-file should default to the current
	buffer's file
Date: Sat, 01 Dec 2012 14:05:49 +0800
Dmitry Gutov <dgutov <at> yandex.ru> 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.




Reply sent to Dmitry Gutov <dgutov <at> yandex.ru>:
You have taken responsibility. (Sun, 02 Dec 2012 21:20:02 GMT) Full text and rfc822 format available.

Notification sent to Dmitry Gutov <dgutov <at> yandex.ru>:
bug acknowledged by developer. (Sun, 02 Dec 2012 21:20:02 GMT) Full text and rfc822 format available.

Message #19 received at 12488-done <at> debbugs.gnu.org (full text, mbox):

From: Dmitry Gutov <dgutov <at> yandex.ru>
To: Chong Yidong <cyd <at> gnu.org>
Cc: 12488-done <at> debbugs.gnu.org
Subject: Re: bug#12488: 24.2.50; vc-delete-file and vc-rename-file should
	default to the current buffer's file
Date: Mon, 03 Dec 2012 01:17:27 +0400
On 01.12.2012 10:05, Chong Yidong wrote:
> Dmitry Gutov <dgutov <at> yandex.ru> 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.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Mon, 31 Dec 2012 12:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 12 years and 127 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.