--- /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 6C358431FCB\r
+ for <notmuch@notmuchmail.org>; Fri, 31 May 2013 16:00:01 -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 CfjegQsiWoDi for <notmuch@notmuchmail.org>;\r
+ Fri, 31 May 2013 15:59:55 -0700 (PDT)\r
+Received: from dmz-mailsec-scanner-1.mit.edu (dmz-mailsec-scanner-1.mit.edu\r
+ [18.9.25.12])\r
+ by olra.theworths.org (Postfix) with ESMTP id 22D31431FBD\r
+ for <notmuch@notmuchmail.org>; Fri, 31 May 2013 15:59:55 -0700 (PDT)\r
+X-AuditID: 1209190c-b7f566d000004c69-88-51a92b69f8e4\r
+Received: from mailhub-auth-4.mit.edu ( [18.7.62.39])\r
+ by dmz-mailsec-scanner-1.mit.edu (Symantec Messaging Gateway) with SMTP\r
+ id AB.FF.19561.96B29A15; Fri, 31 May 2013 18:59:53 -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 r4VMxpuG007258; \r
+ Fri, 31 May 2013 18:59:52 -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 r4VMxn9L025014\r
+ (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NOT);\r
+ Fri, 31 May 2013 18:59:51 -0400\r
+Received: from amthrax by awakening.csail.mit.edu with local (Exim 4.80)\r
+ (envelope-from <amdragon@mit.edu>)\r
+ id 1UiYIX-00055h-3h; Fri, 31 May 2013 18:59:49 -0400\r
+From: Austin Clements <aclements@csail.mit.edu>\r
+To: Mark Walters <markwalters1009@gmail.com>, notmuch@notmuchmail.org,\r
+ Adam Wolfe Gordon <awg+notmuch@xvx.ca>\r
+Subject: Re: [PATCH v3 3/5] emacs: show: pass button to create-overlays\r
+In-Reply-To: <1370024806-6616-4-git-send-email-markwalters1009@gmail.com>\r
+References: <1370024806-6616-1-git-send-email-markwalters1009@gmail.com>\r
+ <1370024806-6616-4-git-send-email-markwalters1009@gmail.com>\r
+User-Agent: Notmuch/0.15.2+83~g8bee3c4 (http://notmuchmail.org) Emacs/23.4.1\r
+ (i486-pc-linux-gnu)\r
+Date: Fri, 31 May 2013 18:59:48 -0400\r
+Message-ID: <874ndi3gd7.fsf@awakening.csail.mit.edu>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain; charset=us-ascii\r
+X-Brightmail-Tracker:\r
+ H4sIAAAAAAAAA+NgFvrGIsWRmVeSWpSXmKPExsUixG6nrpupvTLQYPd+dYsje2axW6yey2Nx\r
+ /eZMZgdmj52z7rJ7PFt1i9mj6cdi1gDmKC6blNSczLLUIn27BK6MCbM+sRQsk6y4vvU9YwPj\r
+ beEuRk4OCQETiR8ndzJC2GISF+6tZwOxhQT2MUrM2yrTxcgFZG9klOif+IYJwjnNJLGgZRYb\r
+ hLOEUeL/1Plg7WwC+hIr1k5iBbFFBMoktkyfxQRiMwvoSJzYvQ2sRljAXWLhzl6wFZwCnhIr\r
+ 2qZDDWpllLj07g8zSEJUIEFi5d0TQA0cHCwCqhKPj6eChHmBTm3c2csIYQtKnJz5hAVivpbE\r
+ jX8vmSYwCs5CkpqFJLWAkWkVo2xKbpVubmJmTnFqsm5xcmJeXmqRrqFebmaJXmpK6SZGUPBy\r
+ SvLsYHxzUOkQowAHoxIPb8eqFYFCrIllxZW5hxglOZiURHnr1VcGCvEl5adUZiQWZ8QXleak\r
+ Fh9ilOBgVhLhzZ8DVM6bklhZlVqUD5OS5mBREue9nHLTX0ggPbEkNTs1tSC1CCYrw8GhJMG7\r
+ XAtoqGBRanpqRVpmTglCmomDE2Q4D9DwLpAa3uKCxNzizHSI/ClGRSlx3l6QhABIIqM0D64X\r
+ llxeMYoDvSIMUcUDTExw3a+ABjMBDX5ivRxkcEkiQkqqgVHR7dX57GCbiI8B9kbLD5c9blrx\r
+ 7oL2+gndryd/e3Nf9JnbzVu3i3x/7v227s6Uy8EcOedLrmkZML49tLCp+fHB9YH/FVdd5fpR\r
+ rXWWvelh+42dnxKKvmoE3Xqp9JXxZYibgcD80KPJH4SL2ievPvKq8PnBDjdBXh63DvZ2/UbX\r
+ dT1Ty67WtF5WYinOSDTUYi4qTgQAbVL0IgkDAAA=\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:00:01 -0000\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
+> \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
+> \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
+> -- \r
+> 1.7.10.4\r