Revised bindings for diff-revert-and-kill-hunk

* lisp/vc/diff-mode.el (diff-mode-shared-map): Bind
diff-revert-and-kill-hunk to 'u'.
(diff-mode-map): Replace binding for diff-revert-and-kill-hunk
with 'C-c M-u'.
* doc/emacs/files.texi (Diff Mode):
* etc/NEWS: Document the change.
This commit is contained in:
Sean Whitton 2025-11-13 16:22:20 +00:00
parent a0c69d3d44
commit 5dfcba699e
3 changed files with 11 additions and 4 deletions

View file

@ -1825,7 +1825,7 @@ version. If @code{diff-jump-to-old-file} is non-@code{nil}, apply the
hunk to the ``old'' version of the file instead.
@findex diff-revert-and-kill-hunk
@item C-c M-r
@item C-c M-u
Revert this hunk, and then remove the hunk from the diffs
(@code{diff-revert-and-kill-hunk}). Save the buffer visiting the target
file.

View file

@ -2003,7 +2003,7 @@ to the original text. If the selected range extends a hunk, the
command attempts to look up and copy the text in between the hunks.
+++
*** New command 'diff-revert-and-kill-hunk' bound to 'C-c M-r'.
*** New command 'diff-revert-and-kill-hunk' bound to 'u' and 'C-c M-u'.
This command reverts the hunk at point (i.e., applies the reverse of the
hunk), and then removes the hunk from the diffs.
This is useful to undo or revert changes, committed and uncommitted, when

View file

@ -221,7 +221,14 @@ and with a `diff-minor-mode-prefix' prefix in `diff-minor-mode'."
"A" #'diff-ediff-patch
"r" #'diff-restrict-view
"R" #'diff-reverse-direction
"<remap> <undo>" #'diff-undo)
"<remap> <undo>" #'diff-undo
;; The foregoing commands don't affect buffers beyond this one.
;; The following command is the only one that has a single-letter
;; binding and which affects buffers beyond this one.
;; However, the following command asks for confirmation by default,
;; so that seems okay. --spwhitton
"u" #'diff-revert-and-kill-hunk)
(defvar-keymap diff-mode-map
:doc "Keymap for `diff-mode'. See also `diff-mode-shared-map'."
@ -238,7 +245,7 @@ and with a `diff-minor-mode-prefix' prefix in `diff-minor-mode'."
"C-x 4 A" #'diff-add-change-log-entries-other-window
;; Misc operations.
"C-c C-a" #'diff-apply-hunk
"C-c M-r" #'diff-revert-and-kill-hunk
"C-c M-u" #'diff-revert-and-kill-hunk
"C-c C-m a" #'diff-apply-buffer
"C-c C-m n" #'diff-delete-other-hunks
"C-c C-e" #'diff-ediff-patch