Re: [PATCH] cli: notmuch-show with framing newlines between threads in JSON.
authorDmitry Kurochkin <dmitry.kurochkin@gmail.com>
Sat, 30 Jun 2012 07:42:40 +0000 (11:42 +0400)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:47:54 +0000 (09:47 -0800)
4f/4cf07f6b0e5bda55c147476d945f5bae6de428 [new file with mode: 0644]

diff --git a/4f/4cf07f6b0e5bda55c147476d945f5bae6de428 b/4f/4cf07f6b0e5bda55c147476d945f5bae6de428
new file mode 100644 (file)
index 0000000..9eb064c
--- /dev/null
@@ -0,0 +1,149 @@
+Return-Path: <dmitry.kurochkin@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 33C4E431FAF\r
+       for <notmuch@notmuchmail.org>; Sat, 30 Jun 2012 00:45:06 -0700 (PDT)\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 CX7oZy3ruWyx for <notmuch@notmuchmail.org>;\r
+       Sat, 30 Jun 2012 00:45:05 -0700 (PDT)\r
+Received: from mail-lb0-f181.google.com (mail-lb0-f181.google.com\r
+       [209.85.217.181]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
+       (No client certificate requested)\r
+       by olra.theworths.org (Postfix) with ESMTPS id 4EA86431FAE\r
+       for <notmuch@notmuchmail.org>; Sat, 30 Jun 2012 00:45:05 -0700 (PDT)\r
+Received: by lbbgk8 with SMTP id gk8so5733047lbb.26\r
+       for <notmuch@notmuchmail.org>; Sat, 30 Jun 2012 00:45:02 -0700 (PDT)\r
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;\r
+       h=from:to:subject:in-reply-to:references:user-agent:date:message-id\r
+       :mime-version:content-type;\r
+       bh=zPh0bbKpYtoRjHu0z10guvCDYNkx0gAvLwP2YxWfhAw=;\r
+       b=enekhQLwhHZaqRrn7yC9xZTD8UhSBbh2273Shie8gSliG2nO/0z1DlCpiwV3OWHX2I\r
+       3cae3QQBSf4PCPSSb2ZJL9FjjctjuKvuUS6RtADfDMJqdvgbNxqaUf0P3PZt7UaSpZUL\r
+       o/p6LhBFZoOFWyFFIYnUHLdjdUZrjTYeYnHhvAWPafQmSxkN/JlLV/jNiPZ3uS7r8qbF\r
+       BQufIfheqO00X/H5flH5DtX02iTSh0EtBN4wZzRYhgp7k6hh2VdXMDvwlkBRaawBuBlv\r
+       zdheSzG9Ez9G7MdgVohDOA48PONf4H2hd+86IL2Ru6OEgpaX/9r5d7QQASYoj3pCVAtM\r
+       jF0g==\r
+Received: by 10.112.32.35 with SMTP id f3mr2641468lbi.47.1341042302389;\r
+       Sat, 30 Jun 2012 00:45:02 -0700 (PDT)\r
+Received: from localhost ([46.251.86.61])\r
+       by mx.google.com with ESMTPS id lv13sm9801766lab.8.2012.06.30.00.45.00\r
+       (version=TLSv1/SSLv3 cipher=OTHER);\r
+       Sat, 30 Jun 2012 00:45:01 -0700 (PDT)\r
+From: Dmitry Kurochkin <dmitry.kurochkin@gmail.com>\r
+To: Mark Walters <markwalters1009@gmail.com>, notmuch@notmuchmail.org\r
+Subject: Re: [PATCH] cli: notmuch-show with framing newlines between threads\r
+       in JSON.\r
+In-Reply-To: <1341041024-5342-1-git-send-email-markwalters1009@gmail.com>\r
+References: <1341041024-5342-1-git-send-email-markwalters1009@gmail.com>\r
+User-Agent: Notmuch/0.13.2+47~ga7bc1c7 (http://notmuchmail.org) Emacs/23.4.1\r
+       (x86_64-pc-linux-gnu)\r
+Date: Sat, 30 Jun 2012 11:42:40 +0400\r
+Message-ID: <87pq8hnt3j.fsf@gmail.com>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain; charset=us-ascii\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, 30 Jun 2012 07:45:06 -0000\r
+\r
+Hi Mark.\r
+\r
+Mark Walters <markwalters1009@gmail.com> writes:\r
+\r
+> Add newlines between complete threads to make asynchronous parsing\r
+> of the JSON easier.\r
+> ---\r
+>\r
+> notmuch-pick uses the JSON output of notmuch show but, in many cases,\r
+> for many threads. This can take quite a long time when displaying a\r
+> large number of messages (say 20 seconds for the 10,000 messages in\r
+> the notmuch archive). Thus it is desirable to display results\r
+> incrementally in the same way that search currently does.\r
+>\r
+> To make this easier this patch adds newlines between each toplevel\r
+> thread. So the ouput becomes\r
+>\r
+> [\r
+> thread1\r
+> , thread2\r
+> , thread3\r
+> ...\r
+> , last_thread\r
+> ]\r
+>\r
+> Thus the parser can easily tell if it has enough data to do some more\r
+> parsing.\r
+>\r
+> Obviously, this changes the JSON output. This should not break any\r
+> consumer as the JSON parsers should not mind. However, it does break\r
+> several tests.\r
+\r
+I think this should be part of the commit message since it explains the\r
+rationale behind the change.\r
+\r
+Regards,\r
+  Dmitry\r
+\r
+> Obviously, I will fix these but I wanted to check if\r
+> people were basically happy with the change first.\r
+>\r
+> Also, should devel/schemata be updated? It seems a little unclear as\r
+> this is not really a "JSON" change as the JSON does not care about the\r
+> newlines.\r
+>\r
+> Best wishes\r
+>\r
+> Mark\r
+>\r
+>\r
+>  notmuch-show.c |    5 +++++\r
+>  1 files changed, 5 insertions(+), 0 deletions(-)\r
+>\r
+> diff --git a/notmuch-show.c b/notmuch-show.c\r
+> index 195e318..4a1d699 100644\r
+> --- a/notmuch-show.c\r
+> +++ b/notmuch-show.c\r
+> @@ -942,6 +942,8 @@ do_show (void *ctx,\r
+>  \r
+>      if (format->message_set_start)\r
+>      fputs (format->message_set_start, stdout);\r
+> +    if (format == &format_json)\r
+> +    fputs ("\n", stdout);\r
+>  \r
+>      for (threads = notmuch_query_search_threads (query);\r
+>       notmuch_threads_valid (threads);\r
+> @@ -963,6 +965,9 @@ do_show (void *ctx,\r
+>      if (status && !res)\r
+>          res = status;\r
+>  \r
+> +    if (format == &format_json)\r
+> +        fputs ("\n", stdout);\r
+> +\r
+>      notmuch_thread_destroy (thread);\r
+>  \r
+>      }\r
+> -- \r
+> 1.7.9.1\r
+>\r
+> _______________________________________________\r
+> notmuch mailing list\r
+> notmuch@notmuchmail.org\r
+> http://notmuchmail.org/mailman/listinfo/notmuch\r