--- /dev/null
+Return-Path: <markwalters1009@gmail.com>\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 C522A429E52\r
+ for <notmuch@notmuchmail.org>; Sun, 12 Feb 2012 17:19:13 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 0.201\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=0.201 tagged_above=-999 required=5\r
+ tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,\r
+ FREEMAIL_ENVFROM_END_DIGIT=1, FREEMAIL_FROM=0.001,\r
+ 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 2I0I7EV448mz for <notmuch@notmuchmail.org>;\r
+ Sun, 12 Feb 2012 17:19:13 -0800 (PST)\r
+Received: from mail-ww0-f45.google.com (mail-ww0-f45.google.com\r
+ [74.125.82.45]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client\r
+ certificate requested) by olra.theworths.org (Postfix) with ESMTPS id\r
+ 24246431FAE for <notmuch@notmuchmail.org>; Sun, 12 Feb 2012 17:19:13 -0800\r
+ (PST)\r
+Received: by wgbdt12 with SMTP id dt12so3923384wgb.2\r
+ for <notmuch@notmuchmail.org>; Sun, 12 Feb 2012 17:19:12 -0800 (PST)\r
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;\r
+ h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references;\r
+ bh=8BPgVNhJdKBFIvnx334lcsEIbtKP+dGP8/iG78plaM4=;\r
+ b=ILevKFHij+kPAWLoN96l5OY3V1J6X4nw/oM56m9wKcqCc7fwbeoXOiBhQ3nKjtjLGV\r
+ uHOdJCAD37iXvBLuBmbzqbPrUNT6xvusU88dE9FaWUV3CPRR9dKv2+XmtYAZxiSNeavg\r
+ Ie4qGPn/aR6z4tyZE0Oph74/fQqJGK0Lu0y2A=\r
+Received: by 10.180.85.105 with SMTP id g9mr15277808wiz.12.1329095951984;\r
+ Sun, 12 Feb 2012 17:19:11 -0800 (PST)\r
+Received: from localhost (94-192-233-223.zone6.bethere.co.uk.\r
+ [94.192.233.223]) by mx.google.com with ESMTPS id\r
+ s8sm18408712wiz.8.2012.02.12.17.19.10 (version=TLSv1/SSLv3 cipher=OTHER);\r
+ Sun, 12 Feb 2012 17:19:11 -0800 (PST)\r
+From: Mark Walters <markwalters1009@gmail.com>\r
+To: notmuch@notmuchmail.org\r
+Subject: [RFC PATCH v3 01/11] cli: add --headers_only option to notmuch-show.c\r
+Date: Mon, 13 Feb 2012 01:20:05 +0000\r
+Message-Id: <1329096015-8078-2-git-send-email-markwalters1009@gmail.com>\r
+X-Mailer: git-send-email 1.7.2.3\r
+In-Reply-To: <1329072579-27340-1-git-send-email-markwalters1009@gmail.com>\r
+References: <1329072579-27340-1-git-send-email-markwalters1009@gmail.com>\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: Mon, 13 Feb 2012 01:19:13 -0000\r
+\r
+This option just outputs the headers of a message\r
+(i.e. it omits the bodies).\r
+\r
+This is used by notmuch-pick.el (although not needed) because it gives a\r
+speed-up of at least a factor of a two; moreover it reduces the memory\r
+usage in emacs hugely.\r
+---\r
+ notmuch-client.h | 1 +\r
+ notmuch-show.c | 6 +++++-\r
+ 2 files changed, 6 insertions(+), 1 deletions(-)\r
+\r
+diff --git a/notmuch-client.h b/notmuch-client.h\r
+index 60828aa..0da2d8d 100644\r
+--- a/notmuch-client.h\r
++++ b/notmuch-client.h\r
+@@ -101,6 +101,7 @@ typedef struct notmuch_show_params {\r
+ notmuch_bool_t entire_thread;\r
+ notmuch_bool_t raw;\r
+ int part;\r
++ int headers_only;\r
+ #ifdef GMIME_ATLEAST_26\r
+ GMimeCryptoContext* cryptoctx;\r
+ #else\r
+diff --git a/notmuch-show.c b/notmuch-show.c\r
+index d930f94..9d73685 100644\r
+--- a/notmuch-show.c\r
++++ b/notmuch-show.c\r
+@@ -841,7 +841,7 @@ show_message (void *ctx,\r
+ fputs (format->body_start, stdout);\r
+ }\r
+ \r
+- if (format->part_content)\r
++ if (format->part_content && !params->headers_only)\r
+ show_message_body (message, format, params);\r
+ \r
+ if (params->part <= 0) {\r
+@@ -1034,6 +1034,7 @@ notmuch_show_command (void *ctx, unused (int argc), unused (char *argv[]))\r
+ notmuch_show_params_t params = { .part = -1 };\r
+ int format_sel = NOTMUCH_FORMAT_NOT_SPECIFIED;\r
+ notmuch_bool_t verify = FALSE;\r
++ notmuch_bool_t headers_only = FALSE;\r
+ \r
+ notmuch_opt_desc_t options[] = {\r
+ { NOTMUCH_OPT_KEYWORD, &format_sel, "format", 'f',\r
+@@ -1046,6 +1047,7 @@ notmuch_show_command (void *ctx, unused (int argc), unused (char *argv[]))\r
+ { NOTMUCH_OPT_BOOLEAN, ¶ms.entire_thread, "entire-thread", 't', 0 },\r
+ { NOTMUCH_OPT_BOOLEAN, ¶ms.decrypt, "decrypt", 'd', 0 },\r
+ { NOTMUCH_OPT_BOOLEAN, &verify, "verify", 'v', 0 },\r
++ { NOTMUCH_OPT_BOOLEAN, &headers_only, "headers-only", 'h', 0 },\r
+ { 0, 0, 0, 0, 0 }\r
+ };\r
+ \r
+@@ -1055,6 +1057,8 @@ notmuch_show_command (void *ctx, unused (int argc), unused (char *argv[]))\r
+ return 1;\r
+ }\r
+ \r
++ params.headers_only = headers_only;\r
++\r
+ if (format_sel == NOTMUCH_FORMAT_NOT_SPECIFIED) {\r
+ /* if part was requested and format was not specified, use format=raw */\r
+ if (params.part >= 0)\r
+-- \r
+1.7.2.3\r
+\r