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


Message #11 received at 73407 <at> debbugs.gnu.org (full text, mbox):

From: Juri Linkov <juri <at> linkov.net>
To: Sean Whitton <spwhitton <at> spwhitton.name>
Cc: 73407 <at> debbugs.gnu.org, dgutov <at> yandex.ru
Subject: Re: bug#73407: 31.0.50; Add diff-discard-hunk
Date: Tue, 24 Sep 2024 09:36:27 +0300
> 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).

> +(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'.




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.