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 7F119431FBC for ; Fri, 9 Mar 2012 15:01:03 -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 SKpXuWLlrQvq for ; Fri, 9 Mar 2012 15:01:01 -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 4AD36431FAE for ; Fri, 9 Mar 2012 15:01:01 -0800 (PST) Received: by lahc1 with SMTP id c1so2270700lah.26 for ; Fri, 09 Mar 2012 15:00:59 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:subject:in-reply-to:references:user-agent:date:message-id :mime-version:content-type:x-gm-message-state; bh=JSrPuOJ0OocCLZ9O/qmQ7nI2ulpRYOOj5+ZuQIsRLq0=; b=M5/Hl4aMnvK5YuMK9mNd1++77jmVvOfc8F3hwqTz1UOR2LKK2uBJxlT3FBbw8z1kdp Ml5vaHUtbNn1on9iXWMQ9H2uHHzQTtOpZhqnPPYaWJ0J+79M4fI8qzTMQHWC48s5YREO oBok4NU5+fmooh4NgPkvJdx5BmwC4ySFkiw/UGsfN83CJQYuTrVvTszZcbHvkaffALBz Z3oaOQivL0PIlWTHEo4O/zDWHbsIStBX3V84i8vUkmz5w5hyqYa7hn8Z8gqc49GZ+lh4 +QuZYbgRZ+KXyHSouMLE+wJMdZrCEDxyetvoX5r7+V5HV54Grrh85CPcZosQsQxlgya8 d77Q== Received: by 10.112.36.65 with SMTP id o1mr1499718lbj.32.1331334059581; Fri, 09 Mar 2012 15:00:59 -0800 (PST) Received: from localhost (dsl-hkibrasgw4-fe50f800-253.dhcp.inet.fi. [84.248.80.253]) by mx.google.com with ESMTPS id a8sm8039538lba.15.2012.03.09.15.00.57 (version=SSLv3 cipher=OTHER); Fri, 09 Mar 2012 15:00:58 -0800 (PST) From: Jani Nikula To: Adam Wolfe Gordon , notmuch@notmuchmail.org Subject: Re: [PATCH v6 03/10] reply: Require that only one message is returned In-Reply-To: <1329893199-21630-4-git-send-email-awg+notmuch@xvx.ca> References: <1329893199-21630-1-git-send-email-awg+notmuch@xvx.ca> <1329893199-21630-4-git-send-email-awg+notmuch@xvx.ca> User-Agent: Notmuch/0.11.1+295~g780f284 (http://notmuchmail.org) Emacs/23.3.1 (i686-pc-linux-gnu) Date: Sat, 10 Mar 2012 01:00:54 +0200 Message-ID: <87fwdh8jmh.fsf@nikula.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Gm-Message-State: ALoCoQm1+QFpoc6BcDfyW5VvtsOGLFjAH2uWVne1Jm30EVJVeDsu9/oB1axGIn4EfpA3uiB6590v 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: Fri, 09 Mar 2012 23:01:03 -0000 On Tue, 21 Feb 2012 23:46:32 -0700, Adam Wolfe Gordon wrote: > As the semantics of replying to multiple messages have not yet been > defined well, make notmuch reply require that the search given returns > only a single message. Is there any real reason, apart from consistency between --format=default and --format=json, to disable the current multiple message reply? Also "notmuch show" has format specific features and limitations. I agree the semantics should be clarified, and eventually multiple message reply should be uniformly supported by all formats, including --format=json, but IMHO this patch should be dropped (and the TODO patch amended accordingly). BR, Jani. > --- > notmuch-reply.c | 36 +++++++++++++++++++----------------- > 1 files changed, 19 insertions(+), 17 deletions(-) > > diff --git a/notmuch-reply.c b/notmuch-reply.c > index 8e56245..177e6ca 100644 > --- a/notmuch-reply.c > +++ b/notmuch-reply.c > @@ -572,30 +572,32 @@ notmuch_reply_format_default(void *ctx, > notmuch_message_t *message; > const notmuch_show_format_t *format = &format_reply; > > - for (messages = notmuch_query_search_messages (query); > - notmuch_messages_valid (messages); > - notmuch_messages_move_to_next (messages)) > - { > - message = notmuch_messages_get (messages); > + if (notmuch_query_count_messages (query) != 1) { > + fprintf (stderr, "Error: search term did not match precisely one message.\n"); > + return 1; > + } > > - reply = create_reply_message (ctx, config, message, reply_all); > + messages = notmuch_query_search_messages (query); > + message = notmuch_messages_get (messages); > > - if (!reply) > - continue; > + reply = create_reply_message (ctx, config, message, reply_all); > > - show_reply_headers (reply); > + if (!reply) > + return 1; > > - g_object_unref (G_OBJECT (reply)); > - reply = NULL; > + show_reply_headers (reply); > > - printf ("On %s, %s wrote:\n", > - notmuch_message_get_header (message, "date"), > - notmuch_message_get_header (message, "from")); > + g_object_unref (G_OBJECT (reply)); > + reply = NULL; > > - show_message_body (message, format, params); > + printf ("On %s, %s wrote:\n", > + notmuch_message_get_header (message, "date"), > + notmuch_message_get_header (message, "from")); > + > + show_message_body (message, format, params); > + > + notmuch_message_destroy (message); > > - notmuch_message_destroy (message); > - } > return 0; > } > > -- > 1.7.5.4 > > _______________________________________________ > notmuch mailing list > notmuch@notmuchmail.org > http://notmuchmail.org/mailman/listinfo/notmuch