From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id 3B33E429E40 for ; Sat, 21 Jan 2012 15:21:40 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: 0.001 X-Spam-Level: X-Spam-Status: No, score=0.001 tagged_above=-999 required=5 tests=[FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001] autolearn=disabled Received: from olra.theworths.org ([127.0.0.1]) by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id MzB9rJSuimGD for ; Sat, 21 Jan 2012 15:21:39 -0800 (PST) Received: from mailout-de.gmx.net (mailout-de.gmx.net [213.165.64.23]) by olra.theworths.org (Postfix) with SMTP id 53454431FAF for ; Sat, 21 Jan 2012 15:21:39 -0800 (PST) Received: (qmail invoked by alias); 21 Jan 2012 23:21:38 -0000 Received: from www.nexoid.at (EHLO mail.nexoid.at) [178.79.130.240] by mail.gmx.net (mp063) with SMTP; 22 Jan 2012 00:21:38 +0100 X-Authenticated: #201305 X-Provags-ID: V01U2FsdGVkX18HvhdUyeMHBoC6C3xaSRUeScItUw9hq8q0tWB09i EegPSslarHYe1z Received: by mail.nexoid.at (Postfix, from userid 1000) id 927FA57019; Sun, 22 Jan 2012 00:21:37 +0100 (CET) From: "Peter Feigl" To: Jameson Graef Rollins Subject: Re: [PATCH] rewriting notmuch-search for structured output to make other output formats easier In-Reply-To: <87k44klkee.fsf@servo.finestructure.net> References: <1327180568-30385-1-git-send-email-craven@gmx.net> <87k44klkee.fsf@servo.finestructure.net> User-Agent: Notmuch/0.11+77~gad6d0d5 (http://notmuchmail.org) Emacs/23.3.1 (i686-pc-linux-gnu) Date: Sun, 22 Jan 2012 00:21:37 +0100 Message-ID: <87lip0ljzy.fsf@nexoid.at> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Y-GMX-Trusted: 0 Cc: notmuch@notmuchmail.org X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 21 Jan 2012 23:21:40 -0000 On Sat, 21 Jan 2012 15:12:57 -0800, Jameson Graef Rollins wrote: > On Sat, 21 Jan 2012 22:16:08 +0100, Peter Feigl wrote: > > The output routines have been rewritten so that logical structure > > (objects with key/value pairs, arrays, strings and numbers) are > > written instead of ad-hoc printfs. This allows for easier adaptation > > of other output formats, as only the routines that start/end an object > > etc. have to be rewritten. The logic is the same for all formats. > > The default text output is handled differently, special cases are > > inserted at the proper places, as it differs too much from the > > structured output. > > Hi, Peter. Thanks for the contribution. > > There are a lot of changes in this patch so I think you need to think > about how you can break this up into multiple smaller and more atomic > patches. In particular, the addition of the sexp output format needs to > definitely be in a separate patch from the restructuring of the output > formatting. You also don't mention anywhere in the commit log that > you've added this new output format. You'll also need to include > documentation and test suite updates. I'm sorry I forgot to mention that, it was mainly meant as a way to show that this is easily possible (i.e. that the formatting is decoupled from the logic, so that additional and different formats can be added without influencing the printing logic). It'd be easy to split this up. What kind of documentation should I include? The test suite should work fine, *if* it compares EXPECTED and OUTPUT not character-by-character, but rather by pretty-printing both the expected and the actual outputs by some JSON pretty-printer (like python -mjson.tool). I can of course provide additional test-cases for --format=sexp. How should I proceed on this? Re-submit the patch with the sexp-support removed and only JSON updated? Thanks! Peter