From: Sean Whitton Date: Fri, 25 Jul 2025 17:45:59 +0000 (+0100) Subject: Bind vc-rename-file to C-x v R X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=b2b516d3f8d7afe40d2e6cef10c35706d5112b7b;p=emacs.git Bind vc-rename-file to C-x v R * lisp/vc/vc-hooks.el (vc-prefix-map): Bind vc-rename-file to C-x v R. * doc/emacs/files.texi (Copying and Naming): * doc/emacs/vc1-xtra.texi (VC Delete/Rename, Revision Tags): * etc/NEWS (bindings): Document the new binding. (cherry picked from commit 09e205fe60f074e143298e306431cb62b60a890c) --- diff --git a/doc/emacs/files.texi b/doc/emacs/files.texi index 08384e8f729..5abaab0d3b0 100644 --- a/doc/emacs/files.texi +++ b/doc/emacs/files.texi @@ -1993,7 +1993,7 @@ different file systems, the file @var{old} is copied and deleted. @ifnottex If a file is under version control (@pxref{Version Control}), you -should rename it using @w{@kbd{M-x vc-rename-file}} instead of +should rename it using @w{@kbd{C-x v R}} instead of @w{@kbd{M-x rename-file}}. @xref{VC Delete/Rename}. @end ifnottex diff --git a/doc/emacs/vc1-xtra.texi b/doc/emacs/vc1-xtra.texi index 9b35c85fba4..cfa80db2b0b 100644 --- a/doc/emacs/vc1-xtra.texi +++ b/doc/emacs/vc1-xtra.texi @@ -111,21 +111,21 @@ entry. @cindex renaming version-controlled files @table @kbd -@item M-x vc-delete-file +@item C-x v x Prompt for a file name, delete the file from the working tree, and schedule the deletion for committing. -@item M-x vc-rename-file +@item C-x v R Prompt for two file names, @var{old} and @var{new}, rename them in the working tree, and schedule the renaming for committing. The @var{old} file defaults to the current buffer's file name if it is under VC. @end table @findex vc-delete-file - If you wish to delete a version-controlled file, use the command -@kbd{M-x vc-delete-file}. This prompts for the file name, and deletes -it via the version control system. The file is removed from the -working tree, and in the VC Directory buffer + If you wish to delete a version-controlled file, type @kbd{C-x v x} +(@code{vc-delete-file}). This prompts for the file name, and deletes it +via the version control system. The file is removed from the working +tree, and in the VC Directory buffer @iftex (@pxref{VC Directory Mode,,, emacs, the Emacs Manual}), @end iftex @@ -136,12 +136,12 @@ it is displayed with the @samp{removed} status. When you commit it, the deletion takes effect in the repository. @findex vc-rename-file - To rename a version-controlled file, type @kbd{M-x vc-rename-file}. -This prompts for two arguments: the name of the file you wish to -rename, and the new name; then it performs the renaming via the -version control system. The renaming takes effect immediately in the -working tree, and takes effect in the repository when you commit the -renamed file. + To rename a version-controlled file, type @kbd{C-x v R} +(@code{vc-rename-file}). This prompts for two arguments: the name of +the file you wish to rename, and the new name; then it performs the +renaming via the version control system. The renaming takes effect +immediately in the working tree, and takes effect in the repository when +you commit the renamed file. On modern version control systems that have built-in support for renaming, the renamed file retains the full change history of the @@ -205,7 +205,7 @@ those tags will be visible even when you bypass VC. In file-based version control systems, when you rename a registered file you need to rename its master along with it; the command -@code{vc-rename-file} will do this automatically +@kbd{C-x v R} (@code{vc-rename-file}) will do this automatically @iftex (@pxref{VC Delete/Rename,,,emacs, the Emacs Manual}). @end iftex @@ -213,12 +213,12 @@ file you need to rename its master along with it; the command (@pxref{VC Delete/Rename}). @end ifnottex If you are using SCCS, you must also update the records of the tag, to -mention the file by its new name (@code{vc-rename-file} does this, +mention the file by its new name (@kbd{C-x v R} does this, too). An old tag that refers to a master file that no longer exists under the recorded name is invalid; VC can no longer retrieve it. It would be beyond the scope of this manual to explain enough about RCS and SCCS to explain how to update the tags by hand. Using -@code{vc-rename-file} makes the tag remain valid for retrieval, but it +@kbd{C-x v R} makes the tag remain valid for retrieval, but it does not solve all problems. For example, some of the files in your program probably refer to others by name. At the very least, the makefile probably mentions the file that you renamed. If you retrieve diff --git a/lisp/vc/vc-hooks.el b/lisp/vc/vc-hooks.el index 3945e5c10cd..7907519346a 100644 --- a/lisp/vc/vc-hooks.el +++ b/lisp/vc/vc-hooks.el @@ -968,6 +968,7 @@ In the latter case, VC mode is deactivated for this buffer." "=" #'vc-diff "D" #'vc-root-diff "~" #'vc-revision-other-window + "R" #'vc-rename-file "x" #'vc-delete-file "!" #'vc-edit-next-command) (fset 'vc-prefix-map vc-prefix-map)