Return-Path: X-Original-To: notmuch@notmuchmail.org Delivered-To: notmuch@notmuchmail.org Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id 14B2C431FAF for ; Sun, 22 Jul 2012 09:13:17 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -0.7 X-Spam-Level: X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5 tests=[RCVD_IN_DNSWL_LOW=-0.7] 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 3zFopGbdRUsr for ; Sun, 22 Jul 2012 09:13:16 -0700 (PDT) Received: from dmz-mailsec-scanner-6.mit.edu (DMZ-MAILSEC-SCANNER-6.MIT.EDU [18.7.68.35]) by olra.theworths.org (Postfix) with ESMTP id 91C5E431FAE for ; Sun, 22 Jul 2012 09:13:16 -0700 (PDT) X-AuditID: 12074423-b7f396d0000008f4-9f-500c269b540f Received: from mailhub-auth-1.mit.edu ( [18.9.21.35]) by dmz-mailsec-scanner-6.mit.edu (Symantec Messaging Gateway) with SMTP id 24.3E.02292.B962C005; Sun, 22 Jul 2012 12:13:15 -0400 (EDT) Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103]) by mailhub-auth-1.mit.edu (8.13.8/8.9.2) with ESMTP id q6MGDFab011185; Sun, 22 Jul 2012 12:13:15 -0400 Received: from awakening.csail.mit.edu (awakening.csail.mit.edu [18.26.4.91]) (authenticated bits=0) (User authenticated as amdragon@ATHENA.MIT.EDU) by outgoing.mit.edu (8.13.6/8.12.4) with ESMTP id q6MGDEMs004656 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT); Sun, 22 Jul 2012 12:13:15 -0400 (EDT) Received: from amthrax by awakening.csail.mit.edu with local (Exim 4.77) (envelope-from ) id 1SsymQ-0007FZ-5n; Sun, 22 Jul 2012 12:13:14 -0400 Date: Sun, 22 Jul 2012 12:13:13 -0400 From: Austin Clements To: craven@gmx.net Subject: Re: notmuch-reply: Structured Formatters Message-ID: <20120722161313.GD31834@mit.edu> References: <20120718194819.GP31670@mit.edu> <1342766173-1344-1-git-send-email-craven@gmx.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1342766173-1344-1-git-send-email-craven@gmx.net> User-Agent: Mutt/1.5.21 (2010-09-15) X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFmpmleLIzCtJLcpLzFFi42IR4hRV1p2txhNgsHWKkcXehnZGi+s3ZzI7 MHks3rSfzePZqlvMAUxRXDYpqTmZZalF+nYJXBlbW7eyFxzhrXi407aB8Q1XFyMnh4SAicS7 O4dYIWwxiQv31rN1MXJxCAnsY5To+HAVytnAKHGkdxIjhHOSSeL8gstQmSWMEkv6N4H1swio SqxoXcoCYrMJaEhs27+cEcQWERCSmPTlFVicWUBa4tvvZiYQW1jAUGLPzhXMIDavgI5E5/kG sHohgQSJR2s+QcUFJU7OfALVqyVx499LoF4OsDnL/3GAhDkF7CTOH37BDmKLCqhITDm5jW0C o9AsJN2zkHTPQuhewMi8ilE2JbdKNzcxM6c4NVm3ODkxLy+1SNdMLzezRC81pXQTIyis2V2U dzD+Oah0iFGAg1GJh9fQnTtAiDWxrLgy9xCjJAeTkijvCmmeACG+pPyUyozE4oz4otKc1OJD jBIczEoivJevA5XzpiRWVqUW5cOkpDlYlMR5r6Xc9BcSSE8sSc1OTS1ILYLJynBwKEnwnlQF GipYlJqeWpGWmVOCkGbi4AQZzgM0/C5IDW9xQWJucWY6RP4Uo6KUOO8ukIQASCKjNA+uF5Z2 XjGKA70izLsCpIoHmLLgul8BDWYCGiydxQUyuCQRISXVwHjKvyt11f2Sj2Kr0jSX/f3q5n1g xm3t10u6vu7mOFcuXa/V3HIvak/c4tmMzqa/7FWy7+tn6XsvPpmp0XC+sahwRjWj5omzoemB l2U9Z+w4N62j5+p5Be1NdipbnpoLu51lXt+nuSP2UHVTi5LW/Qbmw2/+Xr9+eM/ir/7dE/tM F9+53hA9dZYSS3FGoqEWc1FxIgCP+2wbFgMAAA== 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: Sun, 22 Jul 2012 16:13:17 -0000 LGTM! This is a great cleanup and I'm looking forward to S-expression support. Quoth craven@gmx.net on Jul 20 at 8:36 am: > Currently there is no easy way to add support for different structured > formatters (like JSON). For example, adding support for S-Expressions > would result in code duplication. > > This patch series amends the situation by introducing structured > formatters, which allow different implementations of structures like > lists, maps, strings and numbers. > > The new code in sprinter.h and sprinter-json.c can be used instead of > the current ad-hoc output in all parts of notmuch, a patch for > notmuch-search.c is included. > > In a later patch, all other parts of notmuch should be adapted to the > structured formatters, and the creation of formatters should be > centralised (to make adding new formatters easier). > > A "structured" formatter is provided for notmuch-search that prints the > current text format. This removes almost all the special-casing from > notmuch-search.c. > > Overall diff --stat: > > Makefile.local | 2 + > notmuch-search.c | 301 +++++++++++++---------------------------------- > sprinter-json.c | 185 +++++++++++++++++++++++++++++ > sprinter-text.c | 126 ++++++++++++++++++++ > sprinter.h | 68 +++++++++++ > test/json | 34 +++--- > 6 files changed, 484 insertions(+), 232 deletions(-) > > Changes versus v6 of this patch: > - is_text_printer is now a field, not a function. > - minor formatting > - sprinter_text_search has been renamed to sprinter_text (as it contains > no search-specific code). > - string sanitization removed from sprinter_text, the caller should > sanitize the strings.