--- /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 1BCF1429E54\r
+ for <notmuch@notmuchmail.org>; Sat, 1 Jun 2013 09:46:43 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -1.098\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-1.098 tagged_above=-999 required=5\r
+ tests=[DKIM_ADSP_CUSTOM_MED=0.001, FREEMAIL_FROM=0.001,\r
+ NML_ADSP_CUSTOM_MED=1.2, RCVD_IN_DNSWL_MED=-2.3] 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 JqxFqtMLhy-d for <notmuch@notmuchmail.org>;\r
+ Sat, 1 Jun 2013 09:46:35 -0700 (PDT)\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 73550431FDE\r
+ for <notmuch@notmuchmail.org>; Sat, 1 Jun 2013 09:46:35 -0700 (PDT)\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 1Uiowp-0003YR-D8; Sat, 01 Jun 2013 17:46:31 +0100\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.71)\r
+ (envelope-from <m.walters@qmul.ac.uk>)\r
+ id 1Uiowp-0002l1-0a; Sat, 01 Jun 2013 17:46:31 +0100\r
+From: Mark Walters <markwalters1009@gmail.com>\r
+To: notmuch@notmuchmail.org, Austin Clements <aclements@csail.mit.edu>,\r
+ Adam Wolfe Gordon <awg+notmuch@xvx.ca>\r
+Subject: [PATCH v4 6/5] emacs: show: lazy-part bugfix\r
+In-Reply-To: <1370074547-24677-1-git-send-email-markwalters1009@gmail.com>\r
+References: <1370074547-24677-1-git-send-email-markwalters1009@gmail.com>\r
+User-Agent: Notmuch/0.14+255~gff3cc55 (http://notmuchmail.org) Emacs/23.4.1\r
+ (x86_64-pc-linux-gnu)\r
+Date: Sat, 01 Jun 2013 17:46:30 +0100\r
+Message-ID: <87mwr97p95.fsf@qmul.ac.uk>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain; charset=us-ascii\r
+X-Sender-Host-Address: 93.97.24.31\r
+X-QM-SPAM-Info: Sender has good ham record. :)\r
+X-QM-Body-MD5: 85f0f0cd402e6c847b54dfbcd16b6564 (of first 20000 bytes)\r
+X-SpamAssassin-Score: -0.1\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 -0.1 points.\r
+ Summary of the scoring: \r
+ * 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail\r
+ provider * (markwalters1009[at]gmail.com)\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: Sat, 01 Jun 2013 16:46:43 -0000\r
+\r
+\r
+Previously we inserted the lazy part at the start of the line after\r
+the part button. But if this line had some text properties (e.g. the\r
+colours for a following message header) then the lazy part gets these\r
+properties. Thus we start at the end of the part button line, insert a\r
+newline, insert the lazy part, and then delete the extra newline at the end of\r
+the part.\r
+---\r
+\r
+I found a bug in the lazy-part patch set (v4): the problem can be seen\r
+if you find a multipart/alternative text/plain text/html message with a\r
+reply following it. Before this extra patch the lazy-part gets inserted\r
+with the wrong text properties: in particular it gets the special\r
+background colour that the headerline of a message gets in the show\r
+view. I think this was why I had the "lazy part" text before but this is\r
+probably better. \r
+\r
+I can fold this into the main series but I thought I would ask for\r
+comments on this change first.\r
+\r
+Best wishes\r
+\r
+Mark\r
+ \r
+\r
+\r
+ emacs/notmuch-show.el | 12 ++++++++++--\r
+ 1 files changed, 10 insertions(+), 2 deletions(-)\r
+\r
+diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el\r
+index 92f481b..453ff54 100644\r
+--- a/emacs/notmuch-show.el\r
++++ b/emacs/notmuch-show.el\r
+@@ -818,9 +818,15 @@ message at DEPTH in the current thread."\r
+ t))\r
+ \r
+ (defun notmuch-show-lazy-part (part-args button)\r
+- ;; Insert the lazy part after the button for the part.\r
++ ;; Insert the lazy part after the button for the part. We would just\r
++ ;; move to the start of the new line following the button and insert\r
++ ;; the part but that point might have text properties (eg colours\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
+ (save-excursion\r
+- (goto-char (1+ (button-end button)))\r
++ (goto-char (button-end button))\r
++ (insert "\n")\r
+ (let* ((inhibit-read-only t)\r
+ ;; We need to use markers for the start and end of the part\r
+ ;; because the part insertion functions do not guarantee\r
+@@ -835,6 +841,8 @@ message at DEPTH in the current thread."\r
+ (delete-region part-beg part-end)\r
+ (apply #'notmuch-show-insert-bodypart-internal part-args)\r
+ (indent-rigidly part-beg part-end depth))\r
++ (goto-char part-end)\r
++ (delete-char 1)\r
+ ;; Create the overlay. If the lazy-part turned out to be empty/not\r
+ ;; showable this returns nil.\r
+ (notmuch-show-create-part-overlays button part-beg part-end))))\r
+-- \r
+1.7.9.1\r
+\r
+\r
+\r