diff options
| author | Sean Whitton | 2024-09-24 09:38:43 +0100 |
|---|---|---|
| committer | Sean Whitton | 2024-09-26 11:51:21 +0100 |
| commit | f2e3e563d4909ff503bb2d3aeb6d2de9804e3047 (patch) | |
| tree | 6aa69bb519fcbd421e62adcd5b7cf3057637b631 /doc | |
| parent | 8ffb680d09bc6b18d36941765e0f4ca881b565c9 (diff) | |
| download | emacs-f2e3e563d4909ff503bb2d3aeb6d2de9804e3047.tar.gz emacs-f2e3e563d4909ff503bb2d3aeb6d2de9804e3047.zip | |
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'' | |||
| 1682 | version. If @code{diff-jump-to-old-file} is non-@code{nil}, apply the | 1682 | version. If @code{diff-jump-to-old-file} is non-@code{nil}, apply the |
| 1683 | hunk to the ``old'' version of the file instead. | 1683 | hunk to the ``old'' version of the file instead. |
| 1684 | 1684 | ||
| 1685 | @findex diff-revert-and-kill-hunk | ||
| 1686 | @item C-c M-r | ||
| 1687 | Reverse-apply this hunk to the target file, and then kill it | ||
| 1688 | (@code{diff-revert-and-kill-hunk}). Save the buffer visiting the target | ||
| 1689 | file. | ||
| 1690 | |||
| 1691 | This command is useful in buffers generated by @w{@kbd{C-x v =}} and | ||
| 1692 | @w{@kbd{C-x v D}} (@pxref{Old Revisions}). These buffers present you | ||
| 1693 | with a view of the changes you've made, and then you can use this | ||
| 1694 | command to drop changes you didn't intend, or no longer want. | ||
| 1695 | |||
| 1696 | This is a destructive operation, so by default, this command asks you to | ||
| 1697 | confirm you really want to reverse-apply and kill the hunk. You can | ||
| 1698 | customize @code{diff-ask-before-revert-and-kill-hunk} to change that. | ||
| 1699 | |||
| 1685 | @findex diff-apply-buffer | 1700 | @findex diff-apply-buffer |
| 1686 | @item C-c @key{RET} a | 1701 | @item C-c @key{RET} a |
| 1687 | Apply all the hunks in the buffer (@code{diff-apply-buffer}). If the | 1702 | Apply all the hunks in the buffer (@code{diff-apply-buffer}). If the |