diff options
author | Sean Whitton <spwhitton@spwhitton.name> | 2024-09-24 09:38:43 +0100 |
---|---|---|
committer | Sean Whitton <spwhitton@spwhitton.name> | 2024-09-26 11:51:21 +0100 |
commit | f2e3e563d4909ff503bb2d3aeb6d2de9804e3047 (patch) | |
tree | 6aa69bb519fcbd421e62adcd5b7cf3057637b631 /doc | |
parent | 8ffb680d09bc6b18d36941765e0f4ca881b565c9 (diff) |
New command diff-revert-and-kill-hunk
* lisp/vc/diff-mode.el (diff-revert-and-kill-hunk): New
command (bug#73407).
(diff-ask-before-revert-and-kill-hunk): New user option.
(diff-apply-buffer): New optional BEG, END and REVERSE
arguments. Return nil if buffers were saved, or the number of
failed applications.
(diff-mode-map): Bind the new command to C-c M-r.
(diff-mode-menu): New entry for the new command.
* doc/emacs/files.texi (Diff Mode):
* etc/NEWS: Document the change.
Diffstat (limited to 'doc')
-rw-r--r-- | doc/emacs/files.texi | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/doc/emacs/files.texi b/doc/emacs/files.texi index 709cb0910e6..b7d6b6f9f7b 100644 --- a/doc/emacs/files.texi +++ b/doc/emacs/files.texi @@ -1682,6 +1682,21 @@ reverse of the hunk, which changes the ``new'' version into the ``old'' 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 +Reverse-apply this hunk to the target file, and then kill it +(@code{diff-revert-and-kill-hunk}). Save the buffer visiting the target +file. + +This command is useful in buffers generated by @w{@kbd{C-x v =}} and +@w{@kbd{C-x v D}} (@pxref{Old Revisions}). These buffers present you +with a view of the changes you've made, and then you can use this +command to drop changes you didn't intend, or no longer want. + +This is a destructive operation, so by default, this command asks you to +confirm you really want to reverse-apply and kill the hunk. You can +customize @code{diff-ask-before-revert-and-kill-hunk} to change that. + @findex diff-apply-buffer @item C-c @key{RET} a Apply all the hunks in the buffer (@code{diff-apply-buffer}). If the |