unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#12488: 24.2.50; vc-delete-file and vc-rename-file should default to the current buffer's file
@ 2012-09-22 18:00 Dmitry Gutov
  2012-11-30  4:31 ` Chong Yidong
  0 siblings, 1 reply; 5+ messages in thread
From: Dmitry Gutov @ 2012-09-22 18:00 UTC (permalink / raw)
  To: 12488

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





^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#12488: 24.2.50; vc-delete-file and vc-rename-file should default to the current buffer's file
  2012-09-22 18:00 bug#12488: 24.2.50; vc-delete-file and vc-rename-file should default to the current buffer's file Dmitry Gutov
@ 2012-11-30  4:31 ` Chong Yidong
  2012-11-30 21:26   ` Dmitry Gutov
  0 siblings, 1 reply; 5+ messages in thread
From: Chong Yidong @ 2012-11-30  4:31 UTC (permalink / raw)
  To: Dmitry Gutov; +Cc: 12488

Dmitry Gutov <dgutov@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.





^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#12488: 24.2.50; vc-delete-file and vc-rename-file should default to the current buffer's file
  2012-11-30  4:31 ` Chong Yidong
@ 2012-11-30 21:26   ` Dmitry Gutov
  2012-12-01  6:05     ` Chong Yidong
  0 siblings, 1 reply; 5+ messages in thread
From: Dmitry Gutov @ 2012-11-30 21:26 UTC (permalink / raw)
  To: Chong Yidong; +Cc: 12488

Hi Chong,

On 30.11.2012 8:31, Chong Yidong wrote:
> Dmitry Gutov <dgutov@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.





^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#12488: 24.2.50; vc-delete-file and vc-rename-file should default to the current buffer's file
  2012-11-30 21:26   ` Dmitry Gutov
@ 2012-12-01  6:05     ` Chong Yidong
  2012-12-02 21:17       ` Dmitry Gutov
  0 siblings, 1 reply; 5+ messages in thread
From: Chong Yidong @ 2012-12-01  6:05 UTC (permalink / raw)
  To: Dmitry Gutov; +Cc: 12488

Dmitry Gutov <dgutov@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.





^ permalink raw reply	[flat|nested] 5+ messages in thread

* bug#12488: 24.2.50; vc-delete-file and vc-rename-file should default to the current buffer's file
  2012-12-01  6:05     ` Chong Yidong
@ 2012-12-02 21:17       ` Dmitry Gutov
  0 siblings, 0 replies; 5+ messages in thread
From: Dmitry Gutov @ 2012-12-02 21:17 UTC (permalink / raw)
  To: Chong Yidong; +Cc: 12488-done

On 01.12.2012 10:05, Chong Yidong wrote:
> Dmitry Gutov <dgutov@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.





^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2012-12-02 21:17 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-09-22 18:00 bug#12488: 24.2.50; vc-delete-file and vc-rename-file should default to the current buffer's file Dmitry Gutov
2012-11-30  4:31 ` Chong Yidong
2012-11-30 21:26   ` Dmitry Gutov
2012-12-01  6:05     ` Chong Yidong
2012-12-02 21:17       ` Dmitry Gutov

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).