bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#73407: 31.0.50; Add diff-discard-hunk


From: Sean Whitton
Subject: bug#73407: 31.0.50; Add diff-discard-hunk
Date: Tue, 24 Sep 2024 09:07:47 +0100
User-agent: Gnus/5.13 (Gnus v5.13)

Hello,

On Tue 24 Sep 2024 at 09:36am +03, Juri Linkov wrote:

>> These patches add a new command, diff-discard-hunk, inspired by some
>> functionality from Magit.  It nicely complements a workflow based around
>> committing with C-x v v from C-x v D.  I have been using it every day
>> for a year or so, and I think others will find it useful, too.
>>
>> Posting for comments.  Thanks!
>
> It was hard to understand how it's related to C-x v v.
> But then I realized it saves time to do what currently is done with:
> 'C-c C-r' (diff-reverse-direction)
> 'C-c C-a' (diff-apply-hunk)
> 'k' (diff-hunk-kill).

Yeah, exactly.

>> +(defcustom diff-display-after-apply-hunk t
>> +  "Non-nil means `diff-apply-hunk' will display the buffer it just changed."
>> +  :type 'boolean)
>> +
>> @@ -2024,7 +2028,8 @@ diff-apply-hunk
>> -      (set-window-point (display-buffer buf) (+ (car pos) (cdr new)))
>> +      (when diff-display-after-apply-hunk
>> +        (set-window-point (display-buffer buf) (+ (car pos) (cdr new))))
>
> Probably this change is not needed if 'diff-discard-hunk'
> could avoid using 'diff-apply-hunk', and instead rely
> on the algorithm from 'diff-apply-buffer'.  Also optional
> region arguments 'beg' and 'end' could be added to
> 'diff-apply-buffer'.

I'll look into that, thanks.

-- 
Sean Whitton





reply via email to

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