GNU bug report logs - #73407
31.0.50; Add diff-discard-hunk

Previous Next

Package: emacs;

Reported by: Sean Whitton <spwhitton <at> spwhitton.name>

Date: Sat, 21 Sep 2024 10:20:01 UTC

Severity: normal

Found in version 31.0.50

Done: Sean Whitton <spwhitton <at> spwhitton.name>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Juri Linkov <juri <at> linkov.net>
To: Sean Whitton <spwhitton <at> spwhitton.name>
Cc: Eli Zaretskii <eliz <at> gnu.org>, 73407 <at> debbugs.gnu.org, dgutov <at> yandex.ru
Subject: bug#73407: [PATCH v4] bug#73407: 31.0.50; Add diff-discard-hunk
Date: Tue, 24 Sep 2024 19:59:04 +0300
>>> -           (message "%d hunks failed; no buffers changed" failures)))))
>>> +           (message "%d hunks failed; no buffers changed" failures)
>>> +           failures))))
>>
>> This comes from existing text, but still: what does the above say when
>> there's only 1 failure? does it say "1 hunks failed"?  If so, can we
>> improve the handling of singular/plural here?
>
> I've installed a fix for that.

Another variant would be to use 'ngettext'.

>> I'm a little concerned about the binding.
>>
>> We have 'diff-hunk-kill' on M-k (and also 'k'), and this new addition is
>> actually more destructive. I'm expecting users will trip over the difference
>> and call one of them when they wanted to call the other.
>
> Yeah, and thinking about it more, it also doesn't really match what C-c
> C-k does elsewhere in Emacs.  I've made it C-c M-r in the attached v4.

There is the existing 'C-c C-m' submap that could be used with e.g.
'C-c RET C-k'.


> +      (diff-reverse-direction beg end)
> +      (condition-case ret
> +          (diff-apply-buffer beg end)
> +        ;; Reversing the hunk is an implementation detail, so ensure the
> +        ;; user never sees it.
> +        (error (diff-reverse-direction beg end)
> +               (signal (car ret) (cdr ret)))
> +        (:success (if ret
> +                      (diff-reverse-direction beg end)

Instead of reversing the direction back and forth,
it would be simpler to add another optional argument
to 'diff-apply-buffer' to delegate it to the
REVERSE argument of 'diff-find-source-location'.




This bug report was last modified 240 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.