1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-09 15:50:40 -08:00

; Fix documentation of last change

* lisp/vc/diff-mode.el (diff-ask-before-revert-and-kill-hunk): Add
':version' tag.
(diff-revert-and-kill-hunk, diff-apply-buffer): Doc fixes.

* etc/NEWS:
* doc/emacs/files.texi (Diff Mode): Fix last change; add indexing.
This commit is contained in:
Eli Zaretskii 2024-09-26 14:24:18 +03:00
parent f2e3e563d4
commit c86e7a29e7
3 changed files with 16 additions and 13 deletions

View file

@ -1675,6 +1675,7 @@ In a multi-file patch, kill the current file part.
@findex diff-apply-hunk @findex diff-apply-hunk
@cindex patches, applying @cindex patches, applying
@cindex reverse-apply diffs
@item C-c C-a @item C-c C-a
Apply this hunk to its target file (@code{diff-apply-hunk}). With a Apply this hunk to its target file (@code{diff-apply-hunk}). With a
prefix argument of @kbd{C-u}, revert this hunk, i.e.@: apply the prefix argument of @kbd{C-u}, revert this hunk, i.e.@: apply the
@ -1684,18 +1685,18 @@ hunk to the ``old'' version of the file instead.
@findex diff-revert-and-kill-hunk @findex diff-revert-and-kill-hunk
@item C-c M-r @item C-c M-r
Reverse-apply this hunk to the target file, and then kill it Revert this hunk, and then remove the hunk from the diffs
(@code{diff-revert-and-kill-hunk}). Save the buffer visiting the target (@code{diff-revert-and-kill-hunk}). Save the buffer visiting the target
file. file.
This command is useful in buffers generated by @w{@kbd{C-x v =}} and 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 @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 with a view of the changes you've made, and you can use this command to
command to drop changes you didn't intend, or no longer want. undo changes you didn't intend to do, or no longer want.
This is a destructive operation, so by default, this command asks you to 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 confirm you really want to revert and kill the hunk. You can customize
customize @code{diff-ask-before-revert-and-kill-hunk} to change that. @code{diff-ask-before-revert-and-kill-hunk} to control that.
@findex diff-apply-buffer @findex diff-apply-buffer
@item C-c @key{RET} a @item C-c @key{RET} a

View file

@ -365,8 +365,9 @@ 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 C-c M-r.
This command reverse-applies the hunk at point, and then kills it. This command reverts the hunk at point (i.e., applies the reverse of the
This is useful in buffers generated by C-x v = and C-x v D. hunk), and then removes the hunk from the diffs. This is useful to undo
commits when you are in buffers generated by 'C-x v =' and 'C-x v D'.
** php-ts-mode ** php-ts-mode

View file

@ -2055,7 +2055,8 @@ With a prefix argument, try to REVERSE the hunk."
(defcustom diff-ask-before-revert-and-kill-hunk t (defcustom diff-ask-before-revert-and-kill-hunk t
"If non-nil, `diff-revert-and-kill-hunk' will ask for confirmation." "If non-nil, `diff-revert-and-kill-hunk' will ask for confirmation."
:type 'boolean) :type 'boolean
:version "31.1")
(defun diff-revert-and-kill-hunk () (defun diff-revert-and-kill-hunk ()
"Reverse-apply and then kill the hunk at point. Save changed buffer. "Reverse-apply and then kill the hunk at point. Save changed buffer.
@ -2068,7 +2069,7 @@ to permanently drop changes you didn't intend, or no longer want.
This is a destructive operation, so by default, this command asks you to 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 confirm you really want to reverse-apply and kill the hunk. You can
customize `diff-ask-before-revert-and-kill-hunk' to change that." customize `diff-ask-before-revert-and-kill-hunk' to control that."
(interactive) (interactive)
(when (or (not diff-ask-before-revert-and-kill-hunk) (when (or (not diff-ask-before-revert-and-kill-hunk)
(yes-or-no-p "Really reverse-apply and kill this hunk?")) (yes-or-no-p "Really reverse-apply and kill this hunk?"))
@ -2078,11 +2079,11 @@ customize `diff-ask-before-revert-and-kill-hunk' to change that."
(defun diff-apply-buffer (&optional beg end reverse) (defun diff-apply-buffer (&optional beg end reverse)
"Apply the diff in the entire diff buffer. "Apply the diff in the entire diff buffer.
When applying all hunks was successful, then save the changed buffers. If applying all hunks succeeds, save the changed buffers.
When called from Lisp with optional arguments, restrict the application When called from Lisp with optional arguments, restrict the application
to hunks lying between BEG and END, and reverse-apply when REVERSE is to hunks lying between BEG and END, and reverse-apply them when REVERSE is
non-nil. Returns nil if buffers were saved, or the number of failed non-nil. Returns nil if buffers were successfully modified and saved, or
applications." the number of failed hunk applications otherwise."
(interactive) (interactive)
(let ((buffer-edits nil) (let ((buffer-edits nil)
(failures 0) (failures 0)