From c12bcec5353d78718b12b7690ec8cad3de8f1504 Mon Sep 17 00:00:00 2001 From: Mark Walters Date: Sun, 22 Jul 2012 15:37:55 +0100 Subject: [PATCH] [PATCH 0/4] Add a --include-text-content option to notmuch-show.c --- cb/8f4da9f8373223825183c3ff27008b48dd653b | 110 ++++++++++++++++++++++ 1 file changed, 110 insertions(+) create mode 100644 cb/8f4da9f8373223825183c3ff27008b48dd653b diff --git a/cb/8f4da9f8373223825183c3ff27008b48dd653b b/cb/8f4da9f8373223825183c3ff27008b48dd653b new file mode 100644 index 000000000..e1979df68 --- /dev/null +++ b/cb/8f4da9f8373223825183c3ff27008b48dd653b @@ -0,0 +1,110 @@ +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 0E1F3431FAF + for ; Sun, 22 Jul 2012 07:38:09 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: 2.7 +X-Spam-Level: ** +X-Spam-Status: No, score=2.7 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, + FREEMAIL_REPLY=2.499, 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 ygWqJ6r-+u2f for ; + Sun, 22 Jul 2012 07:38:08 -0700 (PDT) +Received: from mail-we0-f181.google.com (mail-we0-f181.google.com + [74.125.82.181]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) + (No client certificate requested) + by olra.theworths.org (Postfix) with ESMTPS id EB70A431FAE + for ; Sun, 22 Jul 2012 07:38:07 -0700 (PDT) +Received: by weyt57 with SMTP id t57so4152698wey.26 + for ; Sun, 22 Jul 2012 07:38:05 -0700 (PDT) +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; + h=from:to:cc:subject:date:message-id:x-mailer; + bh=XdFWsu8vQJRkUJQjMQzlut5+mBhlLa5HIatYQmwp1Xw=; + b=CfDOQktrYsnwgmSBKGzGPxevWPnyMyJbl18z/hP9pH95uDrBezYRET9H7s0+rffOnF + WumpPooVGVOtCKwOY5cctLxeJSERY100b6CvNPoZfdDTSOqwVbdZPmQGe/FHOFPk3lqA + Pv0N4zlnHpgfIOTNsFTu8rOUXyP8hkT25LRKA5QPXMNdwSIBQp6R7nqfOJ8m0KPqqG49 + 5E+c+LvBsXQryHs7lXiOkdKT97GYHV4skP9ZJwgHCTxSJLOm5LYI6D3dikH2uG4PJmZZ + t5aYoi2d8IGkUuy55YPJVIxQq2jmuj2ZzPUEyqdmHZnQaOqNBtxeJ64TEZ3y9Yryg2RE + RSJg== +Received: by 10.180.100.35 with SMTP id ev3mr21651751wib.10.1342967884876; + Sun, 22 Jul 2012 07:38:04 -0700 (PDT) +Received: from localhost (94-192-233-223.zone6.bethere.co.uk. + [94.192.233.223]) by mx.google.com with ESMTPS id + ef5sm16731287wib.3.2012.07.22.07.38.03 (version=TLSv1/SSLv3 cipher=OTHER); + Sun, 22 Jul 2012 07:38:03 -0700 (PDT) +From: Mark Walters +To: notmuch@notmuchmail.org +Subject: [PATCH 0/4] Add a --include-text-content option to notmuch-show.c +Date: Sun, 22 Jul 2012 15:37:55 +0100 +Message-Id: <1342967879-20453-1-git-send-email-markwalters1009@gmail.com> +X-Mailer: git-send-email 1.7.9.1 +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: Sun, 22 Jul 2012 14:38:09 -0000 + +Currently notmuch show includes text/* parts (except text/html) in the +JSON and text outputs. This patch adds a new option +--include-text-content=true|false which allows the caller to disable +this behaviour. + +This is similar to the --headers-only option proposed in +id:"1341041595-5858-1-git-send-email-markwalters1009@gmail.com". The +key difference is that this version does not change the JSON output +schema: the schema says that "A leaf part's body content is optional, +but may be included if it can be correctly encoded as a string." + +This means that the emacs show mode works correctly if switched to +specifying --include-text-content=false (it fetches each part +individually). Indeed, it may be desirable to make that the default +(as suggested by Jamie in +id:"877gu7gzy9.fsf@servo.finestructure.net"). However, this may make +show significantly slower so we do not change the default here. + +There have been other suggestions of allowing the user to specify +exactly which parts/headers etc notmuch should return and even of +unifying show and search. That is obviously a much bigger change than +this (and this would not make that any more difficult). + +Finally, the advantage of this change is that it can substantially +speed up some uses (when the caller only wants the headers): see +id:"87r4sei8yu.fsf@qmul.ac.uk" for some examples with a factor of 8 +speed up. + +Best wishes + +Mark + + + +Mark Walters (4): + cli: show: add --include-text-content=true|false option + cli: show: implement --include-text-content for --format=text + test: add some tests for --include-text-content option + man: update man page for --include-text-option + + man/man1/notmuch-show.1 | 12 ++++++++++ + notmuch-client.h | 3 +- + notmuch-reply.c | 2 +- + notmuch-show.c | 57 ++++++++++++++++++++++++++++------------------- + test/json | 9 +++++++ + 5 files changed, 58 insertions(+), 25 deletions(-) + +-- +1.7.9.1 + -- 2.26.2