--- /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 olra.theworths.org (Postfix) with ESMTP id 14FDF431FAF\r
+ for <notmuch@notmuchmail.org>; Wed, 18 Jan 2012 14:33:52 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.7\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5\r
+ tests=[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 aiZbKcWIU7T4 for <notmuch@notmuchmail.org>;\r
+ Wed, 18 Jan 2012 14:33:51 -0800 (PST)\r
+Received: from mail-ee0-f53.google.com (mail-ee0-f53.google.com\r
+ [74.125.83.53]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client\r
+ certificate requested) by olra.theworths.org (Postfix) with ESMTPS id\r
+ 5DB56431FAE for <notmuch@notmuchmail.org>; Wed, 18 Jan 2012 14:33:51 -0800\r
+ (PST)\r
+Received: by eeke51 with SMTP id e51so871796eek.26\r
+ for <notmuch@notmuchmail.org>; Wed, 18 Jan 2012 14:33:50 -0800 (PST)\r
+Received: by 10.14.11.97 with SMTP id 73mr798254eew.2.1326926030107;\r
+ Wed, 18 Jan 2012 14:33:50 -0800 (PST)\r
+Received: from localhost (dsl-hkibrasgw4-fe50f800-253.dhcp.inet.fi.\r
+ [84.248.80.253])\r
+ by mx.google.com with ESMTPS id e12sm105243459eea.5.2012.01.18.14.33.46\r
+ (version=SSLv3 cipher=OTHER); Wed, 18 Jan 2012 14:33:49 -0800 (PST)\r
+From: Jani Nikula <jani@nikula.org>\r
+To: Austin Clements <amdragon@MIT.EDU>, notmuch@notmuchmail.org\r
+Subject: Re: [PATCH 3/3] show: Introduce mime_node formatter callback\r
+In-Reply-To: <1326918507-28033-4-git-send-email-amdragon@mit.edu>\r
+References: <1326918507-28033-1-git-send-email-amdragon@mit.edu>\r
+ <1326918507-28033-4-git-send-email-amdragon@mit.edu>\r
+User-Agent: Notmuch/0.11+76~g1de742d (http://notmuchmail.org) Emacs/23.3.1\r
+ (i686-pc-linux-gnu)\r
+Date: Thu, 19 Jan 2012 00:33:44 +0200\r
+Message-ID: <87wr8obpyv.fsf@nikula.org>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain; charset=us-ascii\r
+Cc: dkg@fifthhorseman.net\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: Wed, 18 Jan 2012 22:33:52 -0000\r
+\r
+On Wed, 18 Jan 2012 15:28:27 -0500, Austin Clements <amdragon@MIT.EDU> wrote:\r
+> This callback is the gateway to the new mime_node_t-based formatters.\r
+> This maintains backwards compatibility so the formatters can be\r
+> transitioned one at a time. Once all formatters are converted, the\r
+> formatter structure can be reduced to only message_set_{start,sep,end}\r
+> and part, most of show_message can be deleted, and all of\r
+> show-message.c can be deleted.\r
+> ---\r
+> notmuch-client.h | 6 ++++++\r
+> notmuch-reply.c | 2 +-\r
+> notmuch-show.c | 22 ++++++++++++++++++----\r
+> 3 files changed, 25 insertions(+), 5 deletions(-)\r
+> \r
+> diff --git a/notmuch-client.h b/notmuch-client.h\r
+> index b3dcb6b..3ccdfad 100644\r
+> --- a/notmuch-client.h\r
+> +++ b/notmuch-client.h\r
+> @@ -54,8 +54,14 @@\r
+> #define STRINGIFY(s) STRINGIFY_(s)\r
+> #define STRINGIFY_(s) #s\r
+> \r
+> +struct mime_node;\r
+> +struct notmuch_show_params;\r
+> +\r
+> typedef struct notmuch_show_format {\r
+> const char *message_set_start;\r
+> + void (*part) (const void *ctx,\r
+> + struct mime_node *node, int indent,\r
+> + struct notmuch_show_params *params);\r
+> const char *message_start;\r
+> void (*message) (const void *ctx,\r
+> notmuch_message_t *message,\r
+> diff --git a/notmuch-reply.c b/notmuch-reply.c\r
+> index 0f682db..9a224e2 100644\r
+> --- a/notmuch-reply.c\r
+> +++ b/notmuch-reply.c\r
+> @@ -31,7 +31,7 @@ static void\r
+> reply_part_content (GMimeObject *part);\r
+> \r
+> static const notmuch_show_format_t format_reply = {\r
+> - "",\r
+> + "", NULL,\r
+> "", NULL,\r
+> "", NULL, reply_headers_message_part, ">\n",\r
+> "",\r
+> diff --git a/notmuch-show.c b/notmuch-show.c\r
+> index ecadfa8..46eef44 100644\r
+> --- a/notmuch-show.c\r
+> +++ b/notmuch-show.c\r
+> @@ -42,7 +42,7 @@ static void\r
+> format_part_end_text (GMimeObject *part);\r
+> \r
+> static const notmuch_show_format_t format_text = {\r
+> - "",\r
+> + "", NULL,\r
+> "\fmessage{ ", format_message_text,\r
+> "\fheader{\n", format_headers_text, format_headers_message_part_text, "\fheader}\n",\r
+> "\fbody{\n",\r
+> @@ -85,7 +85,7 @@ static void\r
+> format_part_end_json (GMimeObject *part);\r
+> \r
+> static const notmuch_show_format_t format_json = {\r
+> - "[",\r
+> + "[", NULL,\r
+> "{", format_message_json,\r
+> "\"headers\": {", format_headers_json, format_headers_message_part_json, "}",\r
+> ", \"body\": [",\r
+> @@ -106,7 +106,7 @@ format_message_mbox (const void *ctx,\r
+> unused (int indent));\r
+> \r
+> static const notmuch_show_format_t format_mbox = {\r
+> - "",\r
+> + "", NULL,\r
+> "", format_message_mbox,\r
+> "", NULL, NULL, "",\r
+> "",\r
+> @@ -125,7 +125,7 @@ static void\r
+> format_part_content_raw (GMimeObject *part);\r
+> \r
+> static const notmuch_show_format_t format_raw = {\r
+> - "",\r
+> + "", NULL,\r
+> "", NULL,\r
+> "", NULL, format_headers_message_part_text, "\n",\r
+> "",\r
+> @@ -762,6 +762,20 @@ show_message (void *ctx,\r
+> int indent,\r
+> notmuch_show_params_t *params)\r
+> {\r
+> + if (format->part) {\r
+> + void *local = talloc_new (ctx);\r
+> + mime_node_t *root, *part;\r
+> +\r
+> + if (mime_node_open (local, message, params->cryptoctx, params->decrypt,\r
+> + &root) != NOTMUCH_STATUS_SUCCESS)\r
+\r
+I'm new to talloc, I think I like it, but I always find it confusing\r
+when some code paths free the contexts, and some don't. Like here.\r
+\r
+Are you not freeing the local context here because it's just an empty\r
+context, and freeing below because it's no longer empty?\r
+\r
+No need to change anything, I guess, just asking...\r
+\r
+BR,\r
+Jani.\r
+\r
+> + return;\r
+> + part = mime_node_seek_dfs (root, params->part < 0 ? 0 : params->part);\r
+> + if (part)\r
+> + format->part (local, part, indent, params);\r
+> + talloc_free (local);\r
+> + return;\r
+> + }\r
+> +\r
+> if (params->part <= 0) {\r
+> fputs (format->message_start, stdout);\r
+> if (format->message)\r
+> -- \r
+> 1.7.7.3\r
+> \r