GNU bug report logs - #17544
24.3; [PATCH] Improved diff-mode navigation/manipulation

Previous Next

Package: emacs;

Reported by: Dima Kogan <lists <at> dima.secretsauce.net>

Date: Wed, 21 May 2014 15:00:05 UTC

Severity: normal

Tags: patch

Found in version 24.3

Fixed in version 26.1

Done: npostavs <at> users.sourceforge.net

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: npostavs <at> users.sourceforge.net
To: Dima Kogan <dima <at> secretsauce.net>
Cc: Eli Zaretskii <eliz <at> gnu.org>, Andreas Schwab <schwab <at> linux-m68k.org>, 17544 <at> debbugs.gnu.org
Subject: bug#17544: 24.3; [PATCH] Improved diff-mode navigation/manipulation
Date: Mon, 14 Nov 2016 22:31:17 -0500
Dima Kogan <dima <at> secretsauce.net> writes:

> npostavs <at> users.sourceforge.net writes:
>
>> Dima Kogan <dima <at> secretsauce.net> writes:
>>
>>> Hi. I'm open to suggestions. The goal was to retain the previous logic
>>> for any existing code, but to provide improved user-facing behavior.
>
> Ack! So this is what happens when you submit a patch, and then talk
> about it more than 2 years later. Turns out preserving compatibility
> with existing code wasn't my goal at all. Rather, the goal was to avoid
> an infinite loop that results if (diff-hunk-next) unconditionally uses
> the new logic:
>
>     diff-hunk-next         calls
>     diff--wrap-navigation  calls
>     diff-bounds-of-hunk    calls
>     diff-beginning-of-hunk calls
>     diff-hunk-next
>
> Revised patch attached. I'll try to respond to any comments
> quickly so that we all can remember what this is about.
[...]
> -	    (t (error "No hunk found"))))))
> +            ;; There's no next hunk, so just take the one we have
> +	    (t (list beg end))))))

Indentation on the comment looks a bit off.

> +
> +      ;; I advance to the next hunk interactively because I want the
> +      ;; interactive behavior of moving to the next logical hunk, not
> +      ;; the legacy behavior where were would sometimes sty on the
> +      ;; curent hunk.  See http://debbugs.gnu.org/17544
>        (when diff-advance-after-apply-hunk
> -	(diff-hunk-next))))))
> +        (diff-hunk-next nil t))))))

Updating the comment here will be useful for the next person trying to
figure out what this is all about in a couple more years.

>  	 (hunk (delete-and-extract-region
> -		(point) (save-excursion (diff-end-of-hunk) (point))))
> +                (point) (cadr hunk-bounds)))

Indentation looks off here.




This bug report was last modified 8 years and 180 days ago.

Previous Next


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