--- /dev/null
+Return-Path: <aclements@csail.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 9EAD4431FDB\r
+ for <notmuch@notmuchmail.org>; Fri, 31 May 2013 16:12:55 -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 v3xJ5CBIWSvf for <notmuch@notmuchmail.org>;\r
+ Fri, 31 May 2013 16:12:51 -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 815AD431FBD\r
+ for <notmuch@notmuchmail.org>; Fri, 31 May 2013 16:12:51 -0700 (PDT)\r
+X-AuditID: 12074422-b7f5b6d00000095d-6f-51a92e73b8ac\r
+Received: from mailhub-auth-1.mit.edu ( [18.9.21.35])\r
+ by dmz-mailsec-scanner-5.mit.edu (Symantec Messaging Gateway) with SMTP\r
+ id 3E.60.02397.37E29A15; Fri, 31 May 2013 19:12:51 -0400 (EDT)\r
+Received: from outgoing.mit.edu (outgoing-auth-1.mit.edu [18.9.28.11])\r
+ by mailhub-auth-1.mit.edu (8.13.8/8.9.2) with ESMTP id r4VNCgat001760; \r
+ Fri, 31 May 2013 19:12:42 -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 r4VNCeok028579\r
+ (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NOT);\r
+ Fri, 31 May 2013 19:12:41 -0400\r
+Received: from amthrax by awakening.csail.mit.edu with local (Exim 4.80)\r
+ (envelope-from <aclements@csail.mit.edu>)\r
+ id 1UiYUx-0005AP-Sc; Fri, 31 May 2013 19:12:39 -0400\r
+Date: Fri, 31 May 2013 19:12:39 -0400\r
+From: Austin Clements <aclements@csail.mit.edu>\r
+To: Mark Walters <markwalters1009@gmail.com>\r
+Subject: Re: [PATCH v3 3/5] emacs: show: pass button to create-overlays\r
+Message-ID: <20130531231239.GD5999@mit.edu>\r
+References: <1370024806-6616-1-git-send-email-markwalters1009@gmail.com>\r
+ <1370024806-6616-4-git-send-email-markwalters1009@gmail.com>\r
+ <874ndi3gd7.fsf@awakening.csail.mit.edu>\r
+ <87vc5yg329.fsf@qmul.ac.uk>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain; charset=us-ascii\r
+Content-Disposition: inline\r
+In-Reply-To: <87vc5yg329.fsf@qmul.ac.uk>\r
+User-Agent: Mutt/1.5.21 (2010-09-15)\r
+X-Brightmail-Tracker:\r
+ H4sIAAAAAAAAA+NgFprJKsWRmVeSWpSXmKPExsUixCmqrFustzLQ4GoPm8WRPbPYLVbP5bG4\r
+ fnMmswOzx85Zd9k9nq26xezR9GMxawBzFJdNSmpOZllqkb5dAldG965TbAX7FCs2zP/G1sD4\r
+ RLKLkZNDQsBEYtmvOWwQtpjEhXvrgWwuDiGBfYwS5479YoRwNjJK7Pv2ghnCOc0ksf3gO1YI\r
+ ZzWjxPf5R5m6GDk4WARUJfZdVQUZxSagL7Fi7SRWEFtEQEfi9qEF7CA2s4CzxL5PnWDrhAXc\r
+ JRbu7AWzeQW0JR7tvQ21+gKjxMW+XYwQCUGJkzOfsEA0a0nc+PcSbBezgLTE8n8cIGFOAQ2J\r
+ xlvzwEpEBVQkppzcxjaBUWgWku5ZSLpnIXQvYGRexSibklulm5uYmVOcmqxbnJyYl5dapGuq\r
+ l5tZopeaUrqJERTq7C5KOxh/HlQ6xCjAwajEw2uwYkWgEGtiWXFl7iFGSQ4mJVHeevWVgUJ8\r
+ SfkplRmJxRnxRaU5qcWHGCU4mJVEePPnAJXzpiRWVqUW5cOkpDlYlMR5r6Xc9BcSSE8sSc1O\r
+ TS1ILYLJynBwKEnwVuoCDRUsSk1PrUjLzClBSDNxcIIM5wEaHgNSw1tckJhbnJkOkT/FqMux\r
+ +fzkd4xCLHn5ealS4ryxIEUCIEUZpXlwc2Ap6hWjONBbwryzQKp4gOkNbtIroCVMQEueWC8H\r
+ WVKSiJCSamA0EJyyn4OlYdeU8xNaluxS6auZ32/1j90/vV606UVVyZk/J3vOv6hf43N42qQ/\r
+ f995/T18Jp5pWgiLs+2CfateCs4UceH95V8RtMHk4zY1M3vpl7dfr3+bvL03geH12w+Xvgip\r
+ Lst4GfSuekVqsNnO6IpJHwT2LNvxaXX7FL/lvtpyp/P6/F/7K7EUZyQaajEXFScCAFWNR4Is AwAA\r
+X-Mailman-Approved-At: Fri, 31 May 2013 23:39:02 -0700\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: Fri, 31 May 2013 23:12:55 -0000\r
+\r
+Quoth Mark Walters on Jun 01 at 12:08 am:\r
+> \r
+> > On Fri, 31 May 2013, Mark Walters <markwalters1009@gmail.com> wrote:\r
+> >> Now that the bodypart code has the button we can pass that to\r
+> >> create-overlays and simplify that.\r
+> >> ---\r
+> >> emacs/notmuch-show.el | 26 ++++++++++++--------------\r
+> >> 1 file changed, 12 insertions(+), 14 deletions(-)\r
+> >>\r
+> >> diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el\r
+> >> index be3aeac..66cc3a5 100644\r
+> >> --- a/emacs/notmuch-show.el\r
+> >> +++ b/emacs/notmuch-show.el\r
+> >> @@ -851,21 +851,19 @@ message at DEPTH in the current thread."\r
+> >> (setq handlers (cdr handlers))))\r
+> >> t)\r
+> >> \r
+> >> -(defun notmuch-show-create-part-overlays (msg beg end hide)\r
+> >> +(defun notmuch-show-create-part-overlays (button beg end hide)\r
+> >> "Add an overlay to the part between BEG and END"\r
+> >> - (let* ((button (button-at beg))\r
+> >> - (part-beg (and button (1+ (button-end button)))))\r
+> >> -\r
+> >> - ;; If the part contains no text we do not make it toggleable. We\r
+> >> - ;; also need to check that the button is a genuine part button not\r
+> >> - ;; a notmuch-wash button.\r
+> >> - (when (and button (/= part-beg end) (button-get button :base-label))\r
+> >> - (button-put button 'overlay (make-overlay part-beg end))\r
+> >> - ;; We toggle the button for hidden parts as that gets the\r
+> >> +\r
+> >> + ;; If there is no button (i.e., the part is text/plain and the first\r
+> >> + ;; part) or if the part has no content then we don't make the part\r
+> >> + ;; toggleable.\r
+> >> + (when (and button (/= beg end))\r
+> >> + (button-put button 'overlay (make-overlay beg end))\r
+> >> + ;; We toggle the button for hidden parts as that gets the\r
+> >> ;; button label right.\r
+> >> (save-excursion\r
+> >> (when hide\r
+> >> - (notmuch-show-toggle-part-invisibility button))))))\r
+> >> + (notmuch-show-toggle-part-invisibility button)))))\r
+> >\r
+> > I might just be mis-following the diff here, but shouldn't the above get\r
+> > re-indented?\r
+> \r
+> I think you are right: it got a bit messed up when I tried to split up\r
+> the patch. I don't think it matters much as these lines get deleted in\r
+> the next patch. Incidentally is there a good git work flow for fixing up\r
+> something like this where you just want to change the midpoint of a\r
+> series?\r
+\r
+Yeah, I just came across that. If you want to fix it up, personally I\r
+would use git rebase -i and mark this patch as "edit", then amend this\r
+commit to fix the indentation, continue the rebase, and clean up the\r
+inevitable rebase conflict when it replays the next patch.\r
+\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
+> >> @@ -879,10 +877,10 @@ If HIDE is non-nil then initially hide this part."\r
+> >> "text/x-diff")\r
+> >> content-type))\r
+> >> (nth (plist-get part :id))\r
+> >> - (beg (point))\r
+> >> ;; We omit the part button for the first (or only) part if this is text/plain.\r
+> >> (button (unless (and (string= mime-type "text/plain") (<= nth 1))\r
+> >> - (notmuch-show-insert-part-header nth mime-type content-type (plist-get part :filename)))))\r
+> >> + (notmuch-show-insert-part-header nth mime-type content-type (plist-get part :filename))))\r
+> >> + (beg (point)))\r
+> >\r
+> > Was this swap necessary?\r
+> \r
+> This is needed: inserting a part header moves point and this means that\r
+> point is at the start of the part content rather than the start of the\r
+> part button.\r
+\r
+Ah, okay.\r
+\r
+> Best wishes\r
+> \r
+> Mark\r
+> \r
+> >\r
+> >> \r
+> >> (notmuch-show-insert-bodypart-internal msg part mime-type nth depth button)\r
+> >> ;; Some of the body part handlers leave point somewhere up in the\r
+> >> @@ -891,7 +889,7 @@ If HIDE is non-nil then initially hide this part."\r
+> >> ;; Ensure that the part ends with a carriage return.\r
+> >> (unless (bolp)\r
+> >> (insert "\n"))\r
+> >> - (notmuch-show-create-part-overlays msg beg (point) hide)))\r
+> >> + (notmuch-show-create-part-overlays button beg (point) hide)))\r
+> >> \r
+> >> (defun notmuch-show-insert-body (msg body depth)\r
+> >> "Insert the body BODY at depth DEPTH in the current thread."\r