--- /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 arlo.cworth.org (Postfix) with ESMTP id 632466DE13A6\r
+ for <notmuch@notmuchmail.org>; Tue, 9 Feb 2016 12:28:44 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at cworth.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.069\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.069 tagged_above=-999 required=5\r
+ tests=[AWL=-0.002, DKIM_SIGNED=0.1, DKIM_VALID=-0.1,\r
+ RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=-0.01,\r
+ RCVD_IN_MSPIKE_WL=-0.01, SPF_NEUTRAL=0.652, UNPARSEABLE_RELAY=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 TbQVHJ5cBmqP for <notmuch@notmuchmail.org>;\r
+ Tue, 9 Feb 2016 12:28:42 -0800 (PST)\r
+Received: from mail-wm0-f65.google.com (mail-wm0-f65.google.com\r
+ [74.125.82.65]) by arlo.cworth.org (Postfix) with ESMTPS id 2CA886DE01D3 for\r
+ <notmuch@notmuchmail.org>; Tue, 9 Feb 2016 12:28:42 -0800 (PST)\r
+Received: by mail-wm0-f65.google.com with SMTP id 128so30413wmz.3\r
+ for <notmuch@notmuchmail.org>; Tue, 09 Feb 2016 12:28:42 -0800 (PST)\r
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;\r
+ d=dme-org.20150623.gappssmtp.com; s=20150623;\r
+ h=to:subject:in-reply-to:references:from:date:message-id:mime-version\r
+ :content-type; bh=a5qY8PX+8mdfx948wkY3RPM7iQ1WDROD/w5EDqcDsJo=;\r
+ b=Bp0lK6yNYC3Gb3LOLhJTyBqHmL9eIDCdYyPgo0dJnL/qRljQaDLYS0jeHOrlMOl+Zx\r
+ MsQrT68y1lZSuh4klCUa93UGuNyqSMX2guZ3lBRv1EpJNSlFynHonEAH8jSBy4J5ZiVK\r
+ gRDjXDxxhnaeBZIDvWC1cmb20GMyFJAc7w8shsMkzBnFtrqAAVecxsRq/t4wPG6KAVDZ\r
+ nv64k/CNYOudQswtmn6J9/vOBqYhanBNyXgf1ZoAcZWasarNv/lTh/8nO62l9dxafWa5\r
+ Xt5qHFbDQgqFM/DlnlUYuHdiuB0tpoG1TLAVgTuNRRrR34Dxva9Nhwxroxiyibijcf1m\r
+ 2L0A==\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:from:date\r
+ :message-id:mime-version:content-type;\r
+ bh=a5qY8PX+8mdfx948wkY3RPM7iQ1WDROD/w5EDqcDsJo=;\r
+ b=KWtr1IuPXTIPGbIR8Wpuzqkswx8ZaXW9YJNIC3+qYkdmzHVcafa7BtyFNev8zQd22p\r
+ I1YInVnLa8E7N7+z8hLDp8VDbiR2ZHjkIoT88ldRl9qzLjey3aTdao4Kb9tYVAXZ76uT\r
+ OpsNT6+8sP0f5N0fld6NW6Uhufjyc20gEqTWcP4BE6gzXOtMhBUZsBvM9lFsF4V2w9Sp\r
+ rHuxuTPTk70JzrVKNowXUr6hPPhtUkVwsCu5Dj7LK6QJd0VXitSVyP4YM90dB/qL4gW1\r
+ BerNWacrEEBCyllkj04l9plfUJcaYlyIYtAjy//A6P1Vr9r4tTQowOtTsCwsXnctyV67\r
+ UYwg==\r
+X-Gm-Message-State:\r
+ AG10YORc24I6AZCkjzevYxXVEwTFBNWhelT/zhtp1cwZ+AWHDjdsAFzbmG1XnNqWtgfU7g==\r
+X-Received: by 10.28.131.134 with SMTP id f128mr7160601wmd.41.1455049720860;\r
+ Tue, 09 Feb 2016 12:28:40 -0800 (PST)\r
+Received: from disaster-area.hh.sledj.net\r
+ ([2a01:348:1a2:1:ea39:35ff:fe2c:a227])\r
+ by smtp.gmail.com with ESMTPSA id c136sm19053937wmd.3.2016.02.09.12.28.39\r
+ (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\r
+ Tue, 09 Feb 2016 12:28:39 -0800 (PST)\r
+Received: from localhost (disaster-area.hh.sledj.net [local])\r
+ by disaster-area.hh.sledj.net (OpenSMTPD) with ESMTPA id 6601a644;\r
+ Tue, 9 Feb 2016 20:28:38 +0000 (UTC)\r
+To: Mark Walters <markwalters1009@gmail.com>, notmuch@notmuchmail.org\r
+Subject: Re: [PATCH v4 1/7] emacs/show: Re-arrange determination if a part\r
+ header is necessary\r
+In-Reply-To: <1446894276-7814-2-git-send-email-markwalters1009@gmail.com>\r
+References: <1446894276-7814-1-git-send-email-markwalters1009@gmail.com>\r
+ <1446894276-7814-2-git-send-email-markwalters1009@gmail.com>\r
+From: David Edmondson <dme@dme.org>\r
+Date: Tue, 09 Feb 2016 20:28:38 +0000\r
+Message-ID: <m2fux14oi1.fsf@dme.org>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain\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: Tue, 09 Feb 2016 20:28:44 -0000\r
+\r
+On Sat, Nov 07 2015, Mark Walters wrote:\r
+> From: David Edmondson <dme@dme.org>\r
+>\r
+> Move the determination of whether a part header is required to a\r
+> distinct function.\r
+> ---\r
+> emacs/notmuch-show.el | 25 ++++++++++++++++++-------\r
+> 1 file changed, 18 insertions(+), 7 deletions(-)\r
+>\r
+> diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el\r
+> index 49fd198..47a02e5 100644\r
+> --- a/emacs/notmuch-show.el\r
+> +++ b/emacs/notmuch-show.el\r
+> @@ -929,6 +929,21 @@ (defun notmuch-show-lazy-part (part-args button)\r
+> ;; showable this returns nil.\r
+> (notmuch-show-create-part-overlays button part-beg part-end))))\r
+> \r
+> +(defun notmuch-show-mime-type (part)\r
+> + "Return the correct mime-type to use for PART."\r
+> + (let ((content-type (downcase (plist-get part :content-type))))\r
+> + (or (and (string= content-type "application/octet-stream")\r
+> + (notmuch-show-get-mime-type-of-application/octet-stream part))\r
+> + (and (string= content-type "inline patch")\r
+> + "text/x-diff")\r
+> + content-type)))\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
+> + (let ((mime-type (notmuch-show-mime-type part)))\r
+> + (not (and (string= mime-type "text/plain")\r
+> + (<= (plist-get part :id) 1)))))\r
+\r
+It would be nice to have a comment here that explained the logic being\r
+applied (i.e. parts get a header unless they are text/plain and the\r
+first part). (It actually took me a minute to figure out what the logic\r
+was...)\r
+\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
+> \r
+> @@ -939,11 +954,7 @@ (defun notmuch-show-insert-bodypart (msg part depth &optional hide)\r
+> useful for quoting in replies)."\r
+> \r
+> (let* ((content-type (downcase (plist-get part :content-type)))\r
+> - (mime-type (or (and (string= content-type "application/octet-stream")\r
+> - (notmuch-show-get-mime-type-of-application/octet-stream part))\r
+> - (and (string= content-type "inline patch")\r
+> - "text/x-diff")\r
+> - content-type))\r
+> + (mime-type (notmuch-show-mime-type part))\r
+> (nth (plist-get part :id))\r
+> (long (and (notmuch-match-content-type mime-type "text/*")\r
+> (> notmuch-show-max-text-part-size 0)\r
+> @@ -951,8 +962,8 @@ (defun notmuch-show-insert-bodypart (msg part depth &optional hide)\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
+\r
+Part of this comment now belongs up above.\r
+\r
+> - (button (unless (or (equal hide 'no-buttons)\r
+> - (and (string= mime-type "text/plain") (<= nth 1)))\r
+> + (button (when (and (not (equal hide 'no-buttons))\r
+> + (notmuch-show-insert-header-p 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