Re: [notmuch] RFC: output json from notmuch?
authorCarl Worth <cworth@cworth.org>
Mon, 14 Dec 2009 22:30:45 +0000 (14:30 +1600)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:35:53 +0000 (09:35 -0800)
7c/9b9e1d015fb77a02711a4d040331762206e505 [new file with mode: 0644]

diff --git a/7c/9b9e1d015fb77a02711a4d040331762206e505 b/7c/9b9e1d015fb77a02711a4d040331762206e505
new file mode 100644 (file)
index 0000000..c9b1dfd
--- /dev/null
@@ -0,0 +1,107 @@
+Return-Path: <cworth@cworth.org>\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 4CC48431FBD;\r
+       Mon, 14 Dec 2009 14:30:47 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\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 KsfCkrdPmXTO; Mon, 14 Dec 2009 14:30:46 -0800 (PST)\r
+Received: from yoom.home.cworth.org (localhost [127.0.0.1])\r
+       by olra.theworths.org (Postfix) with ESMTP id 58D58431FAE;\r
+       Mon, 14 Dec 2009 14:30:46 -0800 (PST)\r
+Received: by yoom.home.cworth.org (Postfix, from userid 1000)\r
+       id 0D20C254307; Mon, 14 Dec 2009 14:30:46 -0800 (PST)\r
+From: Carl Worth <cworth@cworth.org>\r
+To: David Bremner <david@tethera.net>, notmuch@notmuchmail.org\r
+In-Reply-To: <87iqcapijl.fsf@pivot.cs.unb.ca>\r
+References: <87iqcapijl.fsf@pivot.cs.unb.ca>\r
+Date: Mon, 14 Dec 2009 14:30:45 -0800\r
+Message-ID: <87k4wp2noq.fsf@yoom.home.cworth.org>\r
+MIME-Version: 1.0\r
+Content-Type: multipart/signed; boundary="=-=-=";\r
+       micalg=pgp-sha1; protocol="application/pgp-signature"\r
+Subject: Re: [notmuch] RFC: output json from notmuch?\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.12\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: Mon, 14 Dec 2009 22:30:47 -0000\r
+\r
+--=-=-=\r
+\r
+On Sun, 13 Dec 2009 19:21:02 -0400, David Bremner <david@tethera.net> wrote:\r
+> It would be nice to have more structured output from notmuch-show.  I\r
+> decided to investigate sexp (i.e. lisp) and json output.\r
+\r
+Thanks, David!\r
+\r
+> Then I found that json parsing is provided by the library json.el\r
+> shipped with emacs23, so I decided to play with json a bit.\r
+\r
+That sounds very promising. I wasn't aware this existed inside emacs\r
+already.\r
+\r
+> I settled on the jansson library (http://www.digip.org/jansson/)\r
+> because it seemed to have a sane api and documentation, but there are\r
+> many choices.  I'll follow up with the actual patch, but the idea is to\r
+> replace the printfs in show_message with calls to set (key,value) pairs\r
+> in a json object, and output it at the end.\r
+\r
+I'm still not sure of the need to depend on a library just to *generate*\r
+any particular format. I would expect that job to be so constrained as\r
+to be almost trivial. I won't necessarily block a patch based on that,\r
+but I think we should at least look at how easy it would be to just emit\r
+the syntax manually.\r
+\r
+> So, do people think this is a reasonable idea to persue?\r
+\r
+I do, yes. The current lack of full quoting is an obnoxious bug.\r
+\r
+>     1) it adds a dependency, but not a heavy one. jansson is about 300k\r
+>     installed on debian/i386\r
+\r
+That might be acceptable. And we might rewrite the patch to avoid it as\r
+well. I'd like to see what that would take.\r
+\r
+>     2) It might mean that people using emacs22 might have to score\r
+>     json.el from somewhere; I'm not sure.\r
+\r
+Currently, it sounds like notmuch is entirely unusable from emacs22, so\r
+I'm really not too concerned about one more thing that requires emacs\r
+23.\r
+\r
+>     3) There is some increase in memory use since the whole thread has\r
+>     to be built as a json object before being output.\r
+\r
+Right. That would be another reason to just stream the output\r
+manually. The syntax doesn't require things like knowing the size of an\r
+array before emitting the first element, right?\r
+\r
+>     4) Of course jansson is doing it's own reference counting memory\r
+>     managment, and not using talloc. But we already have glib...\r
+\r
+It's not evil to not use talloc. So not an issue there.\r
+\r
+-Carl\r
+\r
+--=-=-=\r
+Content-Type: application/pgp-signature\r
+\r
+-----BEGIN PGP SIGNATURE-----\r
+Version: GnuPG v1.4.10 (GNU/Linux)\r
+\r
+iD8DBQFLJryV6JDdNq8qSWgRAroZAKCgRw09bP1to8pW9KJTu2DeGYZQVwCgpRVJ\r
+DkiWuy4m2KTFJg05RutuSls=\r
+=JyyV\r
+-----END PGP SIGNATURE-----\r
+--=-=-=--\r