From e0c242aaa5b616fa8570812560effe43aeff0ac9 Mon Sep 17 00:00:00 2001 From: Adam Wolfe Gordon Date: Sat, 18 Feb 2012 19:06:47 +1700 Subject: [PATCH] Re: [PATCH v5.2 3/7] reply: Add a JSON reply format. --- 25/df897eea8ef1518502ef9e0c1c7faf029b52de | 114 ++++++++++++++++++++++ 1 file changed, 114 insertions(+) create mode 100644 25/df897eea8ef1518502ef9e0c1c7faf029b52de diff --git a/25/df897eea8ef1518502ef9e0c1c7faf029b52de b/25/df897eea8ef1518502ef9e0c1c7faf029b52de new file mode 100644 index 000000000..64277e009 --- /dev/null +++ b/25/df897eea8ef1518502ef9e0c1c7faf029b52de @@ -0,0 +1,114 @@ +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 A7567429E42 + for ; Fri, 17 Feb 2012 18:06:51 -0800 (PST) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: -0.7 +X-Spam-Level: +X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5 + tests=[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 jMUUV3Lcb6wP for ; + Fri, 17 Feb 2012 18:06:51 -0800 (PST) +Received: from mail-lpp01m010-f53.google.com (mail-lpp01m010-f53.google.com + [209.85.215.53]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) + (No client certificate requested) + by olra.theworths.org (Postfix) with ESMTPS id D7A4E431FB6 + for ; Fri, 17 Feb 2012 18:06:50 -0800 (PST) +Received: by lahd3 with SMTP id d3so4636363lah.26 + for ; Fri, 17 Feb 2012 18:06:47 -0800 (PST) +Received-SPF: pass (google.com: domain of awg@xvx.ca designates 10.112.102.68 + as permitted sender) client-ip=10.112.102.68; +Authentication-Results: mr.google.com; + spf=pass (google.com: domain of awg@xvx.ca designates + 10.112.102.68 as permitted sender) smtp.mail=awg@xvx.ca +Received: from mr.google.com ([10.112.102.68]) + by 10.112.102.68 with SMTP id fm4mr4145680lbb.7.1329530807982 (num_hops + = 1); Fri, 17 Feb 2012 18:06:47 -0800 (PST) +MIME-Version: 1.0 +Received: by 10.112.102.68 with SMTP id fm4mr3476592lbb.7.1329530807890; Fri, + 17 Feb 2012 18:06:47 -0800 (PST) +Sender: awg@xvx.ca +Received: by 10.112.90.20 with HTTP; Fri, 17 Feb 2012 18:06:47 -0800 (PST) +X-Originating-IP: [96.52.216.56] +In-Reply-To: <20120217170457.GE5991@mit.edu> +References: <1329361957-28493-1-git-send-email-awg+notmuch@xvx.ca> + <1329361957-28493-4-git-send-email-awg+notmuch@xvx.ca> + <20120217170457.GE5991@mit.edu> +Date: Fri, 17 Feb 2012 19:06:47 -0700 +X-Google-Sender-Auth: ptq-jNVK5uq372Qflo3rlU9g-OA +Message-ID: + +Subject: Re: [PATCH v5.2 3/7] reply: Add a JSON reply format. +From: Adam Wolfe Gordon +To: Austin Clements +Content-Type: text/plain; charset=ISO-8859-1 +Content-Transfer-Encoding: quoted-printable +X-Gm-Message-State: + ALoCoQkaMo7HnxDrP8TL5I/LdjB6m9F4UbKcxWU9kmtr+vT6Ksq5EHrBqxnpxx3CvJrAngWLrElB +Cc: notmuch@notmuchmail.org +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, 18 Feb 2012 02:06:51 -0000 + +On Fri, Feb 17, 2012 at 10:04, Austin Clements wrote: +> The first two patches LGTM. =A0A few nits in this one. + +Thanks for the review. A couple of points to discuss below; everything +else I'll change for the next version. + +>> +void +>> +format_part_json (const void *ctx, mime_node_t *node, notmuch_bool_t fi= +rst); +>> + +> +> This is the wrong place for this declaration, since it is not part of +> the MIME node abstraction. =A0It should go somewhere above the /* +> notmuch-config.c */ comment. =A0Above that, it's a bit of a jumble. =A0I'= +d +> probably put it right after notmuch_show_command. + +Agreed. I initially had it earlier in the file (with the other +show-related functions), but moved it down since it requires the +mime_node_t declaration. There are a couple of options: put in a +pre-declaration of mime_node_t early in the file, or move the +mime_node stuff to a separate header file and include it in +notmuch-client.h. I lean toward the latter, since notmuch-client.h is +getting very big as it is. Thoughts? + +>> + =A0 =A0if (notmuch_query_count_messages (query) !=3D 1) { +>> + =A0 =A0 fprintf (stderr, "Error: search term did not match precisely o= +ne message.\n"); +>> + =A0 =A0 return 1; +>> + =A0 =A0} +> +> Technically count_messages does not have to be accurate, but since +> this is the same thing notmuch-show does, it's probably fine for now. + +Ah, I didn't realize this. I just followed the show example. + +> Perhaps we should add proper handling of multi-message replies to +> devel/TODO? + +Probably a good idea, although it means defining what proper handling +of multi-message replies in the CLI means. Personally, I don't think +it makes much sense to reply to multiple messages. The only place that +functionality is actually used (AFAIK) is in notmuch-search.el, which, +with my patches, throws an error if you try to reply to a thread +containing multiple messages. In my mind, the correct behavior in that +specific case is to create a reply to the last message in the thread, +which is better handled in the emacs code than the CLI anyway. -- 2.26.2