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