From: Sean Whitton Date: Thu, 3 Oct 2024 00:50:55 +0000 (+0800) Subject: ; Rework documentation for diff-delete-other-hunks X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=ea923fe79025348446dcffc2ac0f36154f8c4cb7;p=emacs.git ; Rework documentation for diff-delete-other-hunks (cherry picked from commit 11e7aa75eeba3c0d24d84782639b48c64c8e1ea3) --- diff --git a/doc/emacs/files.texi b/doc/emacs/files.texi index 32f7fc5c597..460214d7208 100644 --- a/doc/emacs/files.texi +++ b/doc/emacs/files.texi @@ -1703,8 +1703,11 @@ diffs were applied successfully, save the changed buffers. @findex diff-delete-other-hunks @item C-c @key{RET} n -Delete all hunks other than the current hunk. If the region is active, -then delete all hunks that the region does not overlap. +Delete hunks other than the current one. If the region is active, this +command deletes the hunks the region overlaps; otherwise it deletes all +hunks other than the current hunk. This command does not work in a +narrowed buffer because deleting hunks safely requires access to the +file headers. @findex diff-refine-hunk @item C-c C-b diff --git a/lisp/vc/diff-mode.el b/lisp/vc/diff-mode.el index 9ff7137a297..a9314bfa320 100644 --- a/lisp/vc/diff-mode.el +++ b/lisp/vc/diff-mode.el @@ -821,10 +821,12 @@ If the prefix ARG is given, restrict the view to the current file instead." ;; would be a patch with the same meaning. That is not implemented ;; because it does not seem like it would be useful. (defun diff-delete-other-hunks (&optional beg end) - "Delete all hunks other than the current hunk. -Interactively, if the region is active, then delete all hunks that the -region does not overlap. When called from Lisp, the optional arguments -BEG and END specify the region of hunks not to delete." + "Delete hunks other than the current one. +Interactively, if the region is active, delete all hunks that the region +overlaps; otherwise delete all hunks except the current one. +When calling from Lisp, pass BEG and END as the bounds of the region in +which to delete hunks; BEG and END omitted or nil means to delete all +the hunks but the one which contains point." (interactive (list (use-region-beginning) (use-region-end))) (when (buffer-narrowed-p) (user-error "Command is not safe in a narrowed buffer"))