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