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