Re: Exporting a single email as JSON
authorCiprian Dorin Craciun <ciprian.craciun@gmail.com>
Sat, 10 Dec 2011 22:46:51 +0000 (00:46 +0200)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:40:43 +0000 (09:40 -0800)
f5/61a583d0ddc5a8c23a1874f383ee00b7367108 [new file with mode: 0644]

diff --git a/f5/61a583d0ddc5a8c23a1874f383ee00b7367108 b/f5/61a583d0ddc5a8c23a1874f383ee00b7367108
new file mode 100644 (file)
index 0000000..46306db
--- /dev/null
@@ -0,0 +1,120 @@
+Return-Path: <ciprian.craciun@gmail.com>\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 2ACA2429E25\r
+       for <notmuch@notmuchmail.org>; Sat, 10 Dec 2011 14:46:52 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.799\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.799 tagged_above=-999 required=5\r
+       tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,\r
+       FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\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 vXVVG4ZrQZNG for <notmuch@notmuchmail.org>;\r
+       Sat, 10 Dec 2011 14:46:51 -0800 (PST)\r
+Received: from mail-iy0-f181.google.com (mail-iy0-f181.google.com\r
+       [209.85.210.181]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
+       (No client certificate requested)\r
+       by olra.theworths.org (Postfix) with ESMTPS id 9CBBC431FB6\r
+       for <notmuch@notmuchmail.org>; Sat, 10 Dec 2011 14:46:51 -0800 (PST)\r
+Received: by iaoo28 with SMTP id o28so6296619iao.26\r
+       for <notmuch@notmuchmail.org>; Sat, 10 Dec 2011 14:46:51 -0800 (PST)\r
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;\r
+       h=mime-version:in-reply-to:references:date:message-id:subject:from:to\r
+       :cc:content-type:content-transfer-encoding;\r
+       bh=rg1E5oJ4/JFP4aqEkwp46vWcDAcIb8B63s7KqRb+GZA=;\r
+       b=KKy/HkEpQyVIT4whbYF/zTHdcTGoAPT2+v9HWCp7KSPT1nZU4CO16lkP/oB84mxiUh\r
+       SRilBkCg2SaPEIah+V/iLWD+HYZyutx1oo63rk+VsKQwjChhg1YqW8/oSq4mXibedoZP\r
+       beLxCd2AsOahceHtan1FgrNuOA2yZPHDFDL/M=\r
+MIME-Version: 1.0\r
+Received: by 10.182.221.72 with SMTP id qc8mr1670856obc.49.1323557211142; Sat,\r
+       10 Dec 2011 14:46:51 -0800 (PST)\r
+Received: by 10.182.222.35 with HTTP; Sat, 10 Dec 2011 14:46:51 -0800 (PST)\r
+In-Reply-To: <87zkf05gk4.fsf@servo.finestructure.net>\r
+References:\r
+ <CA+Tk8fycS4kmBRABRS4vFQLb3v0-ajcLZwPOwwEf98yvObgpwA@mail.gmail.com>\r
+       <87zkf05gk4.fsf@servo.finestructure.net>\r
+Date: Sun, 11 Dec 2011 00:46:51 +0200\r
+Message-ID:\r
+ <CA+Tk8fw+ky6hS0JGLQ4THOf+PSEZhSpfXRF=haayfAdF8HB6PQ@mail.gmail.com>\r
+Subject: Re: Exporting a single email as JSON\r
+From: Ciprian Dorin Craciun <ciprian.craciun@gmail.com>\r
+To: Jameson Graef Rollins <jrollins@finestructure.net>\r
+Content-Type: text/plain; charset=UTF-8\r
+Content-Transfer-Encoding: quoted-printable\r
+Cc: notmuch@notmuchmail.org\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\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: Sat, 10 Dec 2011 22:46:52 -0000\r
+\r
+On Sat, Dec 10, 2011 at 22:15, Jameson Graef Rollins\r
+<jrollins@finestructure.net> wrote:\r
+> On Sat, 10 Dec 2011 20:32:22 +0200, Ciprian Dorin Craciun <ciprian.craciu=\r
+n@gmail.com> wrote:\r
+>> =C2=A0 =C2=A0 Quick question: why isn't it reasonable to export a **sing=\r
+le**\r
+>> email in JSON format (by using the `show` sub-command)? (I mean I\r
+>> understand that in order to be able to correctly parse the output we\r
+>> need only one "object" (i.e. a list of threads, containing a list of\r
+>> emails, etc.). But there might be use cases in which we need a\r
+>> "twist".)\r
+>\r
+> Hi, Ciprian. =C2=A0I agree that it would be nice too have the ability to\r
+> output single messages without the rest of their thread. =C2=A0I have on\r
+> occasion wanted this functionality, but never enough to get around to\r
+> implementing it. =C2=A0It definitely wouldn't be that hard to implement,\r
+> though.\r
+>\r
+> The notmuch show function is actually going through a pretty major\r
+> overhaul at the moment. =C2=A0I bet as soon as that's done we can get som=\r
+e\r
+> sort of single-message output going.\r
+>\r
+> jamie.\r
+\r
+\r
+    I've given a quick look into `notmuch-show.c` (commit from\r
+December 4) and indeed it seems quite trivial to add new formats.\r
+\r
+    Thus I wonder:\r
+    a) Is the code suitable for experimenting such a feature? (I mean\r
+is the "overhaul" almost done, or still in progress?)\r
+    b) What would be the estimate for the "overhaul" completion? (To\r
+start prototyping such a feature...)\r
+    c) Would someone else be interested in such a feature? (Or it's\r
+something so remote that only the two of us stumbled upon it?)\r
+\r
+    I think it's quite hard to get this feature "right". I.e. I can\r
+see the following different -- but equally likely -- use-cases:\r
+    * in my use-case I would need each line of the output to be a\r
+standalone JSON object of an individual message; (thus I can script\r
+with Bash `notmuch ... | while read message ; do ... ; done`;)\r
+    * maybe someone else would need that the output to contain\r
+**exactly one** such message (maybe the first);\r
+    * and maybe for someone else the use case involves having no\r
+`--entire-thread` by default;\r
+    * further more someone else would actually prefer a "flatten" list\r
+of messages (not the currently nested list);\r
+    * or maybe the separator in the first use case should be `\0`\r
+instead of `\n`;\r
+\r
+    Thanks,\r
+    Ciprian.\r
+\r
+    P.S.: I think all sub-commands that output line-feed separated\r
+records should also have the option to split them instead with `\0`.\r
+(I.e. `xargs` insists upon this I think, if not it separates by space\r
+or new-line.)\r