Re: notmuch-reply: Structured Formatters
authorAustin Clements <amdragon@MIT.EDU>
Sun, 22 Jul 2012 16:13:13 +0000 (12:13 +2000)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:48:28 +0000 (09:48 -0800)
13/542f3cc4f757e122483c233efa264beefff9c3 [new file with mode: 0644]

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