GNU bug report logs - #25410
26.0.50; Refine an unified diff hunk only if adds lines

Previous Next

Package: emacs;

Reported by: Tino Calancha <tino.calancha <at> gmail.com>

Date: Tue, 10 Jan 2017 10:09:01 UTC

Severity: normal

Tags: fixed, patch

Found in version 26.0.50

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: Tino Calancha <tino.calancha <at> gmail.com>
To: Noam Postavsky <npostavs <at> users.sourceforge.net>
Cc: 25410 <at> debbugs.gnu.org, Tino Calancha <tino.calancha <at> gmail.com>
Subject: bug#25410: 26.0.50; Refine an unified diff hunk only if adds lines
Date: Sat, 14 Jan 2017 14:38:36 +0900 (JST)

On Fri, 13 Jan 2017, Noam Postavsky wrote:

> On Fri, Jan 13, 2017 at 1:14 AM, Tino Calancha <tino.calancha <at> gmail.com> wrote:
>>
>>> +         (while (re-search-forward "^-" end t)
>>> +           (let ((beg-del (progn (beginning-of-line) (point)))
>>> +                 beg-add end-add)
>>> +             (when (and (diff--forward-while-leading-char ?- end)
>>> +                        ;; Allow for "\ No newline at end of file".
>>> +                        (progn (diff--forward-while-leading-char ?\\ end)
>>> +                               (setq beg-add (point)))
>>> +                        (diff--forward-while-leading-char ?+ end)
>>> +                        (progn (diff--forward-while-leading-char ?\\ end)
>>> +                               (setq end-add (point))))
>>
>> How about hide the complexity resulting for checking ?\\ inside the
>> auxiliary function?
>
> I'm okay with doing this, but I slightly prefer leaving the complexity
> at the top level. I think pushing the ?\\ check inside
> diff--forward-while-leading-char makes that function's purpose a bit
> incoherent and the complexity reduction in the caller doesn't look
> significant enough to balance that.
Agreed.  Indeed, keeping simple `diff--forward-while-leading-char'
favours reutilization: it seems to me like this function could be used
elsewhere.




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

Previous Next


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