1 Return-Path: <amdragon@mit.edu>
\r
2 X-Original-To: notmuch@notmuchmail.org
\r
3 Delivered-To: notmuch@notmuchmail.org
\r
4 Received: from localhost (localhost [127.0.0.1])
\r
5 by olra.theworths.org (Postfix) with ESMTP id 90550431FAF
\r
6 for <notmuch@notmuchmail.org>; Thu, 12 Jul 2012 17:10:40 -0700 (PDT)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5
\r
12 tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled
\r
13 Received: from olra.theworths.org ([127.0.0.1])
\r
14 by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)
\r
15 with ESMTP id FaBU+HK2vsNG for <notmuch@notmuchmail.org>;
\r
16 Thu, 12 Jul 2012 17:10:40 -0700 (PDT)
\r
17 Received: from dmz-mailsec-scanner-7.mit.edu (DMZ-MAILSEC-SCANNER-7.MIT.EDU
\r
19 by olra.theworths.org (Postfix) with ESMTP id 03E8F431FAE
\r
20 for <notmuch@notmuchmail.org>; Thu, 12 Jul 2012 17:10:39 -0700 (PDT)
\r
21 X-AuditID: 12074424-b7f2a6d0000008bf-4b-4fff677fd5d0
\r
22 Received: from mailhub-auth-2.mit.edu ( [18.7.62.36])
\r
23 by dmz-mailsec-scanner-7.mit.edu (Symantec Messaging Gateway) with SMTP
\r
24 id 72.57.02239.F776FFF4; Thu, 12 Jul 2012 20:10:39 -0400 (EDT)
\r
25 Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103])
\r
26 by mailhub-auth-2.mit.edu (8.13.8/8.9.2) with ESMTP id q6D0AdxB006693;
\r
27 Thu, 12 Jul 2012 20:10:39 -0400
\r
28 Received: from awakening.csail.mit.edu (awakening.csail.mit.edu [18.26.4.91])
\r
29 (authenticated bits=0)
\r
30 (User authenticated as amdragon@ATHENA.MIT.EDU)
\r
31 by outgoing.mit.edu (8.13.6/8.12.4) with ESMTP id q6D0AcfK002299
\r
32 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT);
\r
33 Thu, 12 Jul 2012 20:10:38 -0400 (EDT)
\r
34 Received: from amthrax by awakening.csail.mit.edu with local (Exim 4.77)
\r
35 (envelope-from <amdragon@mit.edu>)
\r
36 id 1SpTSv-00057N-W3; Thu, 12 Jul 2012 20:10:38 -0400
\r
37 Date: Thu, 12 Jul 2012 20:10:37 -0400
\r
38 From: Austin Clements <amdragon@MIT.EDU>
\r
40 Subject: Re: [PATCH v4 3/3] Use the structured format printer for JSON in
\r
42 Message-ID: <20120713001037.GL7332@mit.edu>
\r
43 References: <87d34hsdx8.fsf@awakening.csail.mit.edu>
\r
44 <1342079004-5300-1-git-send-email-craven@gmx.net>
\r
45 <1342079004-5300-4-git-send-email-craven@gmx.net>
\r
46 <20120713000234.GK7332@mit.edu>
\r
48 Content-Type: text/plain; charset=us-ascii
\r
49 Content-Disposition: inline
\r
50 In-Reply-To: <20120713000234.GK7332@mit.edu>
\r
51 User-Agent: Mutt/1.5.21 (2010-09-15)
\r
52 X-Brightmail-Tracker:
\r
53 H4sIAAAAAAAAA+NgFmplleLIzCtJLcpLzFFi42IRYrdT0a1P/+9vsH6FjMXehnZGi+s3ZzI7
\r
54 MHks3rSfzePZqlvMAUxRXDYpqTmZZalF+nYJXBm7vs1kLnjCW3HkeCdzA2MjdxcjJ4eEgInE
\r
55 712fWCFsMYkL99azdTFycQgJ7GOUaL9zgBHC2cAo8fvHZyYI5ySTxKGr96CcJYwSR9etYAfp
\r
56 ZxFQlfj1fRsLiM0moCGxbf9yRhBbREBIYtKXV2BxZgFpiW+/m5lAbGGBaIkJ0y6D2bwC2hJ/
\r
57 Gt8xw+1+NO8YK0RCUOLkzCdQzVoSN/69BGrgABu0/B8HSJhTQEfiaPsJsHJRARWJKSe3sU1g
\r
58 FJqFpHsWku5ZCN0LGJlXMcqm5Fbp5iZm5hSnJusWJyfm5aUW6Zrr5WaW6KWmlG5iBIe2i8oO
\r
59 xuZDSocYBTgYlXh4f8X+9xdiTSwrrsw9xCjJwaQkyjs/FSjEl5SfUpmRWJwRX1Sak1p8iFGC
\r
60 g1lJhHedPVCONyWxsiq1KB8mJc3BoiTOez3lpr+QQHpiSWp2ampBahFMVoaDQ0mC91waUKNg
\r
61 UWp6akVaZk4JQpqJgxNkOA/Q8L0gNbzFBYm5xZnpEPlTjIpS4rxtIAkBkERGaR5cLyz1vGIU
\r
62 B3pFGKKdB5i24LpfAQ1mAho86+c/kMEliQgpqQZG35z3/GsatiUdlbNtemB7k7k/4ym7f9tM
\r
63 i4k/JV50nSly3nGU9eeft96VMTuqfRsyrrfIbrNPf7zZMif9eMjaiBwuxtPFPCn2radsvvzd
\r
64 5263J6vV7cXSGyl+novl3AsYdx98vfsHs9+UEO9Htn7xc9zWlM1o2Kxx/srSuYq102Lf7Sw5
\r
65 GqCmxFKckWioxVxUnAgAmxy7gRgDAAA=
\r
66 Cc: notmuch@notmuchmail.org
\r
67 X-BeenThere: notmuch@notmuchmail.org
\r
68 X-Mailman-Version: 2.1.13
\r
70 List-Id: "Use and development of the notmuch mail system."
\r
71 <notmuch.notmuchmail.org>
\r
72 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
73 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
74 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
75 List-Post: <mailto:notmuch@notmuchmail.org>
\r
76 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
77 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
78 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
79 X-List-Received-Date: Fri, 13 Jul 2012 00:10:40 -0000
\r
81 Quoth myself on Jul 12 at 8:02 pm:
\r
82 > This is fantastic. It simplifies the code a lot, and I think it opens
\r
83 > up opportunities to simplify it even further.
\r
85 > Detailed comments are below, but first one general comment. For the
\r
86 > text format, I wonder if most of the special case code would go away
\r
87 > with a stub sprinter that did nothing for most operations and for
\r
88 > string printed the string followed by a newline (or maybe the newline
\r
89 > would be printed by the "frame" method or whatever you end up calling
\r
90 > it). I believe this would unify all of the code in do_search_tags and
\r
91 > do_search_files between the two formats. For do_search_threads,
\r
92 > you'll still need some special-casing to format the summary line, but
\r
93 > I think it would unify all of the framing code. (If this does work
\r
94 > out, some of my comments below will be irrelevant.)
\r
96 Oh, wait, the text format adds prefixes...
\r
98 I think something along the lines of what I described above would
\r
99 still simplify things. I can think of two ways to do it. You could
\r
100 have a completely stub sprinter where everything is a no-op; that
\r
101 would at least save the predication of calls like
\r
102 format->begin_list (). Or, you could have an additional function for
\r
103 the text formatter that registers a prefix, and have the string method
\r
104 first print that prefix and then the argument string. This additional
\r
105 function doesn't have to be a method of sprinter; it could just be a
\r
106 regular function that stashes the prefix away somewhere (a global
\r
107 variable's probably fine; if you want to be fancy you store it in an
\r
108 sprinter_text extension of sprinter_t like the one JSON uses). For
\r
109 the JSON format, this would be a no-op, so you could call it
\r
110 regardless of what format you've selected.
\r