--- /dev/null
+Return-Path: <amdragon@mit.edu>\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 31D3F429E38\r
+ for <notmuch@notmuchmail.org>; Wed, 4 Sep 2013 07:56:54 -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 t4IG10QYpxsx for <notmuch@notmuchmail.org>;\r
+ Wed, 4 Sep 2013 07:56:47 -0700 (PDT)\r
+Received: from dmz-mailsec-scanner-5.mit.edu (dmz-mailsec-scanner-5.mit.edu\r
+ [18.7.68.34])\r
+ by olra.theworths.org (Postfix) with ESMTP id 38823429E37\r
+ for <notmuch@notmuchmail.org>; Wed, 4 Sep 2013 07:56:47 -0700 (PDT)\r
+X-AuditID: 12074422-b7ef78e000000935-84-52274a2dbe20\r
+Received: from mailhub-auth-4.mit.edu ( [18.7.62.39])\r
+ by dmz-mailsec-scanner-5.mit.edu (Symantec Messaging Gateway) with SMTP\r
+ id 8B.54.02357.D2A47225; Wed, 4 Sep 2013 10:56:45 -0400 (EDT)\r
+Received: from outgoing.mit.edu (outgoing-auth-1.mit.edu [18.9.28.11])\r
+ by mailhub-auth-4.mit.edu (8.13.8/8.9.2) with ESMTP id r84EuiDg020311; \r
+ Wed, 4 Sep 2013 10:56:45 -0400\r
+Received: from awakening.csail.mit.edu (awakening.csail.mit.edu [18.26.4.91])\r
+ (authenticated bits=0)\r
+ (User authenticated as amdragon@ATHENA.MIT.EDU)\r
+ by outgoing.mit.edu (8.13.8/8.12.4) with ESMTP id r84EufQ7025327\r
+ (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NOT);\r
+ Wed, 4 Sep 2013 10:56:43 -0400\r
+Received: from amthrax by awakening.csail.mit.edu with local (Exim 4.80)\r
+ (envelope-from <amdragon@mit.edu>)\r
+ id 1VHEVc-00055T-Op; Wed, 04 Sep 2013 10:56:41 -0400\r
+Date: Wed, 4 Sep 2013 10:56:39 -0400\r
+From: Austin Clements <amdragon@MIT.EDU>\r
+To: Mark Walters <markwalters1009@gmail.com>\r
+Subject: Re: [PATCH v2] emacs: show: lazy part bugfix\r
+Message-ID: <20130904145639.GB1426@mit.edu>\r
+References: <1377246875-7784-1-git-send-email-markwalters1009@gmail.com>\r
+ <1378279835-28288-1-git-send-email-markwalters1009@gmail.com>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain; charset=us-ascii\r
+Content-Disposition: inline\r
+In-Reply-To: <1378279835-28288-1-git-send-email-markwalters1009@gmail.com>\r
+User-Agent: Mutt/1.5.21 (2010-09-15)\r
+X-Brightmail-Tracker:\r
+ H4sIAAAAAAAAA+NgFmpmleLIzCtJLcpLzFFi42IRYrdT19X1Ug8yWNyiYrF6Lo/F9ZszmR2Y\r
+ PHbOusvu8WzVLeYApigum5TUnMyy1CJ9uwSujGNNC9kLPslWnF9V0MB4TbyLkZNDQsBEYt/6\r
+ WewQtpjEhXvr2boYuTiEBPYxSvx8NYcJwtnAKHH1TBs7hHOKSeJS63kWCGcJo8Spxplg/SwC\r
+ KhK7u3qYQGw2AQ2JbfuXM4LYIgI6ErcPLQCrYRaQlvj2uxmsRljAVGL1xDNgcV4BbYlP87ug\r
+ 1nUwSkxas54VIiEocXLmExaIZi2JG/9eAhVxgA1a/o8DJMwp4CXxdmYTG4gtCnTDlJPb2CYw\r
+ Cs1C0j0LSfcshO4FjMyrGGVTcqt0cxMzc4pTk3WLkxPz8lKLdE31cjNL9FJTSjcxgsPaRWkH\r
+ 48+DSocYBTgYlXh4NQ3Vg4RYE8uKK3MPMUpyMCmJ8urZAIX4kvJTKjMSizPii0pzUosPMUpw\r
+ MCuJ8E51BsrxpiRWVqUW5cOkpDlYlMR5nz09GygkkJ5YkpqdmlqQWgSTleHgUJLgLfIEahQs\r
+ Sk1PrUjLzClBSDNxcIIM5wEa7gRSw1tckJhbnJkOkT/FqCglzusCkhAASWSU5sH1wtLOK0Zx\r
+ oFeEIap4gCkLrvsV0GAmoMFpn1VBBpckIqSkGhjjfsvK/bPc+/+CcYjoFfWMdY3fLVoPPDhg\r
+ sO/Q2ZMux0RXSG30PBn4YK/8wsJ7KcGzt3tvv7k20TGp66mpP8v/wOQrHcGftrxkTnDdxr//\r
+ vbFMhU61ZEbqRLbw2/HLXVONzA9yn7ryTDfw5uzgObrnBdhq56+c1PJh4TIW9jI1vjNpk2fr\r
+ 8GUrsRRnJBpqMRcVJwIA4U4JKxYDAAA=\r
+Cc: notmuch@notmuchmail.org\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: Wed, 04 Sep 2013 14:56:54 -0000\r
+\r
+Quoth Mark Walters on Sep 04 at 8:30 am:\r
+> The lazy part handling had a subtle bug. Notmuch stores the part\r
+> information as a text property with the displayed part so attachment\r
+> handling (saving viewing etc work).\r
+\r
+s/ work)/) work/\r
+\r
+> \r
+> Now, some mime parts have subparts and to avoid overwriting the\r
+> sub-part data notmuch checks and if part data is already recorded it\r
+> does not overwrite it.\r
+> \r
+> Now with lazy part handling this could fail: there is already part\r
+> data stored. In the common case it works as the part type information\r
+> was stored when the lazy-part button was inserted. However, this fails\r
+> if the lazy part has sub-parts: notmuch had no idea these existed\r
+> until the lazy part insertion.\r
+\r
+This says that things fail when a lazy part has sub-parts, but not\r
+what the failure is. What is the failure? Can you give a specific\r
+sequence of events and conditions that leads to and demonstrates the\r
+failure?\r
+\r
+(I ask not just for commit posterity, but because I actually don't\r
+know, though I may have figured it out after writing the comment\r
+below.)\r
+\r
+> We fix this by removing any existing part-information from the\r
+> relevant region before doing the lazy insertion.\r
+> ---\r
+> This is the same as the previous patch\r
+> id:1377246875-7784-1-git-send-email-markwalters1009@gmail.com except I\r
+> have added a substantial comment. I now believe the +1 in the remove\r
+> part information is genuinely correct for the reason detailed in the comment.\r
+> \r
+> This does seem to fix an actual bug (see parent message and links there).\r
+> \r
+> Best wishes\r
+> \r
+> Mark\r
+> \r
+> \r
+> emacs/notmuch-show.el | 13 +++++++++++++\r
+> 1 files changed, 13 insertions(+), 0 deletions(-)\r
+> \r
+> diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el\r
+> index 20844f0..58ef4df 100644\r
+> --- a/emacs/notmuch-show.el\r
+> +++ b/emacs/notmuch-show.el\r
+> @@ -852,7 +852,20 @@ message at DEPTH in the current thread."\r
+> ;; from a message header etc) so instead we start from the last\r
+> ;; character of the button by adding a newline and finish by\r
+> ;; removing the extra newline from the end of the part.\r
+> + ;;\r
+> + ;; Essentially, this function wants text properties to be\r
+> + ;; front-nonsticky (where most of the other functions need\r
+> + ;; front-sticky so that is what they actually are) and this is a way\r
+> + ;; of faking the front-nonsticky for this one function.\r
+\r
+Most properties are rear-sticky and front-nonsticky. Maybe this is\r
+referring specifically to :notmuch-part, which is the other way\r
+around?\r
+\r
+> + ;;\r
+> + ;; For exactly this reason we also remove existing part-information\r
+> + ;; from one extra character: this extra character is the newline\r
+> + ;; that we delete at the end.\r
+\r
+This comment doesn't say what the root of the problem is. Is the\r
+following accurate?\r
+\r
+;; First, eliminate the :notmuch-part property from the region we'll\r
+;; be inserting this part in, since we never override an existing\r
+;; :notmuch-part property. If we're inserting a leaf part, it will\r
+;; re-apply the same :notmuch-part, but if this isn't a leaf, the\r
+;; children need to apply different :notmuch-part values.\r
+;; :notmuch-part was originally applied to the newline following the\r
+;; button as well, so remove it from that character, too. (If we\r
+;; didn't remove it from the newline, this would all be for naught:\r
+;; :notmuch-part is front-sticky and we insert the part immediately\r
+;; before this newline, so the part would inherit :notmuch-part from\r
+;; the newline.)\r
+\r
+> +\r
+> (save-excursion\r
+> + ;; Remove part-information from lazy part-region\r
+> + (put-text-property (button-start button) (1+ (button-end button)) :notmuch-part nil)\r
+> +\r
+> (goto-char (button-end button))\r
+> (insert "\n")\r
+> (let* ((inhibit-read-only t)\r