Subject: bug#73387: 30.0.90; C-x v v in diff-mode doesn't work after C-c C-n

From: Eli Zaretskii <[email-masked]>
Date: Wed, 02 Oct 2024 10:15:14 +0300

> From: Sean Whitton <[email-masked]>
> Cc: [email-masked],  [email-masked],  [email-masked],
>   [email-masked]
> Date: Wed, 02 Oct 2024 09:26:42 +0800
> 
> On Tue 01 Oct 2024 at 06:51pm +03, Eli Zaretskii wrote:
> 
> > I can explain the rationale for doing the opposite: when describing
> > the operation with active region, we usually start with "If the region
> > is active..." or with some other similar conditional language.  This
> > then makes it natural to explain the behavior in the other cases,
> > because the active-region one is clearly conditional, and thus not the
> > general case.
> >
> > By contrast, your text starts with the description of behavior that
> > has no conditions, and thus is perceived as the complete and
> > exhaustive.  Then the next sentence is "out of the blue" because the
> > reader does not expect any such additions, being just told what the
> > command does, period.
> 
> Yes, I know what you mean about that sentence coming out of the blue.
> But as Dmitry says, the behaviour when the region is active is a bonus
> feature, not really what the command is about.
> 
> Do you think maybe this is better:
> 
>     Delete all hunks other than the current hunk.
>     As a special case, when called interactively with an active region ...

This doesn't really address the issue, IMO.

The main problem I have here is with the "all" part of the first
sentence, which is then contradicted by the second.  Also, in other
places, you describe the behavior when region is active, but not when
it isn't.

Here's what I would suggest to say in the manual:

  @item C-c @key{RET} k
  Delete diff hunks other than the current one.  If the region is
  active, this command deletes the hunks overlapped by the region;
  otherwise it deletes all the hunks other than the current hunk.  Do
  @emph{not} invoke this command in a narrowed buffer, as that could
  produce unexpected results.

And this is for the command's doc string:

  (defun diff-delete-other-hunks (&optional beg end)
    "Delete diff hunks other than the current one.
  Interactively, if the region is active, delete all the hunks which
  the region overlaps; otherwise delete all the hunks except the
  current one.
  When calling from Lisp, pass BEG and END as the bounds of region in
  which to delete diff hunks; BEG and END omitted or nil means to
  delete all the hunks but the one which contains point.