--- /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 arlo.cworth.org (Postfix) with ESMTP id 3B1F66DE1B74\r
+ for <notmuch@notmuchmail.org>; Sat, 7 Nov 2015 03:05:06 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at cworth.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 0.204\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=0.204 tagged_above=-999 required=5 tests=[AWL=0.074, \r
+ DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,\r
+ FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001,\r
+ RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_PASS=-0.001]\r
+ 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 ePV1OKWBiqmF for <notmuch@notmuchmail.org>;\r
+ Sat, 7 Nov 2015 03:05:04 -0800 (PST)\r
+Received: from mail-wm0-f44.google.com (mail-wm0-f44.google.com\r
+ [74.125.82.44]) by arlo.cworth.org (Postfix) with ESMTPS id 4AA7C6DE199D for\r
+ <notmuch@notmuchmail.org>; Sat, 7 Nov 2015 03:04:53 -0800 (PST)\r
+Received: by wmww144 with SMTP id w144so46070212wmw.1\r
+ for <notmuch@notmuchmail.org>; Sat, 07 Nov 2015 03:04:51 -0800 (PST)\r
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;\r
+ h=from:to:cc:subject:date:message-id:in-reply-to:references;\r
+ bh=nFOhLhaDucbDYlVZAxrmGPvt2GeuuPGKcfY9Fe9+hyk=;\r
+ b=HNoGQHHN2WzZsL+4jNoUgtJZNi8r5vLLmhHVyXsqhD/5HNPA84e15MO6dTd6tDpq83\r
+ q/YbGfaJRgrJHiAR9T/xyWEvBF854Bj190dFvOnF5sqnn0k4UmzrKby3/KG+Vbu8qmOQ\r
+ nvBdy0/vVYwmap/QDpjduuOs7UzCtSDx2RbHRtJ0a8h9rvEa1YTG+OSCRJ7j+u8EbBuF\r
+ 40UNzcaj204Rs6U9QS3REQxaESFbWjoKSD+hapyNqMLwXQxuLw8hBCDTx8mdDKqHkyDS\r
+ b0uH3jHofX5jO3BwuUExbv4/LI/SGxIMVKTGh8s09DjQ+Dsnsu8Ybx757XjZazDZak8J\r
+ 666g==\r
+X-Received: by 10.28.210.77 with SMTP id j74mr14774901wmg.60.1446894291869;\r
+ Sat, 07 Nov 2015 03:04:51 -0800 (PST)\r
+Received: from localhost (5751dfa2.skybroadband.com. [87.81.223.162])\r
+ by smtp.gmail.com with ESMTPSA id gl4sm4522981wjd.49.2015.11.07.03.04.50\r
+ (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\r
+ Sat, 07 Nov 2015 03:04:50 -0800 (PST)\r
+From: Mark Walters <markwalters1009@gmail.com>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH v4 5/7] emacs/show: Make the insertion of part headers\r
+ overridable.\r
+Date: Sat, 7 Nov 2015 11:04:34 +0000\r
+Message-Id: <1446894276-7814-6-git-send-email-markwalters1009@gmail.com>\r
+X-Mailer: git-send-email 2.1.4\r
+In-Reply-To: <1446894276-7814-1-git-send-email-markwalters1009@gmail.com>\r
+References: <1446894276-7814-1-git-send-email-markwalters1009@gmail.com>\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.20\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+ <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <https://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: <https://notmuchmail.org/mailman/listinfo/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Sat, 07 Nov 2015 11:05:06 -0000\r
+\r
+From: David Edmondson <dme@dme.org>\r
+\r
+This allows callers of notmuch-show-insert-bodypart to use a `let'\r
+binding to override the default function for specifying when part\r
+headers should be inserted.\r
+---\r
+ emacs/notmuch-show.el | 16 ++++++++++++----\r
+ 1 file changed, 12 insertions(+), 4 deletions(-)\r
+\r
+diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el\r
+index f8184e2..f4a65cc 100644\r
+--- a/emacs/notmuch-show.el\r
++++ b/emacs/notmuch-show.el\r
+@@ -945,8 +945,16 @@ (defun notmuch-show-mime-type (part)\r
+ "text/x-diff")\r
+ content-type)))\r
+ \r
++;; The following variable can be overridden by let bindings.\r
++(defvar notmuch-show-insert-header-p-function 'notmuch-show-insert-header-p\r
++ "Specify which function decides which part headers get inserted.\r
++\r
++The function should take two parameters, PART and HIDE, and\r
++should return non-NIL if a header button should be inserted for\r
++this part.")\r
++\r
+ (defun notmuch-show-insert-header-p (part hide)\r
+- "Return non-NIL if a header button should be inserted for this part."\r
++ ;; Show all part buttons except for the first part if it is text/plain.\r
+ (let ((mime-type (notmuch-show-mime-type part)))\r
+ (not (and (string= mime-type "text/plain")\r
+ (<= (plist-get part :id) 1)))))\r
+@@ -965,9 +973,9 @@ (defun notmuch-show-insert-bodypart (msg part depth &optional hide)\r
+ (> notmuch-show-max-text-part-size 0)\r
+ (> (length (plist-get part :content)) notmuch-show-max-text-part-size)))\r
+ (beg (point))\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 (notmuch-show-insert-header-p part hide)\r
++ ;; This default header-p function omits the part button for\r
++ ;; the first (or only) part if this is text/plain.\r
++ (button (when (funcall notmuch-show-insert-header-p-function part hide)\r
+ (notmuch-show-insert-part-header nth mime-type content-type (plist-get part :filename))))\r
+ ;; Hide the part initially if HIDE is t, or if it is too long\r
+ ;; and we have a button to allow toggling (thus reply which\r
+-- \r
+2.1.4\r
+\r