--- /dev/null
+Return-Path: <dme@dme.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 452E4429E3B\r
+ for <notmuch@notmuchmail.org>; Tue, 13 May 2014 02:49:33 -0700 (PDT)\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 YrrivtFBEK2s for <notmuch@notmuchmail.org>;\r
+ Tue, 13 May 2014 02:49:25 -0700 (PDT)\r
+Received: from mail-wg0-f43.google.com (mail-wg0-f43.google.com\r
+ [74.125.82.43]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client\r
+ certificate requested) by olra.theworths.org (Postfix) with ESMTPS id\r
+ 23F42431FDE for <notmuch@notmuchmail.org>; Tue, 13 May 2014 02:49:19 -0700\r
+ (PDT)\r
+Received: by mail-wg0-f43.google.com with SMTP id l18so104703wgh.2\r
+ for <notmuch@notmuchmail.org>; Tue, 13 May 2014 02:49:17 -0700 (PDT)\r
+X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;\r
+ d=1e100.net; s=20130820;\r
+ h=x-gm-message-state:to:subject:in-reply-to:references:user-agent\r
+ :from:date:message-id:mime-version:content-type;\r
+ bh=i4Gs0ziVGXEA0VXTjk7M57aatXErJISgu9FVRnnRP18=;\r
+ b=IvqjMce06y9ja0OeFMhxO6VPQkCJ2Cw0unPpE28OGgAP0rdQ+MsX7syKCNzuEG1MM5\r
+ XFEPcdO0v9LnWm5MBgKrTtber0PLSMYzTPb1TkJ9zNuRXo5IBymgxyvJno9U0El01zQL\r
+ eqiDPAacJ/buRI4/ypVn/s1mYlO5oybqtk9FyC7JhJbReqUTxXtArm1NhBV2foVQ8MSv\r
+ BCShtKJq8MuJFcVBIxoAUzQ8hz9rvzbb97o+sn5ST/qPtubmcz6Ew+DmZh8wKgxHr599\r
+ ZfGyEbMp0qALjpdO8x1QAkLxzjSfkAXhlu2xA6bCJLJBIcso3IFrfT3zpozd0qaJpbWa\r
+ nxRg==\r
+X-Gm-Message-State:\r
+ ALoCoQnRcZjNFXaqCcsWw8KzN0ENY5fiGozmFETeTRzaZqWacaphiCbX/iL4E6/xBd+FyugDClln\r
+X-Received: by 10.194.62.234 with SMTP id b10mr6974004wjs.48.1399974557884;\r
+ Tue, 13 May 2014 02:49:17 -0700 (PDT)\r
+Received: from localhost ([2a01:348:1a2:1:a288:b4ff:fe8a:77d8])\r
+ by mx.google.com with ESMTPSA id bj5sm20999609wib.3.2014.05.13.02.49.16\r
+ for <multiple recipients>\r
+ (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\r
+ Tue, 13 May 2014 02:49:17 -0700 (PDT)\r
+To: Mark Walters <markwalters1009@gmail.com>, notmuch@notmuchmail.org\r
+Subject: Re: [PATCH v3 2/9] emacs/show: Allow the user to decide when part\r
+ headers should be inserted\r
+In-Reply-To: <87ppjik5jo.fsf@qmul.ac.uk>\r
+References: <87sixdujkv.fsf@qmul.ac.uk>\r
+ <1399897769-26809-1-git-send-email-dme@dme.org>\r
+ <1399897769-26809-3-git-send-email-dme@dme.org>\r
+ <87ppjik5jo.fsf@qmul.ac.uk>\r
+User-Agent: Notmuch/0.18 (http://notmuchmail.org) Emacs/24.3.1\r
+ (x86_64-pc-linux-gnu)\r
+From: David Edmondson <dme@dme.org>\r
+Date: Tue, 13 May 2014 10:49:10 +0100\r
+Message-ID: <cuny4y657qh.fsf@hotblack-desiato.hh.sledj.net>\r
+MIME-Version: 1.0\r
+Content-Type: multipart/signed; boundary="=-=-=";\r
+ micalg=pgp-sha1; protocol="application/pgp-signature"\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: Tue, 13 May 2014 09:49:33 -0000\r
+\r
+--=-=-=\r
+Content-Type: text/plain\r
+Content-Transfer-Encoding: quoted-printable\r
+\r
+On Mon, May 12 2014, Mark Walters wrote:\r
+> On Mon, 12 May 2014, David Edmondson <dme@dme.org> wrote:\r
+>> Make the function that determines whether a part header should be\r
+>> inserted a user controlled, with some example functions.\r
+>> ---\r
+>> emacs/notmuch-show.el | 21 +++++++++++++++++++--\r
+>> 1 file changed, 19 insertions(+), 2 deletions(-)\r
+>>\r
+>> diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el\r
+>> index ec99141..f78a0ab 100644\r
+>> --- a/emacs/notmuch-show.el\r
+>> +++ b/emacs/notmuch-show.el\r
+>> @@ -135,6 +135,17 @@ indentation."\r
+>> :type 'boolean\r
+>> :group 'notmuch-show)\r
+>>=20=20\r
+>> +(defcustom notmuch-show-insert-header-p-function 'notmuch-show-insert-h=\r
+eader-p-smart\r
+>> + "A function to call to determine whether a MIME part should have a he=\r
+ader button.\r
+>> +\r
+>> +The function is passed one argument, PART - the MIME part in\r
+>> +question."\r
+>> + :type 'function\r
+>> + :group 'notmuch-show\r
+>> + :options '(notmuch-show-insert-header-p-smart\r
+>> + notmuch-show-insert-header-p-always\r
+>> + notmuch-show-insert-header-p-never))\r
+>> +\r
+>\r
+> I think this is nice as a defcustom for testing/seeing what happens, but =\r
+I am\r
+> not sure we want it exposed longer term: for example never makes it\r
+> nearly impossible to view pdf parts.\r
+\r
+Okay.\r
+>\r
+> Best wishes\r
+>\r
+> Mark\r
+>\r
+>\r
+>\r
+>> (defvar notmuch-show-thread-id nil)\r
+>> (make-variable-buffer-local 'notmuch-show-thread-id)\r
+>> (put 'notmuch-show-thread-id 'permanent-local t)\r
+>> @@ -880,12 +891,18 @@ message at DEPTH in the current thread."\r
+>> "text/x-diff")\r
+>> content-type)))\r
+>>=20=20\r
+>> -(defun notmuch-show-insert-header-p (part)\r
+>> +(defun notmuch-show-insert-header-p-smart (part)\r
+>> "Return non-NIL if a header button should be inserted for this part."\r
+>> (let ((mime-type (notmuch-show-mime-type part)))\r
+>> (not (and (string=3D mime-type "text/plain")\r
+>> (<=3D (plist-get part :id) 1)))))\r
+>>=20=20\r
+>> +(defun notmuch-show-insert-header-p-always (part)\r
+>> + t)\r
+>> +\r
+>> +(defun notmuch-show-insert-header-p-never (part)\r
+>> + nil)\r
+>> +\r
+>> (defun notmuch-show-insert-bodypart (msg part depth &optional hide)\r
+>> "Insert the body part PART at depth DEPTH in the current thread.\r
+>>=20=20\r
+>> @@ -904,7 +921,7 @@ useful for quoting in replies)."\r
+>> ;; We omit the part button for the first (or only) part if\r
+>> ;; this is text/plain, or HIDE is 'no-buttons.\r
+>> (button (when (and (not (equal hide 'no-buttons))\r
+>> - (notmuch-show-insert-header-p part))\r
+>> + (funcall notmuch-show-insert-header-p-function part))\r
+>> (notmuch-show-insert-part-header nth mime-type content-type (plist=\r
+-get part :filename))))\r
+>> (content-beg (point)))\r
+>>=20=20\r
+>> --=20\r
+>> 2.0.0.rc0\r
+>>\r
+>> _______________________________________________\r
+>> notmuch mailing list\r
+>> notmuch@notmuchmail.org\r
+>> http://notmuchmail.org/mailman/listinfo/notmuch\r
+\r
+--=-=-=\r
+Content-Type: application/pgp-signature; name="signature.asc"\r
+\r
+-----BEGIN PGP SIGNATURE-----\r
+Version: GnuPG v1\r
+\r
+iKYEARECAGYFAlNx6pZfFIAAAAAALgAoaXNzdWVyLWZwckBub3RhdGlvbnMub3Bl\r
+bnBncC5maWZ0aGhvcnNlbWFuLm5ldDc1M0Y5NDJDMEExNjc3MDE4OURGMUYyMDY5\r
+RUNEMEFCRjA0OTY1MTYACgkQaezQq/BJZRYiKgCfc9Jif6Pkeu2q2q43sZ0Ei61Y\r
+Z6AAn0TgH7Ss/7Pu8SF4GuuECgNOFMTq\r
+=aw9J\r
+-----END PGP SIGNATURE-----\r
+--=-=-=--\r