Re: [RFC] Use JSON in emacs interface
authorAdam Wolfe Gordon <awg+notmuch@xvx.ca>
Sun, 29 Apr 2012 18:17:10 +0000 (12:17 +1800)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:46:48 +0000 (09:46 -0800)
94/1987726d690ba4bf33d5c094f6467c4ec1ad23 [new file with mode: 0644]

diff --git a/94/1987726d690ba4bf33d5c094f6467c4ec1ad23 b/94/1987726d690ba4bf33d5c094f6467c4ec1ad23
new file mode 100644 (file)
index 0000000..12359ea
--- /dev/null
@@ -0,0 +1,111 @@
+Return-Path: <awg@xvx.ca>\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 C3F6F431FAF\r
+       for <notmuch@notmuchmail.org>; Sun, 29 Apr 2012 11:17:13 -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 s6PIxd1mgfwi for <notmuch@notmuchmail.org>;\r
+       Sun, 29 Apr 2012 11:17:12 -0700 (PDT)\r
+Received: from mail-lpp01m010-f53.google.com (mail-lpp01m010-f53.google.com\r
+       [209.85.215.53]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
+       (No client certificate requested)\r
+       by olra.theworths.org (Postfix) with ESMTPS id 1EE49431FAE\r
+       for <notmuch@notmuchmail.org>; Sun, 29 Apr 2012 11:17:11 -0700 (PDT)\r
+Received: by lahc1 with SMTP id c1so1684002lah.26\r
+       for <notmuch@notmuchmail.org>; Sun, 29 Apr 2012 11:17:10 -0700 (PDT)\r
+X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;\r
+       d=google.com; s=20120113;\r
+       h=mime-version:sender:x-originating-ip:in-reply-to:references:date\r
+       :x-google-sender-auth:message-id:subject:from:to:cc:content-type\r
+       :content-transfer-encoding:x-gm-message-state;\r
+       bh=zxfDkEFlIHbWBZqIwe2bdZhD/FrXQnv9I+qsdDZuZ84=;\r
+       b=NpdfGZg5RI+5jviP+ypsxfsPohDbqXM5+JHzQrL/oye+8+fU5VA1WNb1Zveb/JG0Au\r
+       K4hBBK18LIJSMoOhlDj7hSynmGHm3qkrh8BwwERRmS3iaPSBaigFz6lT6hgn8SrLQX/h\r
+       +9us5F5Q1iKB5XRGZLQnDzcfj9HAgB51aHHWJ0Q43+lf9fHNMGFNddliUo1rdCcgz4hx\r
+       /ay+b1reK70F0iWLxTehSbZPIjo27JbDiyTpsAhTmEoBWDFOjyYDbKoP1CYXiT7kePDk\r
+       GvzwTfKAJMJ+BKI282zcsJHLaOxeyRVrUJeT47jt7zHVA473zmb/qN232+ihOo0pkh1n\r
+       ZZJQ==\r
+MIME-Version: 1.0\r
+Received: by 10.152.133.144 with SMTP id pc16mr17806389lab.0.1335723430378;\r
+       Sun, 29 Apr 2012 11:17:10 -0700 (PDT)\r
+Sender: awg@xvx.ca\r
+Received: by 10.112.82.163 with HTTP; Sun, 29 Apr 2012 11:17:10 -0700 (PDT)\r
+X-Originating-IP: [96.52.216.56]\r
+In-Reply-To: <87ty02v786.fsf@gmail.com>\r
+References: <87ty02v786.fsf@gmail.com>\r
+Date: Sun, 29 Apr 2012 12:17:10 -0600\r
+X-Google-Sender-Auth: P_5N9wbhFNW71vRouzaFOPZoyYo\r
+Message-ID:\r
+ <CAMoJFUtY-Dzv8N6gs+8B6c43APqz9J9OSE05eDWLq_tUMEoW3A@mail.gmail.com>\r
+Subject: Re: [RFC] Use JSON in emacs interface\r
+From: Adam Wolfe Gordon <awg+notmuch@xvx.ca>\r
+To: Chris Gray <chrismgray@gmail.com>\r
+Content-Type: text/plain; charset=ISO-8859-1\r
+Content-Transfer-Encoding: quoted-printable\r
+X-Gm-Message-State:\r
+ ALoCoQmd/IywbraIrlPVAFmbiKWdoMPKN57qryulsThNRE+DOjImY9d1T+87vwh5NTJn5QR1ezWC\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 18:17:13 -0000\r
+\r
+Hi Chris,\r
+\r
+On Sun, Apr 29, 2012 at 10:22, Chris Gray <chrismgray@gmail.com> wrote:\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. =A0(Semicolons are probably more frequent in subject lines\r
+> than in author names.) =A0So 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. =A0Since notmuch search already has the option o=\r
+f\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=3D=\r
+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. =A0My 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
+I think this is a great idea. If you look at notmuch-mua.el and\r
+notmuch-query.el, you'll see that we already use json.el for reply and\r
+parts of show.\r
+\r
+As for parsing progressively to show search results as they arrive,\r
+I'd be inclined to instead implement paging, so emacs could ask for\r
+just the first n results, display them, then ask for the next n\r
+results, etc. Or maybe ask for the results grouped, so that there\r
+would be a valid JSON object for the first n results, then another for\r
+the next n, etc. This might be a tricky thing to design and implement,\r
+but I think it's been discussed before as something that would be nice\r
+to have.\r
+\r
+Personally, I think it would be fine to implement the JSON search\r
+first, then deal with progressive parsing and/or grouping, but others\r
+may differ here. Either way, I'd be happy to review patches for this\r
+and offer any suggestions.\r
+\r
+-- Adam\r