From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: off-topic: Conversion multi-line diff to single-line Date: Mon, 29 Aug 2011 12:08:34 -0400 Message-ID: References: <20110829.073921.430174446.wl@gnu.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; CHARSET=US-ASCII Content-Transfer-Encoding: 7BIT X-Trace: dough.gmane.org 1314634126 8225 80.91.229.12 (29 Aug 2011 16:08:46 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Mon, 29 Aug 2011 16:08:46 +0000 (UTC) Cc: emacs-devel@gnu.org To: Werner LEMBERG Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Aug 29 18:08:42 2011 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Qy4O9-0000H4-LL for ged-emacs-devel@m.gmane.org; Mon, 29 Aug 2011 18:08:41 +0200 Original-Received: from localhost ([::1]:50532 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qy4O9-0004Bs-3W for ged-emacs-devel@m.gmane.org; Mon, 29 Aug 2011 12:08:41 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:39203) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qy4O6-0004BK-Ik for emacs-devel@gnu.org; Mon, 29 Aug 2011 12:08:39 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Qy4O5-00007I-F2 for emacs-devel@gnu.org; Mon, 29 Aug 2011 12:08:38 -0400 Original-Received: from relais.videotron.ca ([24.201.245.36]:46487) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qy4O5-00007E-9q; Mon, 29 Aug 2011 12:08:37 -0400 Original-Received: from ceviche.home ([96.22.109.87]) by vl-mo-mrz24.ip.videotron.ca (Sun Java(tm) System Messaging Server 6.3-8.01 (built Dec 16 2008; 32bit)) with ESMTP id <0LQP008K964I7B40@vl-mo-mrz24.ip.videotron.ca>; Mon, 29 Aug 2011 12:07:31 -0400 (EDT) Original-Received: by ceviche.home (Postfix, from userid 20848) id 9F5A8660B6; Mon, 29 Aug 2011 12:08:34 -0400 (EDT) In-reply-to: <20110829.073921.430174446.wl@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: Solaris 10 (beta) X-Received-From: 24.201.245.36 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:143632 Archived-At: > I have an off-topic question, and maybe you can help. Is there a > program or script which converts the multiline chunks of diff (without > -u or -c) into single-line chunks? This is, I want to have this > XXX > < foo1 > < foo2 > < foo3 > --- >> bar1 >> bar2 >> bar3 > converted into > XXX > < foo1 > --- >> bar1 > YYY > < foo2 > --- >> bar2 > ZZZ >> foo3 > --- > < bar3 > Such an output greatly simplifies comparison of large sorted word > lists with sparse or systematic insertions, deletions, or changes. Very good question. I'd also like to see such a thing (tho on the unified-diff format since that's the one I prefer). I.e. turn --- .dir-locals.el 2011-04-24 18:34:57 +0000 +++ .dir-locals.el 2011-05-27 23:05:19 +0000 @@ -1,6 +1,6 @@ ((nil . ((tab-width . 8) - (sentence-end-double-space . t) - (fill-column . 70))) + (sentence-end-double-space . nil) + (foo . 5) + (fill-column . 79) + (bar . 10))) (c-mode . ((c-file-style . "GNU"))) into --- .dir-locals.el 2011-04-24 18:34:57 +0000 +++ .dir-locals.el 2011-05-27 23:05:19 +0000 @@ -1,6 +1,6 @@ ((nil . ((tab-width . 8) - (sentence-end-double-space . t) + (sentence-end-double-space . nil) + (foo . 5) - (fill-column . 70))) + (fill-column . 79) + (bar . 10))) (c-mode . ((c-file-style . "GNU"))) Your example is simpler but I think it's possible to handle mine as well. The needed info is available to diff-refine-hunk, so it should be possible to extend diff-refine-hunk to diff-reorganize-hunk so as to reduce the distance between matching words in the + and - lines. Patches welcome. Stefan