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

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

bug#25410: 26.0.50; Refine an unified diff hunk only if adds lines


From: Tino Calancha
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)
User-agent: Alpine 2.20 (DEB 67 2015-01-07)



On Fri, 13 Jan 2017, Noam Postavsky wrote:

On Fri, Jan 13, 2017 at 1:14 AM, Tino Calancha <address@hidden> 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.





reply via email to

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