emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 11e7aa75eeb: ; Rework documentation for diff-delete-other-hunks


From: Sean Whitton
Subject: master 11e7aa75eeb: ; Rework documentation for diff-delete-other-hunks
Date: Wed, 2 Oct 2024 20:51:04 -0400 (EDT)

branch: master
commit 11e7aa75eeba3c0d24d84782639b48c64c8e1ea3
Author: Sean Whitton <spwhitton@spwhitton.name>
Commit: Sean Whitton <spwhitton@spwhitton.name>

    ; Rework documentation for diff-delete-other-hunks
---
 doc/emacs/files.texi |  7 +++++--
 lisp/vc/diff-mode.el | 10 ++++++----
 2 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/doc/emacs/files.texi b/doc/emacs/files.texi
index 67a1a3be3ff..0866e81233d 100644
--- a/doc/emacs/files.texi
+++ b/doc/emacs/files.texi
@@ -1705,8 +1705,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 51e7d90f98b..df55ca2ad80 100644
--- a/lisp/vc/diff-mode.el
+++ b/lisp/vc/diff-mode.el
@@ -822,10 +822,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"))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]