--- /dev/null
+Return-Path: <m.walters@qmul.ac.uk>\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 258C2431FAF\r
+ for <notmuch@notmuchmail.org>; Tue, 18 Dec 2012 00:54:10 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 1.401\r
+X-Spam-Level: *\r
+X-Spam-Status: No, score=1.401 tagged_above=-999 required=5\r
+ tests=[DKIM_ADSP_CUSTOM_MED=0.001, FREEMAIL_FROM=0.001,\r
+ FREEMAIL_REPLY=2.499, NML_ADSP_CUSTOM_MED=1.2, RCVD_IN_DNSWL_MED=-2.3]\r
+ 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 2W2R3gS7bO2U for <notmuch@notmuchmail.org>;\r
+ Tue, 18 Dec 2012 00:54:08 -0800 (PST)\r
+Received: from mail2.qmul.ac.uk (mail2.qmul.ac.uk [138.37.6.6])\r
+ (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))\r
+ (No client certificate requested)\r
+ by olra.theworths.org (Postfix) with ESMTPS id 13089431FAE\r
+ for <notmuch@notmuchmail.org>; Tue, 18 Dec 2012 00:54:08 -0800 (PST)\r
+Received: from smtp.qmul.ac.uk ([138.37.6.40])\r
+ by mail2.qmul.ac.uk with esmtp (Exim 4.71)\r
+ (envelope-from <m.walters@qmul.ac.uk>)\r
+ id 1Tksw8-0004uF-7Y; Tue, 18 Dec 2012 08:54:04 +0000\r
+Received: from 93-97-24-31.zone5.bethere.co.uk ([93.97.24.31] helo=localhost)\r
+ by smtp.qmul.ac.uk with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.69)\r
+ (envelope-from <m.walters@qmul.ac.uk>)\r
+ id 1Tksw7-0004gq-T1; Tue, 18 Dec 2012 08:54:04 +0000\r
+From: Mark Walters <markwalters1009@gmail.com>\r
+To: notmuch@notmuchmail.org\r
+Subject: Re: [PATCH v4 0/5] Use invisibility to toggle display of all parts\r
+ including multipart\r
+In-Reply-To: <1355781287-6010-1-git-send-email-markwalters1009@gmail.com>\r
+References: <1355781287-6010-1-git-send-email-markwalters1009@gmail.com>\r
+User-Agent: Notmuch/0.14+236~g1d0044f (http://notmuchmail.org) Emacs/24.2.1\r
+ (x86_64-pc-linux-gnu)\r
+Date: Tue, 18 Dec 2012 08:54:03 +0000\r
+Message-ID: <87ip7zu4es.fsf@qmul.ac.uk>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain\r
+X-Sender-Host-Address: 93.97.24.31\r
+X-QM-SPAM-Info: Sender has good ham record. :)\r
+X-QM-Body-MD5: 3c6eba937d4796f95dd81d2e8eb32c68 (of first 20000 bytes)\r
+X-SpamAssassin-Score: -1.2\r
+X-SpamAssassin-SpamBar: -\r
+X-SpamAssassin-Report: The QM spam filters have analysed this message to\r
+ determine if it is\r
+ spam. We require at least 5.0 points to mark a message as spam.\r
+ This message scored -1.2 points.\r
+ Summary of the scoring: \r
+ * -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at http://www.dnswl.org/,\r
+ * medium trust\r
+ * [138.37.6.40 listed in list.dnswl.org]\r
+ * 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail\r
+ provider * (markwalters1009[at]gmail.com)\r
+ * -0.0 T_RP_MATCHES_RCVD Envelope sender domain matches handover relay\r
+ * domain\r
+ * 1.0 FREEMAIL_REPLY From and body contain different freemails\r
+ * 0.1 AWL AWL: From: address is in the auto white-list\r
+X-QM-Scan-Virus: ClamAV says the message is clean\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: Tue, 18 Dec 2012 08:54:10 -0000\r
+\r
+On Mon, 17 Dec 2012, Mark Walters <markwalters1009@gmail.com> wrote:\r
+> This is version 4 of this series (previous version at\r
+> id:1355559338-14313-1-git-send-email-markwalters1009@gmail.com).\r
+>\r
+> The only change should be a bugfix which, for reasons I don't\r
+> understand, only causes a problem on emacs 24. The problem is that the\r
+> part invisibility code looks for a part button at the start of the\r
+> region. This gets confused if there is a part with no part button\r
+> (this is the case for the first part if it is text/plain) and the part\r
+> starts with a button (as can happen if the message starts with the\r
+> reply as in the first test in test/emacs-show).\r
+>\r
+> This checks that the button is a part button before creating the part\r
+> overlay.\r
+\r
+I don't think the above is very clear so I will try to explain it more\r
+fully. \r
+\r
+The invisibility overlay for a part needs to be `linked' to the part\r
+header button so that the part header button can toggle the overlay\r
+visibility. The overlay is created and linked to this button after the\r
+whole part has been inserted (including any notmuch-wash stuff). \r
+\r
+I could have made insert-part-header return the button it made and pass\r
+it back up the call chain to the the create-overlays function but\r
+instead I chose to make create-overlays just take the button at the\r
+start of the part.\r
+\r
+Now if the first part is text/plain then notmuch does not insert a\r
+[text/plain] button so the code checks for this case by making sure the\r
+part does start with a button, and if not it does not create the part\r
+overlay (there is no button to toggle it so no point in an overlay).\r
+\r
+However, if the first part is text/plain and notmuch wash happens to\r
+make a button at the very start of the part then the create-overlays\r
+function did still create an overlay *and* link it to the button. This\r
+linking overwrote some of the things notmuch wash had attached to its\r
+button (eg the button :overlay property) and that caused things to\r
+break.\r
+\r
+I still do not know why emacs 23 and emacs 24 behave differently, but\r
+regardless the change from v3 is a clear bugfix: we just make sure it is\r
+a notmuch-show-insert-part-header button not a notmuch-wash button\r
+before we do the overlay creation/linking to the button. This version\r
+does that by looking for a :base-label property of the button which\r
+insert-part-header buttons have but notmuch-wash buttons do\r
+not. (Obviously there are other ways this check could be done)\r
+\r
+Best wishes\r
+\r
+Mark\r
+\r
+\r
+\r
+> The diff is below the diffstat. \r
+>\r
+> Best wishes\r
+>\r
+> Mark\r
+>\r
+>\r
+>\r
+> Mark Walters (5):\r
+> emacs: show: modify insert-part-header to save the button text\r
+> emacs: show: add overlays for each part\r
+> emacs: show: add invisibility button action\r
+> emacs: wash: fix fake-diff part to include msg parameter\r
+> emacs: show: set default show-all-multipart/alternatives to nil\r
+>\r
+> emacs/notmuch-show.el | 115 ++++++++++++++++++++++++++++++++++++++-----------\r
+> emacs/notmuch-wash.el | 2 +-\r
+> 2 files changed, 90 insertions(+), 27 deletions(-)\r
+>\r
+> diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el\r
+> index 5ca6fe2..3816e32 100644\r
+> --- a/emacs/notmuch-show.el\r
+> +++ b/emacs/notmuch-show.el\r
+> @@ -865,8 +865,10 @@ message at DEPTH in the current thread."\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.\r
+> - (when (and button (/= part-beg end))\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
+> (let ((base-label (button-get button :base-label))\r
+> (overlay (make-overlay part-beg end))\r
+> (message-invis-spec (plist-get msg :message-invis-spec))\r
+> -- \r
+> 1.7.9.1\r