1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-01-30 04:10:54 -08:00

New bindings for vc-revert

* lisp/vc/vc-dir.el (vc-dir-mode-map): Bind vc-revert to '@'.
* lisp/vc/vc-hooks.el (vc-prefix-map): Additionally bind
vc-revert to 'C-x v @'.
* doc/emacs/maintaining.texi (VC Undo, VC Directory Commands):
* etc/NEWS: Document the change.
This commit is contained in:
Sean Whitton 2026-01-23 14:11:27 +00:00
parent 644caa944d
commit 29bdba37f2
4 changed files with 30 additions and 15 deletions

View file

@ -1360,6 +1360,7 @@ also prompt for a specific VCS shell command to run for this purpose.
@table @kbd
@item C-x v u
@item C-x v @@
Revert the work file(s) in the current VC fileset to the last revision
(@code{vc-revert}).
@ -1374,24 +1375,25 @@ Delete an unpushed commit from the revision history.
@end table
@kindex C-x v u
@kindex C-x v @@
@findex vc-revert
@vindex vc-revert-show-diff
If you want to discard all the changes you have made to the current
VC fileset, type @kbd{C-x v u} (@code{vc-revert}). This will ask you
for confirmation before discarding the changes. If you agree, the
fileset is reverted.
If you want to discard all the changes you have made to the current VC
fileset, type @kbd{C-x v u} or @kbd{C-x v @@} (@code{vc-revert}). This
will ask you for confirmation before discarding the changes. If you
agree, the fileset is reverted.
If @code{vc-revert-show-diff} is non-@code{nil}, this command will
show you a diff between the work file(s) and the revision from which
you started editing. Afterwards, the diff buffer will either be
killed (if this variable is @code{kill}), or the buffer will be buried
(any other non-@code{nil} value). If you don't want @kbd{C-x v u} to
show a diff, set this variable to @code{nil} (you can still view the
diff directly with @kbd{C-x v =}; @pxref{Old Revisions}).
show you a diff between the work file(s) and the revision from which you
started editing. Afterwards, the diff buffer will either be killed (if
this variable is @code{kill}), or the buffer will be buried (any other
non-@code{nil} value). If you don't want @code{vc-revert} to show you
diffs, set this variable to @code{nil} (you can still view the diff
directly with @kbd{C-x v =}; @pxref{Old Revisions}).
On locking-based version control systems, @kbd{C-x v u} leaves files
unlocked; you must lock again to resume editing. You can also use
@kbd{C-x v u} to unlock a file if you lock it and then decide not to
On locking-based version control systems, @code{vc-revert} leaves
files unlocked; you must lock again to resume editing. You can also use
@code{vc-revert} to unlock a file if you lock it and then decide not to
change it.
@findex vc-revert-or-delete-revision
@ -1641,6 +1643,10 @@ ignore (@code{vc-dir-ignore}). For instance, if the VC is Git, it
will append this file to the @file{.gitignore} file. If given a
prefix, do this with all the marked files.
@item @@
Discard all the changes you have made to the current fileset
(@code{vc-revert}).
@item q
Quit the VC Directory buffer, and bury it (@code{quit-window}).

View file

@ -2599,8 +2599,15 @@ cloning, or prompts for that, too.
When the argument is non-nil, the function switches to a buffer visiting
the directory into which the repository was cloned.
+++
*** 'vc-revert' is now bound to '@' in VC-Dir.
+++
*** 'vc-revert' is now additionally bound to 'C-x v @'.
This is in addition to 'C-x v u'.
---
*** 'C-x v u' ('vc-revert') now works on directories listed in VC Directory.
*** 'vc-revert' now works on directories listed in VC Directory.
Reverting a directory means reverting changes to all files inside it.
+++

View file

@ -396,6 +396,7 @@ That is, refreshing the VC-Dir buffer also hides `up-to-date' and
(define-key map (kbd "M-s a C-s") #'vc-dir-isearch)
(define-key map (kbd "M-s a M-C-s") #'vc-dir-isearch-regexp)
(define-key map "G" #'vc-dir-ignore)
(define-key map "@" #'vc-revert)
(let ((branch-map (make-sparse-keymap)))
(define-key map "b" branch-map)

View file

@ -1023,7 +1023,8 @@ In the latter case, VC mode is deactivated for this buffer."
"m" #'vc-merge
"r" #'vc-retrieve-tag
"s" #'vc-create-tag
"u" #'vc-revert
"u" #'vc-revert ; The traditional binding.
"@" #'vc-revert ; Following VC-Dir's binding.
"v" #'vc-next-action
"+" #'vc-update
"P" #'vc-push