From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Tino Calancha Newsgroups: gmane.emacs.bugs 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) Message-ID: References: <8737grz0q3.fsf@gmail.com> <8737gr0zbn.fsf@users.sourceforge.net> <87fukqe2eu.fsf@gmail.com> <8760lmqak1.fsf@gmail.com> <87wpe0zz0s.fsf@users.sourceforge.net> <87inpjzhpb.fsf@users.sourceforge.net> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed X-Trace: blaine.gmane.org 1484372354 22460 195.159.176.226 (14 Jan 2017 05:39:14 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sat, 14 Jan 2017 05:39:14 +0000 (UTC) User-Agent: Alpine 2.20 (DEB 67 2015-01-07) Cc: 25410@debbugs.gnu.org, Tino Calancha To: Noam Postavsky Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Jan 14 06:39:10 2017 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cSH3T-00059P-4t for geb-bug-gnu-emacs@m.gmane.org; Sat, 14 Jan 2017 06:39:07 +0100 Original-Received: from localhost ([::1]:46529 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cSH3X-0008WG-I5 for geb-bug-gnu-emacs@m.gmane.org; Sat, 14 Jan 2017 00:39:11 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:58959) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cSH3R-0008W0-FD for bug-gnu-emacs@gnu.org; Sat, 14 Jan 2017 00:39:06 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cSH3O-0005kB-EE for bug-gnu-emacs@gnu.org; Sat, 14 Jan 2017 00:39:05 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:37872) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cSH3O-0005k6-9P for bug-gnu-emacs@gnu.org; Sat, 14 Jan 2017 00:39:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1cSH3O-0007RC-3Q for bug-gnu-emacs@gnu.org; Sat, 14 Jan 2017 00:39:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Tino Calancha Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 14 Jan 2017 05:39:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 25410 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 25410-submit@debbugs.gnu.org id=B25410.148437233028570 (code B ref 25410); Sat, 14 Jan 2017 05:39:02 +0000 Original-Received: (at 25410) by debbugs.gnu.org; 14 Jan 2017 05:38:50 +0000 Original-Received: from localhost ([127.0.0.1]:53271 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cSH3B-0007Qk-Ph for submit@debbugs.gnu.org; Sat, 14 Jan 2017 00:38:49 -0500 Original-Received: from mail-pf0-f194.google.com ([209.85.192.194]:36203) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cSH39-0007QX-CS for 25410@debbugs.gnu.org; Sat, 14 Jan 2017 00:38:48 -0500 Original-Received: by mail-pf0-f194.google.com with SMTP id 19so62019pfo.3 for <25410@debbugs.gnu.org>; Fri, 13 Jan 2017 21:38:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:date:to:cc:subject:in-reply-to:message-id:references :user-agent:mime-version; bh=oemeoTz2rdVjO+kbo85NMp7uqGBE/s2SHDIBnAUx12M=; b=K3Z3tdnDcqEazXI3g1Z66KrTGqoGLcBxQGKCrIfXUss+LX2PaKzViMgfCbGn2/Fblw ztEYIF1uKZY/412sHgbZRPjJVddD/0C534E94gFDsBirLomTsHI1AbrQ3poljXSgvbsl zkpn5UOS8t9dp3YbuXYXGjyUzkxiBMs+DYJu8SKkdOmhRW4yHgvFYxhV7mkkqs1iG8ku U3jBgHQ1zaR2y7db6vMvSS7oFuJloWQxZiHtJidUigYjI7BD31TrnAG2q5802qhiySPG g7g5EWw12n0BP0iD3QO6OBEGrp2nmQTcm7ybNbkkBraUv3fgUFsPED66bht2bcaembBP tgjw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:date:to:cc:subject:in-reply-to:message-id :references:user-agent:mime-version; bh=oemeoTz2rdVjO+kbo85NMp7uqGBE/s2SHDIBnAUx12M=; b=YKG2EUW+A7XaHYuT6CO5drfDIQbi7QYPe2NLxmuPifAoW/KZA4XcZMcmQSUqjPxhdd iaE+yMa8YzKD2LDPI6ECUgKsd8/A3SozrmMnNu8udZr4Cx1LivwFS3KgHGguQl3RmVz6 O/NbO8lZlu31BOwoSTShhDD+NpE7z5aQotqFwKLXsriZUNi/e5DPfV1oDj8aQJa0uVW2 0h0TmRnovUp/05oWCS7u6n4Dya4azk/kJmYD9DLb4o6FYCy8GxvlNvaHTdThmVXeonSr B4GkCO2zt77eZyiHtsvgV6ApneHqyHcvsnUZGzUjnQ8zVElhLhUWCNdMksJ3YZ/gee8g PwKQ== X-Gm-Message-State: AIkVDXK3bK+C+D86UC6AVznudfepaJRdHPvSZArAol22xj6ePWv8nDFnBYFR30rq0S8Cpg== X-Received: by 10.84.198.129 with SMTP id p1mr35067159pld.14.1484372321391; Fri, 13 Jan 2017 21:38:41 -0800 (PST) Original-Received: from calancha-pc (33.94.100.220.dy.bbexcite.jp. [220.100.94.33]) by smtp.gmail.com with ESMTPSA id a25sm32898938pgd.26.2017.01.13.21.38.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 13 Jan 2017 21:38:40 -0800 (PST) X-Google-Original-From: Tino Calancha X-X-Sender: calancha@calancha-pc In-Reply-To: X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:128105 Archived-At: On Fri, 13 Jan 2017, Noam Postavsky wrote: > On Fri, Jan 13, 2017 at 1:14 AM, Tino Calancha 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.