[PATCH 4/4] Update NEWS for user.other_name
[notmuch-archives.git] / f4 / 763c2bb8f7b6e41c83bd14e23e957ae7a064fc
1 Return-Path: <m.walters@qmul.ac.uk>\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 B57D0431FC7\r
6         for <notmuch@notmuchmail.org>; Thu, 12 Jul 2012 02:21:56 -0700 (PDT)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: -1.098\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=-1.098 tagged_above=-999 required=5\r
12         tests=[DKIM_ADSP_CUSTOM_MED=0.001, FREEMAIL_FROM=0.001,\r
13         NML_ADSP_CUSTOM_MED=1.2, RCVD_IN_DNSWL_MED=-2.3] autolearn=disabled\r
14 Received: from olra.theworths.org ([127.0.0.1])\r
15         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
16         with ESMTP id jFHSvwIOdpCj for <notmuch@notmuchmail.org>;\r
17         Thu, 12 Jul 2012 02:21:56 -0700 (PDT)\r
18 Received: from mail2.qmul.ac.uk (mail2.qmul.ac.uk [138.37.6.6])\r
19         (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))\r
20         (No client certificate requested)\r
21         by olra.theworths.org (Postfix) with ESMTPS id C60C9431FAE\r
22         for <notmuch@notmuchmail.org>; Thu, 12 Jul 2012 02:21:55 -0700 (PDT)\r
23 Received: from smtp.qmul.ac.uk ([138.37.6.40])\r
24         by mail2.qmul.ac.uk with esmtp (Exim 4.71)\r
25         (envelope-from <m.walters@qmul.ac.uk>)\r
26         id 1SpFar-0003s2-SS; Thu, 12 Jul 2012 10:21:54 +0100\r
27 Received: from 94-192-233-223.zone6.bethere.co.uk ([94.192.233.223]\r
28         helo=localhost)\r
29         by smtp.qmul.ac.uk with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.69)\r
30         (envelope-from <m.walters@qmul.ac.uk>)\r
31         id 1SpFar-0001iA-F5; Thu, 12 Jul 2012 10:21:53 +0100\r
32 From: Mark Walters <markwalters1009@gmail.com>\r
33 To: craven@gmx.net, notmuch@notmuchmail.org\r
34 Subject: Re: [PATCH v4 1/3] Add support for structured output formatters.\r
35 In-Reply-To: <1342079004-5300-2-git-send-email-craven@gmx.net>\r
36 References: <87d34hsdx8.fsf@awakening.csail.mit.edu>\r
37         <1342079004-5300-1-git-send-email-craven@gmx.net>\r
38         <1342079004-5300-2-git-send-email-craven@gmx.net>\r
39 User-Agent: Notmuch/0.13.2+61~gf708609 (http://notmuchmail.org) Emacs/23.4.1\r
40         (x86_64-pc-linux-gnu)\r
41 Date: Thu, 12 Jul 2012 10:21:51 +0100\r
42 Message-ID: <87pq81tjv4.fsf@qmul.ac.uk>\r
43 MIME-Version: 1.0\r
44 Content-Type: text/plain; charset=us-ascii\r
45 X-Sender-Host-Address: 94.192.233.223\r
46 X-QM-SPAM-Info: Sender has good ham record.  :)\r
47 X-QM-Body-MD5: 3f501e9c07fc91483d22fb48a286358c (of first 20000 bytes)\r
48 X-SpamAssassin-Score: -1.8\r
49 X-SpamAssassin-SpamBar: -\r
50 X-SpamAssassin-Report: The QM spam filters have analysed this message to\r
51         determine if it is\r
52         spam. We require at least 5.0 points to mark a message as spam.\r
53         This message scored -1.8 points.\r
54         Summary of the scoring: \r
55         * -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at http://www.dnswl.org/,\r
56         *      medium trust\r
57         *      [138.37.6.40 listed in list.dnswl.org]\r
58         * 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail\r
59         provider *      (markwalters1009[at]gmail.com)\r
60         * -0.0 T_RP_MATCHES_RCVD Envelope sender domain matches handover relay\r
61         *      domain\r
62         *  0.5 AWL AWL: From: address is in the auto white-list\r
63 X-QM-Scan-Virus: ClamAV says the message is clean\r
64 X-BeenThere: notmuch@notmuchmail.org\r
65 X-Mailman-Version: 2.1.13\r
66 Precedence: list\r
67 List-Id: "Use and development of the notmuch mail system."\r
68         <notmuch.notmuchmail.org>\r
69 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
70         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
71 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
72 List-Post: <mailto:notmuch@notmuchmail.org>\r
73 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
74 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
75         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
76 X-List-Received-Date: Thu, 12 Jul 2012 09:21:56 -0000\r
77 \r
78 \r
79 A couple more things:\r
80 \r
81 On Thu, 12 Jul 2012, craven@gmx.net wrote:\r
82 > This patch adds a new type sprinter_t, which is used for structured\r
83 > formatting, e.g. JSON or S-Expressions. The structure printer is the\r
84 > code from Austin Clements (id:87d34hsdx8.fsf@awakening.csail.mit.edu).\r
85 >\r
86 > The structure printer contains the following function pointers:\r
87 >\r
88 > /* start a new map/dictionary structure.\r
89 >  */\r
90 > void (*begin_map) (struct sprinter *);\r
91 >\r
92 > /* start a new list/array structure\r
93 >  */\r
94 > void (*begin_list) (struct sprinter *);\r
95 >\r
96 > /* end the last opened list or map structure\r
97 >  */\r
98 > void (*end) (struct sprinter *);\r
99 \r
100 what is the advantage of having this as one function rather than end_map\r
101 and end_list? Indeed, my choice (but I think most other people would\r
102 disagree) would be to have both functions but still keep state as this\r
103 currently does and then throw an error if the code closes the wrong\r
104 thing.\r
105 \r
106 A second question: do you have an implementation in this style for\r
107 s-expressions. I find it hard to tell whether the interface is right\r
108 with just a single example. Even a completely hacky not ready for review\r
109 example would be helpful.\r
110 \r
111 Best wishes\r
112 \r
113 Mark\r
114 \r
115 > /* print one string/integer/boolean/null element (possibly inside a\r
116 >  * list or map\r
117 >  */\r
118 > void (*string) (struct sprinter *, const char *);\r
119 > void (*integer) (struct sprinter *, int);\r
120 > void (*boolean) (struct sprinter *, notmuch_bool_t);\r
121 > void (*null) (struct sprinter *);\r
122 >\r
123 > /* print the key of a map's key/value pair.\r
124 >  */\r
125 > void (*map_key) (struct sprinter *, const char *);\r
126 >\r
127 > /* print a frame delimiter (such as a newline or extra whitespace)\r
128 >  */\r
129 > void (*frame) (struct sprinter *);\r
130 >\r
131 > The printer can (and should) use internal state to insert delimiters and\r
132 > syntax at the correct places.\r
133 >\r
134 > Example:\r
135 >\r
136 > format->begin_map(format);\r
137 > format->map_key(format, "foo");\r
138 > format->begin_list(format);\r
139 > format->integer(format, 1);\r
140 > format->integer(format, 2);\r
141 > format->integer(format, 3);\r
142 > format->end(format);\r
143 > format->map_key(format, "bar");\r
144 > format->begin_map(format);\r
145 > format->map_key(format, "baaz");\r
146 > format->string(format, "hello world");\r
147 > format->end(format);\r
148 > format->end(format);\r
149 >\r
150 > would output JSON as follows:\r
151 >\r
152 > {"foo": [1, 2, 3], "bar": { "baaz": "hello world"}}\r
153 > ---\r
154 >  sprinter.h | 49 +++++++++++++++++++++++++++++++++++++++++++++++++\r
155 >  1 file changed, 49 insertions(+)\r
156 >  create mode 100644 sprinter.h\r
157 >\r
158 > diff --git a/sprinter.h b/sprinter.h\r
159 > new file mode 100644\r
160 > index 0000000..1dad9a0\r
161 > --- /dev/null\r
162 > +++ b/sprinter.h\r
163 > @@ -0,0 +1,49 @@\r
164 > +#ifndef NOTMUCH_SPRINTER_H\r
165 > +#define NOTMUCH_SPRINTER_H\r
166 > +\r
167 > +/* for notmuch_bool_t */\r
168 > +#include "notmuch-client.h"\r
169 > +\r
170 > +/* Structure printer interface */\r
171 > +typedef struct sprinter\r
172 > +{\r
173 > +    /* start a new map/dictionary structure.\r
174 > +     */\r
175 > +    void (*begin_map) (struct sprinter *);\r
176 > +\r
177 > +    /* start a new list/array structure\r
178 > +     */\r
179 > +    void (*begin_list) (struct sprinter *);\r
180 > +\r
181 > +    /* end the last opened list or map structure\r
182 > +     */\r
183 > +    void (*end) (struct sprinter *);\r
184 > +\r
185 > +    /* print one string/integer/boolean/null element (possibly inside a\r
186 > +     * list or map\r
187 > +     */\r
188 > +    void (*string) (struct sprinter *, const char *);\r
189 > +    void (*integer) (struct sprinter *, int);\r
190 > +    void (*boolean) (struct sprinter *, notmuch_bool_t);\r
191 > +    void (*null) (struct sprinter *);\r
192 > +\r
193 > +    /* print the key of a map's key/value pair.\r
194 > +     */\r
195 > +    void (*map_key) (struct sprinter *, const char *);\r
196 > +\r
197 > +    /* print a frame delimiter (such as a newline or extra whitespace)\r
198 > +     */\r
199 > +    void (*frame) (struct sprinter *);\r
200 > +} sprinter_t;\r
201 > +\r
202 > +/* Create a new structure printer that emits JSON */\r
203 > +struct sprinter *\r
204 > +sprinter_json_new(const void *ctx, FILE *stream);\r
205 > +\r
206 > +/* A dummy structure printer that signifies that standard text output is\r
207 > + * to be used instead of any structured format.\r
208 > + */\r
209 > +struct sprinter *\r
210 > +sprinter_text;\r
211 > +\r
212 > +#endif // NOTMUCH_SPRINTER_H\r
213 > -- \r
214 > 1.7.11.1\r
215 >\r
216 > _______________________________________________\r
217 > notmuch mailing list\r
218 > notmuch@notmuchmail.org\r
219 > http://notmuchmail.org/mailman/listinfo/notmuch\r