--- /dev/null
+Return-Path: <bremner@tesseract.cs.unb.ca>\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 79E566DE1B83\r
+ for <notmuch@notmuchmail.org>; Sun, 5 Apr 2015 16:01:36 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at cworth.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 0.564\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=0.564 tagged_above=-999 required=5 tests=[AWL=0.554, \r
+ T_HEADER_FROM_DIFFERENT_DOMAINS=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 bfzld1fAu9Lw for <notmuch@notmuchmail.org>;\r
+ Sun, 5 Apr 2015 16:01:34 -0700 (PDT)\r
+Received: from mx.xen14.node3324.gplhost.com (gitolite.debian.net\r
+ [87.98.215.224])\r
+ by arlo.cworth.org (Postfix) with ESMTPS id B0A006DE1B72\r
+ for <notmuch@notmuchmail.org>; Sun, 5 Apr 2015 16:01:34 -0700 (PDT)\r
+Received: from remotemail by mx.xen14.node3324.gplhost.com with local (Exim\r
+ 4.80) (envelope-from <bremner@tesseract.cs.unb.ca>)\r
+ id 1YetXA-0002om-S7; Sun, 05 Apr 2015 23:00:52 +0000\r
+Received: (nullmailer pid 2243 invoked by uid 1000); Sun, 05 Apr 2015\r
+ 22:59:25 -0000\r
+From: David Bremner <david@tethera.net>\r
+To: notmuch@notmuchmail.org\r
+Subject: [WIP2 04/12] cli: add type introspection to sprinter type\r
+Date: Mon, 6 Apr 2015 07:59:06 +0900\r
+Message-Id: <1428274754-1698-5-git-send-email-david@tethera.net>\r
+X-Mailer: git-send-email 2.1.4\r
+In-Reply-To: <1428274754-1698-1-git-send-email-david@tethera.net>\r
+References: <1428274754-1698-1-git-send-email-david@tethera.net>\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.18\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: Sun, 05 Apr 2015 23:01:36 -0000\r
+\r
+This will make it easier to skip generating certain output for the\r
+text format.\r
+---\r
+ sprinter-json.c | 1 +\r
+ sprinter-sexp.c | 1 +\r
+ sprinter-text.c | 1 +\r
+ sprinter.h | 10 ++++++++++\r
+ 4 files changed, 13 insertions(+)\r
+\r
+diff --git a/sprinter-json.c b/sprinter-json.c\r
+index 0a07790..8e5ffbe 100644\r
+--- a/sprinter-json.c\r
++++ b/sprinter-json.c\r
+@@ -175,6 +175,7 @@ sprinter_json_create (const void *ctx, FILE *stream)\r
+ {\r
+ static const struct sprinter_json template = {\r
+ .vtable = {\r
++ .type = NOTMUCH_SPRINTER_JSON,\r
+ .begin_map = json_begin_map,\r
+ .begin_list = json_begin_list,\r
+ .end = json_end,\r
+diff --git a/sprinter-sexp.c b/sprinter-sexp.c\r
+index 0aa51e8..e187c05 100644\r
+--- a/sprinter-sexp.c\r
++++ b/sprinter-sexp.c\r
+@@ -210,6 +210,7 @@ sprinter_sexp_create (const void *ctx, FILE *stream)\r
+ {\r
+ static const struct sprinter_sexp template = {\r
+ .vtable = {\r
++ .type = NOTMUCH_SPRINTER_SEXP,\r
+ .begin_map = sexp_begin_map,\r
+ .begin_list = sexp_begin_list,\r
+ .end = sexp_end,\r
+diff --git a/sprinter-text.c b/sprinter-text.c\r
+index 7779488..cd6cd56 100644\r
+--- a/sprinter-text.c\r
++++ b/sprinter-text.c\r
+@@ -117,6 +117,7 @@ sprinter_text_create (const void *ctx, FILE *stream)\r
+ {\r
+ static const struct sprinter_text template = {\r
+ .vtable = {\r
++ .type = NOTMUCH_SPRINTER_TEXT,\r
+ .begin_map = text_begin_map,\r
+ .begin_list = text_begin_list,\r
+ .end = text_end,\r
+diff --git a/sprinter.h b/sprinter.h\r
+index f859672..7e58f69 100644\r
+--- a/sprinter.h\r
++++ b/sprinter.h\r
+@@ -4,11 +4,21 @@\r
+ /* Necessary for notmuch_bool_t */\r
+ #include "notmuch-client.h"\r
+ \r
++enum notmuch_sprinter_type {\r
++ NOTMUCH_SPRINTER_JSON,\r
++ NOTMUCH_SPRINTER_SEXP,\r
++ NOTMUCH_SPRINTER_TEXT\r
++};\r
++\r
+ /* Structure printer interface. This is used to create output\r
+ * structured as maps (with key/value pairs), lists and primitives\r
+ * (strings, integers and booleans).\r
+ */\r
+ typedef struct sprinter {\r
++ /* Identify the type of sprinter\r
++ */\r
++ enum notmuch_sprinter_type type;\r
++\r
+ /* Start a new map/dictionary structure. This should be followed by\r
+ * a sequence of alternating calls to map_key and one of the\r
+ * value-printing functions until the map is ended by end.\r
+-- \r
+2.1.4\r
+\r