Re: Missing headers when forwarding html message as RFC822
[notmuch-archives.git] / d4 / 129d9ad74f1b95906223f3581a84a21405f373
1 Return-Path: <bremner@pivot.cs.unb.ca>\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 9EDD0431FBC\r
6         for <notmuch@notmuchmail.org>; Sun, 13 Dec 2009 15:21:10 -0800 (PST)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 Received: from olra.theworths.org ([127.0.0.1])\r
9         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
10         with ESMTP id 0QJPvVJANcZv for <notmuch@notmuchmail.org>;\r
11         Sun, 13 Dec 2009 15:21:09 -0800 (PST)\r
12 Received: from pivot.cs.unb.ca (pivot.cs.unb.ca [131.202.240.57])\r
13         by olra.theworths.org (Postfix) with ESMTP id CAA99431FAE\r
14         for <notmuch@notmuchmail.org>; Sun, 13 Dec 2009 15:21:09 -0800 (PST)\r
15 Received: from\r
16         fctnnbsc30w-142167182194.pppoe-dynamic.high-speed.nb.bellaliant.net\r
17         ([142.167.182.194] helo=localhost)\r
18         by pivot.cs.unb.ca with esmtpsa (TLS1.0:RSA_AES_256_CBC_SHA1:32)\r
19         (Exim 4.69) (envelope-from <bremner@pivot.cs.unb.ca>)\r
20         id 1NJxkS-00060n-NC\r
21         for notmuch@notmuchmail.org; Sun, 13 Dec 2009 19:21:09 -0400\r
22 Received: from bremner by localhost with local (Exim 4.69)\r
23         (envelope-from <bremner@pivot.cs.unb.ca>) id 1NJxkM-0001AI-Uw\r
24         for notmuch@notmuchmail.org; Sun, 13 Dec 2009 19:21:02 -0400\r
25 From: David Bremner <david@tethera.net>\r
26 To: notmuch@notmuchmail.org\r
27 Date: Sun, 13 Dec 2009 19:21:02 -0400\r
28 Message-ID: <87iqcapijl.fsf@pivot.cs.unb.ca>\r
29 MIME-Version: 1.0\r
30 Content-Type: text/plain; charset=us-ascii\r
31 X-Sender-Verified: bremner@pivot.cs.unb.ca\r
32 Subject: [notmuch] RFC: output json from notmuch?\r
33 X-BeenThere: notmuch@notmuchmail.org\r
34 X-Mailman-Version: 2.1.12\r
35 Precedence: list\r
36 List-Id: "Use and development of the notmuch mail system."\r
37         <notmuch.notmuchmail.org>\r
38 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
39         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
40 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
41 List-Post: <mailto:notmuch@notmuchmail.org>\r
42 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
43 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
44         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
45 X-List-Received-Date: Sun, 13 Dec 2009 23:21:10 -0000\r
46 \r
47 \r
48 It would be nice to have more structured output from notmuch-show.  I\r
49 decided to investigate sexp (i.e. lisp) and json output.\r
50 \r
51 Sexp has the obvious advantage that it is trivially parsable in emacs;\r
52 for other clients it is a little more work.  I started looking at\r
53 sfsexp (http://sexpr.sourceforge.net).  It looks ok; I got a little\r
54 irritated that it doesn't support cons cells (i.e. dotted pairs). \r
55 \r
56 Then I found that json parsing is provided by the library json.el\r
57 shipped with emacs23, so I decided to play with json a bit.\r
58 \r
59 I settled on the jansson library (http://www.digip.org/jansson/)\r
60 because it seemed to have a sane api and documentation, but there are\r
61 many choices.  I'll follow up with the actual patch, but the idea is to\r
62 replace the printfs in show_message with calls to set (key,value) pairs\r
63 in a json object, and output it at the end.\r
64 \r
65 This is not in any sense a production patch (e.g. it needs to actually\r
66 return a thread object rather than just dumping messages out; nothing at\r
67 all has been done on the emacs side), but it gives you some idea of\r
68 would be involved.\r
69 \r
70 So, do people think this is a reasonable idea to persue?\r
71 \r
72     1) it adds a dependency, but not a heavy one. jansson is about 300k\r
73     installed on debian/i386\r
74 \r
75     2) It might mean that people using emacs22 might have to score\r
76     json.el from somewhere; I'm not sure.\r
77 \r
78     3) There is some increase in memory use since the whole thread has\r
79     to be built as a json object before being output.\r
80 \r
81     4) Of course jansson is doing it's own reference counting memory\r
82     managment, and not using talloc. But we already have glib...\r
83 \r
84 Of course we won't really know if it is good idea until we try it, but\r
85 if it already looks like a no-go, I'll stop.\r
86 \r
87 Attachments:  json output of a message from carl, and the equivalent\r
88 sexpr as parsed by json.el.  \r
89 \r
90 \r
91 \r
92 \r
93 -- \r
94 David Bremner                                  Professor, UNB Computer Science\r
95 bremner@unb.ca                             \r
96 http://www.cs.unb.ca/~bremner               Cross Appointment, UNB Mathematics\r
97 http://www.mitacs.ca/                      MITACS Atlantic Scientific Director\r