Re: [RFC] Use JSON in emacs interface
authorAustin Clements <amdragon@MIT.EDU>
Sun, 29 Apr 2012 20:11:31 +0000 (16:11 +2000)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:46:49 +0000 (09:46 -0800)
32/6d5a6e0fc1117e2d781df88f85cba0fd7da5ba [new file with mode: 0644]

diff --git a/32/6d5a6e0fc1117e2d781df88f85cba0fd7da5ba b/32/6d5a6e0fc1117e2d781df88f85cba0fd7da5ba
new file mode 100644 (file)
index 0000000..79db9e7
--- /dev/null
@@ -0,0 +1,127 @@
+Return-Path: <amdragon@mit.edu>\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 0BFDA431FAF\r
+       for <notmuch@notmuchmail.org>; Sun, 29 Apr 2012 13:11:38 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.7\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5\r
+       tests=[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 XBT1hPpDCdP8 for <notmuch@notmuchmail.org>;\r
+       Sun, 29 Apr 2012 13:11:35 -0700 (PDT)\r
+Received: from dmz-mailsec-scanner-3.mit.edu (DMZ-MAILSEC-SCANNER-3.MIT.EDU\r
+       [18.9.25.14])\r
+       by olra.theworths.org (Postfix) with ESMTP id 60DBC431FAE\r
+       for <notmuch@notmuchmail.org>; Sun, 29 Apr 2012 13:11:35 -0700 (PDT)\r
+X-AuditID: 1209190e-b7fd86d0000008b4-aa-4f9da076cf97\r
+Received: from mailhub-auth-1.mit.edu ( [18.9.21.35])\r
+       by dmz-mailsec-scanner-3.mit.edu (Symantec Messaging Gateway) with SMTP\r
+       id 2E.F5.02228.670AD9F4; Sun, 29 Apr 2012 16:11:34 -0400 (EDT)\r
+Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103])\r
+       by mailhub-auth-1.mit.edu (8.13.8/8.9.2) with ESMTP id q3TKBXNg010169; \r
+       Sun, 29 Apr 2012 16:11:34 -0400\r
+Received: from awakening.csail.mit.edu (awakening.csail.mit.edu [18.26.4.91])\r
+       (authenticated bits=0)\r
+       (User authenticated as amdragon@ATHENA.MIT.EDU)\r
+       by outgoing.mit.edu (8.13.6/8.12.4) with ESMTP id q3TKBWLx024979\r
+       (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT);\r
+       Sun, 29 Apr 2012 16:11:32 -0400 (EDT)\r
+Received: from amthrax by awakening.csail.mit.edu with local (Exim 4.77)\r
+       (envelope-from <amdragon@mit.edu>)\r
+       id 1SOaSx-0003js-RY; Sun, 29 Apr 2012 16:11:31 -0400\r
+Date: Sun, 29 Apr 2012 16:11:31 -0400\r
+From: Austin Clements <amdragon@MIT.EDU>\r
+To: Chris Gray <chrismgray@gmail.com>\r
+Subject: Re: [RFC] Use JSON in emacs interface\r
+Message-ID: <20120429201131.GM2704@mit.edu>\r
+References: <87ty02v786.fsf@gmail.com>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain; charset=us-ascii\r
+Content-Disposition: inline\r
+In-Reply-To: <87ty02v786.fsf@gmail.com>\r
+User-Agent: Mutt/1.5.21 (2010-09-15)\r
+X-Brightmail-Tracker:\r
+ H4sIAAAAAAAAA+NgFprAKsWRmVeSWpSXmKPExsUixCmqrFu2YK6/wc8N3BZLz/xntrh+cyaz\r
+       A5PHzll32T2erbrFHMAUxWWTkpqTWZZapG+XwJVxcN1C1oJXQhWnXi9gamD8ydfFyMkhIWAi\r
+       0fz6ATuELSZx4d56ti5GLg4hgX2MEnt/3mCBcDYwSkzaOIUJwjnJJPH33Q8oZwmjxJvl/Swg\r
+       /SwCqhI3nm1lArHZBDQktu1fzghiiwDFd3fPB7OZBaQlvv1uBqsRFtCTmPDiHVgvr4C2xKU7\r
+       85lBbCEBNYkjb95CxQUlTs58wgLRqyVx499LoF4OsDnL/3GAhDkF1CWam9eAtYoKqEhMObmN\r
+       bQKj0Cwk3bOQdM9C6F7AyLyKUTYlt0o3NzEzpzg1Wbc4OTEvL7VI11gvN7NELzWldBMjOLAl\r
+       +XYwfj2odIhRgINRiYdXKHeOvxBrYllxZe4hRkkOJiVR3q+z5/oL8SXlp1RmJBZnxBeV5qQW\r
+       H2KU4GBWEuHVFgcq501JrKxKLcqHSUlzsCiJ86ppvfMTEkhPLEnNTk0tSC2CycpwcChJ8O6e\r
+       DzRUsCg1PbUiLTOnBCHNxMEJMpwHaPgckBre4oLE3OLMdIj8KUZdjnlTtl5lFGLJy89LlRLn\r
+       vQ9SJABSlFGaBzcHlpBeMYoDvSXMuxykigeYzOAmvQJawgS0hMlzFsiSkkSElFQDY1TVsQWe\r
+       hzumP0vsU/zivDG6JN9rt5rVWs7WKi23LcYbX3+SVWf8bdJTzO/w7Nf1ia2i/y1Vkks0mgp5\r
+       T64+5BLmOkGVj2lWxIxY0R1nFrb7Mv1z7D3roxnWuuOheljg5Gnln5dp6G9wcq5NbuG8dPPu\r
+       xP5s/zNxG6dpXPv1+J9y9Csr1uzZSizFGYmGWsxFxYkAYEuIASMDAAA=\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: Sun, 29 Apr 2012 20:11:38 -0000\r
+\r
+Quoth Chris Gray on Apr 29 at 10:22 am:\r
+> Hi,\r
+> \r
+> My thinking about this arises from the fact that there is a person on\r
+> one of the lists that I read who puts a semicolon after his name.  Of\r
+> course, this confuses the regex in notmuch-search-process-filter, which\r
+> expects that the first semicolon in the string representing a thread is\r
+> after all the authors.\r
+> \r
+> I first thought of changing the regex so that it looked for the last\r
+> semicolon in the string or something like that, but that would just move\r
+> the problem.  (Semicolons are probably more frequent in subject lines\r
+> than in author names.)  So it seems to me that what is needed is for\r
+> notmuch and emacs to talk with each other in a format that is\r
+> unambiguously parseable.  Since notmuch search already has the option of\r
+> outputting to JSON, that seems like a natural fit.\r
+> \r
+> Emacs has an existing JSON parser,\r
+> <http://cvs.savannah.gnu.org/viewvc/*checkout*/emacs/lisp/json.el?root=emacs>,\r
+> but it doesn't appear that it is able to parse progressively, meaning\r
+> that it wouldn't be able to display results as they come in from notmuch\r
+> search if used as-is.  My guess is that its parts could be hacked\r
+> together to overcome this limitation though.\r
+> \r
+> Anyway, if others think this is a good idea, I'm willing to do the\r
+> coding.\r
+\r
+This is definitely a good idea.  In fact, there's been quite a bit of\r
+discussion about it in the past, and even some (very old and\r
+outdated) implementation work:\r
+\r
+  id:"878vs28dvo.fsf@praet.org"\r
+    A rather lengthy discussion of another motivation for using JSON\r
+    search.  Includes performance results for using JSON in search.\r
+\r
+  id:"20120214152114.GQ27039@mit.edu"\r
+    Discussion of "framed" JSON that would be a valid JSON object, but\r
+    could easily be consumed in a streaming fashion without hacking\r
+    Emacs' JSON parser or resorting to paging.\r
+\r
+  id:"1290777202-14040-1-git-send-email-dme@dme.org"\r
+    The implementation from long ago.  Definitely outdated, but could\r
+    be a good starting point.\r
+\r
+It looks like most of the discussion about streaming JSON parsing has\r
+been on the IRC channel, rather than the mailing list, but I'd be\r
+happy to summarize it or dig out the IRC logs.  \r
+\r
+I agree with Adam that it probably makes the most sense to get an\r
+implementation working without streaming first and then add streaming\r
+support.\r