Re: [PATCH v4 3/3] Use the structured format printer for JSON in notmuch search.
authorAustin Clements <amdragon@MIT.EDU>
Fri, 13 Jul 2012 00:10:37 +0000 (20:10 +2000)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:48:14 +0000 (09:48 -0800)
49/7ecccd8795c6ebddc5af42f97bbffceffd874c [new file with mode: 0644]

diff --git a/49/7ecccd8795c6ebddc5af42f97bbffceffd874c b/49/7ecccd8795c6ebddc5af42f97bbffceffd874c
new file mode 100644 (file)
index 0000000..67e39d1
--- /dev/null
@@ -0,0 +1,110 @@
+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 90550431FAF\r
+       for <notmuch@notmuchmail.org>; Thu, 12 Jul 2012 17:10:40 -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 FaBU+HK2vsNG for <notmuch@notmuchmail.org>;\r
+       Thu, 12 Jul 2012 17:10:40 -0700 (PDT)\r
+Received: from dmz-mailsec-scanner-7.mit.edu (DMZ-MAILSEC-SCANNER-7.MIT.EDU\r
+       [18.7.68.36])\r
+       by olra.theworths.org (Postfix) with ESMTP id 03E8F431FAE\r
+       for <notmuch@notmuchmail.org>; Thu, 12 Jul 2012 17:10:39 -0700 (PDT)\r
+X-AuditID: 12074424-b7f2a6d0000008bf-4b-4fff677fd5d0\r
+Received: from mailhub-auth-2.mit.edu ( [18.7.62.36])\r
+       by dmz-mailsec-scanner-7.mit.edu (Symantec Messaging Gateway) with SMTP\r
+       id 72.57.02239.F776FFF4; Thu, 12 Jul 2012 20:10:39 -0400 (EDT)\r
+Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103])\r
+       by mailhub-auth-2.mit.edu (8.13.8/8.9.2) with ESMTP id q6D0AdxB006693; \r
+       Thu, 12 Jul 2012 20:10:39 -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 q6D0AcfK002299\r
+       (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT);\r
+       Thu, 12 Jul 2012 20:10:38 -0400 (EDT)\r
+Received: from amthrax by awakening.csail.mit.edu with local (Exim 4.77)\r
+       (envelope-from <amdragon@mit.edu>)\r
+       id 1SpTSv-00057N-W3; Thu, 12 Jul 2012 20:10:38 -0400\r
+Date: Thu, 12 Jul 2012 20:10:37 -0400\r
+From: Austin Clements <amdragon@MIT.EDU>\r
+To: craven@gmx.net\r
+Subject: Re: [PATCH v4 3/3] Use the structured format printer for JSON in\r
+       notmuch search.\r
+Message-ID: <20120713001037.GL7332@mit.edu>\r
+References: <87d34hsdx8.fsf@awakening.csail.mit.edu>\r
+       <1342079004-5300-1-git-send-email-craven@gmx.net>\r
+       <1342079004-5300-4-git-send-email-craven@gmx.net>\r
+       <20120713000234.GK7332@mit.edu>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain; charset=us-ascii\r
+Content-Disposition: inline\r
+In-Reply-To: <20120713000234.GK7332@mit.edu>\r
+User-Agent: Mutt/1.5.21 (2010-09-15)\r
+X-Brightmail-Tracker:\r
+ H4sIAAAAAAAAA+NgFmplleLIzCtJLcpLzFFi42IRYrdT0a1P/+9vsH6FjMXehnZGi+s3ZzI7\r
+       MHks3rSfzePZqlvMAUxRXDYpqTmZZalF+nYJXBm7vs1kLnjCW3HkeCdzA2MjdxcjJ4eEgInE\r
+       712fWCFsMYkL99azdTFycQgJ7GOUaL9zgBHC2cAo8fvHZyYI5ySTxKGr96CcJYwSR9etYAfp\r
+       ZxFQlfj1fRsLiM0moCGxbf9yRhBbREBIYtKXV2BxZgFpiW+/m5lAbGGBaIkJ0y6D2bwC2hJ/\r
+       Gt8xw+1+NO8YK0RCUOLkzCdQzVoSN/69BGrgABu0/B8HSJhTQEfiaPsJsHJRARWJKSe3sU1g\r
+       FJqFpHsWku5ZCN0LGJlXMcqm5Fbp5iZm5hSnJusWJyfm5aUW6Zrr5WaW6KWmlG5iBIe2i8oO\r
+       xuZDSocYBTgYlXh4f8X+9xdiTSwrrsw9xCjJwaQkyjs/FSjEl5SfUpmRWJwRX1Sak1p8iFGC\r
+       g1lJhHedPVCONyWxsiq1KB8mJc3BoiTOez3lpr+QQHpiSWp2ampBahFMVoaDQ0mC91waUKNg\r
+       UWp6akVaZk4JQpqJgxNkOA/Q8L0gNbzFBYm5xZnpEPlTjIpS4rxtIAkBkERGaR5cLyz1vGIU\r
+       B3pFGKKdB5i24LpfAQ1mAho86+c/kMEliQgpqQZG35z3/GsatiUdlbNtemB7k7k/4ym7f9tM\r
+       i4k/JV50nSly3nGU9eeft96VMTuqfRsyrrfIbrNPf7zZMif9eMjaiBwuxtPFPCn2radsvvzd\r
+       5263J6vV7cXSGyl+novl3AsYdx98vfsHs9+UEO9Htn7xc9zWlM1o2Kxx/srSuYq102Lf7Sw5\r
+       GqCmxFKckWioxVxUnAgAmxy7gRgDAAA=\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: Fri, 13 Jul 2012 00:10:40 -0000\r
+\r
+Quoth myself on Jul 12 at  8:02 pm:\r
+> This is fantastic.  It simplifies the code a lot, and I think it opens\r
+> up opportunities to simplify it even further.\r
+> \r
+> Detailed comments are below, but first one general comment.  For the\r
+> text format, I wonder if most of the special case code would go away\r
+> with a stub sprinter that did nothing for most operations and for\r
+> string printed the string followed by a newline (or maybe the newline\r
+> would be printed by the "frame" method or whatever you end up calling\r
+> it).  I believe this would unify all of the code in do_search_tags and\r
+> do_search_files between the two formats.  For do_search_threads,\r
+> you'll still need some special-casing to format the summary line, but\r
+> I think it would unify all of the framing code.  (If this does work\r
+> out, some of my comments below will be irrelevant.)\r
+\r
+Oh, wait, the text format adds prefixes...\r
+\r
+I think something along the lines of what I described above would\r
+still simplify things.  I can think of two ways to do it.  You could\r
+have a completely stub sprinter where everything is a no-op; that\r
+would at least save the predication of calls like\r
+format->begin_list ().  Or, you could have an additional function for\r
+the text formatter that registers a prefix, and have the string method\r
+first print that prefix and then the argument string.  This additional\r
+function doesn't have to be a method of sprinter; it could just be a\r
+regular function that stashes the prefix away somewhere (a global\r
+variable's probably fine; if you want to be fancy you store it in an\r
+sprinter_text extension of sprinter_t like the one JSON uses).  For\r
+the JSON format, this would be a no-op, so you could call it\r
+regardless of what format you've selected.\r