--- /dev/null
+Return-Path: <jani@nikula.org>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+ by arlo.cworth.org (Postfix) with ESMTP id 6D5466DE39D0\r
+ for <notmuch@notmuchmail.org>; Sat, 13 Aug 2016 04:39:28 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at cworth.org\r
+X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References"\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.573\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.573 tagged_above=-999 required=5 tests=[AWL=0.147,\r
+ DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_LOW=-0.7,\r
+ RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01] autolearn=disabled\r
+Received: from arlo.cworth.org ([127.0.0.1])\r
+ by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024)\r
+ with ESMTP id HasmXwsrR4Nj for <notmuch@notmuchmail.org>;\r
+ Sat, 13 Aug 2016 04:39:20 -0700 (PDT)\r
+Received: from mail-wm0-f67.google.com (mail-wm0-f67.google.com\r
+ [74.125.82.67]) by arlo.cworth.org (Postfix) with ESMTPS id 6C0D36DE38CC for\r
+ <notmuch@notmuchmail.org>; Sat, 13 Aug 2016 04:39:09 -0700 (PDT)\r
+Received: by mail-wm0-f67.google.com with SMTP id i5so2016567wmg.2\r
+ for <notmuch@notmuchmail.org>; Sat, 13 Aug 2016 04:39:09 -0700 (PDT)\r
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;\r
+ d=nikula-org.20150623.gappssmtp.com; s=20150623;\r
+ h=from:to:cc:subject:date:message-id:in-reply-to:references\r
+ :in-reply-to:references;\r
+ bh=mz2de6cLXojScvGRGmcz0RhTYF2mOcaPT9Nzasi4nKQ=;\r
+ b=A9EvdMo1gWTnr9njPkRGF3tNzmC3/1oY9b6TEpsPHuRheWB1XiOflkgyP5o9qRmO/C\r
+ sE9HIouW87BErHX6R5f6xncLEYSmTme6O9tx40PSyUzc8PvKpe1cWemtHxFltaRmh1pt\r
+ dkSFPaef22O4ptcf8QY20mBUMS+yXL464p7nRv3FHoLB7+pRifecQoAt5B0xiCJrty3+\r
+ IjAxuhZ/0uahiV8lBzI4uL93Yx12POixQtchNBiro9ecB7zkRSx62whajv0VVCMTKWEh\r
+ AUy+iEg66oiYkzhpqRXEmYevp2E+ZLRYwJM1IzGPZQ0fziSGq0EZhIiRqZrGFavYXX3j\r
+ 3++g==\r
+X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;\r
+ d=1e100.net; s=20130820;\r
+ h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\r
+ :references:in-reply-to:references;\r
+ bh=mz2de6cLXojScvGRGmcz0RhTYF2mOcaPT9Nzasi4nKQ=;\r
+ b=Ylyhs/FN+gvw7sCXiVvemC+c5wyuGhdgWlJ/Vp6GCP7W+tQo8MaRp/K4jgAM4+dbWp\r
+ aypHN2Gu8/RHxgB/FgS6WYGlcIm50rnoh46KjZO7c6mRIBtBqfy3VeVdMCX4wspJtHst\r
+ pLOomKzHEqNXELTv5idZ+lMsZ9PXv8NoYV4btBTNyvIHP9nuYHYFWpC1X76tPBvSXEf6\r
+ 7+88FAtb2HVr9JVVfWjZ7g6VcuK4udadLpVRs/x7L9GFOd0isnNcZ7FmC7nmgeghU4nc\r
+ gV8RObrs0z0e1H3HIMdzD0y+PbEkLgQ8l8Xq3DD3PpeHWG4qm8419wF6AUFZ8N7SOhsr\r
+ b4Uw==\r
+X-Gm-Message-State:\r
+ AEkoouvfRT/ATr5D4p2GC+9c0c5VDSo4Iyj2Xnt+5MtktSZ4UGDqjEAgtTLE6XMn1JwUkQ==\r
+X-Received: by 10.28.134.203 with SMTP id i194mr3599877wmd.22.1471088348099;\r
+ Sat, 13 Aug 2016 04:39:08 -0700 (PDT)\r
+Received: from localhost (mobile-access-bcee63-250.dhcp.inet.fi.\r
+ [188.238.99.250])\r
+ by smtp.gmail.com with ESMTPSA id m62sm6757895wmm.24.2016.08.13.04.39.07\r
+ (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\r
+ Sat, 13 Aug 2016 04:39:07 -0700 (PDT)\r
+From: Jani Nikula <jani@nikula.org>\r
+To: notmuch@notmuchmail.org\r
+Cc: Daniel Kahn Gillmor <dkg@fifthhorseman.net>,\r
+ jani@nikula.org\r
+Subject: [PATCH v2 04/14] cli/reply: unify reply format functions\r
+Date: Sat, 13 Aug 2016 14:37:28 +0300\r
+Message-Id:\r
+ <bcf94cd7a49879a9d168f7b8b0a9c77c41335237.1471088022.git.jani@nikula.org>\r
+X-Mailer: git-send-email 2.1.4\r
+In-Reply-To: <cover.1471088022.git.jani@nikula.org>\r
+References: <cover.1471088022.git.jani@nikula.org>\r
+In-Reply-To: <cover.1471088022.git.jani@nikula.org>\r
+References: <cover.1471088022.git.jani@nikula.org>\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.20\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+ <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <https://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: <https://notmuchmail.org/mailman/listinfo/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Sat, 13 Aug 2016 11:39:28 -0000\r
+\r
+Prepare for further future unification by making the code similar. The\r
+only functional change is that errors in mime_node_open() also break\r
+execution in default reply format.\r
+---\r
+ notmuch-reply.c | 18 ++++++++++--------\r
+ 1 file changed, 10 insertions(+), 8 deletions(-)\r
+\r
+diff --git a/notmuch-reply.c b/notmuch-reply.c\r
+index 5adbab624ad7..4b97ffa4f096 100644\r
+--- a/notmuch-reply.c\r
++++ b/notmuch-reply.c\r
+@@ -604,20 +604,20 @@ notmuch_reply_format_default(void *ctx,\r
+ unused (sprinter_t *sp))\r
+ {\r
+ GMimeMessage *reply;\r
+- mime_node_t *root;\r
++ mime_node_t *node;\r
++\r
++ if (mime_node_open (ctx, message, ¶ms->crypto, &node))\r
++ return 1;\r
+ \r
+ reply = create_reply_message (ctx, config, message, reply_all);\r
+ if (!reply)\r
+ return 1;\r
+ \r
+ show_reply_headers (reply);\r
++ format_part_reply (node);\r
+ \r
+ g_object_unref (G_OBJECT (reply));\r
+-\r
+- if (mime_node_open (ctx, message, ¶ms->crypto, &root) == NOTMUCH_STATUS_SUCCESS) {\r
+- format_part_reply (root);\r
+- talloc_free (root);\r
+- }\r
++ talloc_free (node);\r
+ \r
+ return 0;\r
+ }\r
+@@ -633,7 +633,7 @@ notmuch_reply_format_sprinter(void *ctx,\r
+ GMimeMessage *reply;\r
+ mime_node_t *node;\r
+ \r
+- if (mime_node_open (ctx, message, ¶ms->crypto, &node) != NOTMUCH_STATUS_SUCCESS)\r
++ if (mime_node_open (ctx, message, ¶ms->crypto, &node))\r
+ return 1;\r
+ \r
+ reply = create_reply_message (ctx, config, message, reply_all);\r
+@@ -645,7 +645,6 @@ notmuch_reply_format_sprinter(void *ctx,\r
+ /* The headers of the reply message we've created */\r
+ sp->map_key (sp, "reply-headers");\r
+ format_headers_sprinter (sp, reply, TRUE);\r
+- g_object_unref (G_OBJECT (reply));\r
+ \r
+ /* Start the original */\r
+ sp->map_key (sp, "original");\r
+@@ -654,6 +653,9 @@ notmuch_reply_format_sprinter(void *ctx,\r
+ /* End */\r
+ sp->end (sp);\r
+ \r
++ g_object_unref (G_OBJECT (reply));\r
++ talloc_free (node);\r
++\r
+ return 0;\r
+ }\r
+ \r
+-- \r
+2.1.4\r
+\r