From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id 5F7E9431FD5 for ; Fri, 23 Aug 2013 01:34:47 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: 0.201 X-Spam-Level: X-Spam-Status: No, score=0.201 tagged_above=-999 required=5 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FREEMAIL_ENVFROM_END_DIGIT=1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled Received: from olra.theworths.org ([127.0.0.1]) by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id c+8zUFvkLPKQ for ; Fri, 23 Aug 2013 01:34:43 -0700 (PDT) Received: from mail-we0-f180.google.com (mail-we0-f180.google.com [74.125.82.180]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id D26D6431FAE for ; Fri, 23 Aug 2013 01:34:42 -0700 (PDT) Received: by mail-we0-f180.google.com with SMTP id q58so258512wes.25 for ; Fri, 23 Aug 2013 01:34:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=JKJgzo4Y18lFRdP5oIUpYWjBXd/CKkcPmKWGmURZ3tw=; b=mRtU0J0KwZX2b26XsBWUrx/Z7aucOu4EL/ddjrda7Xfr8bQP+WsyhKWhzD/HbtzMjk Nb2tiv6mwrlKnWvGRifJgl3PE9A0m+1k9957qZ627b2zq+yDISfMPwf9+bg7+ah8/esR /GylGwI8LUv3wBHJ3hjxRTkI5I9kwqybMxIf3doQZaBY1xnGdSbODzQ0dSaxT1/Jcr/k hd5eC+CprucLiruVXzu1KxiOUGzKJ6FOa+4vApEhUfZsIZsKBcu+3V2JjFvIKDBX6nIN 8wjePBTdJ3RJWEO/FPUFGYdcMPEKTWk1eS+QqPr9WdfUDTsR9D/bAgDW1A4KXYT4MTtM NdxQ== X-Received: by 10.180.184.84 with SMTP id es20mr1266534wic.37.1377246879165; Fri, 23 Aug 2013 01:34:39 -0700 (PDT) Received: from localhost (93-97-24-31.zone5.bethere.co.uk. [93.97.24.31]) by mx.google.com with ESMTPSA id ei6sm2045104wid.11.1969.12.31.16.00.00 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Fri, 23 Aug 2013 01:34:38 -0700 (PDT) From: Mark Walters To: notmuch@notmuchmail.org, amdragon@MIT.EDU Subject: [PATCH] emacs: show: lazy part bugfix Date: Fri, 23 Aug 2013 09:34:35 +0100 Message-Id: <1377246875-7784-1-git-send-email-markwalters1009@gmail.com> X-Mailer: git-send-email 1.7.9.1 X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Aug 2013 08:34:47 -0000 The lazy part handling had a subtle bug. Notmuch stores the part information as a text property with the displayed part so attachment handling (saving viewing etc work). Now, some mime parts have subparts and to avoid overwriting the sub-part data notmuch checks and if part data is already recorded it does not overwrite it. Now with lazy part handling this could fail: there is already part data stored. In the common case it works as the part type information was stored when the lazy-part button was inserted. However, this fails if the lazy part has sub-parts: notmuch had no idea these existed until the lazy part insertion. We fix this by removing any existing part-information from the relevant region before doing the lazy insertion. --- This was shown up by Istvan's patch in id:m3r4dtgz9k.fsf@zsu.kismala.com and the bug found by Jamie in id:87fvu4fl25.fsf@servo.finestructure.net I think this is essentially the right patch: I am not certain about the +1 in the removing the property. It seems to be needed but maybe something with front/back sticky would be better. Also this definitely needs more testing before going into master: this code is definitely fragile. Best wishes Mark emacs/notmuch-show.el | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el index 20844f0..a31b6dc 100644 --- a/emacs/notmuch-show.el +++ b/emacs/notmuch-show.el @@ -853,6 +853,9 @@ message at DEPTH in the current thread." ;; character of the button by adding a newline and finish by ;; removing the extra newline from the end of the part. (save-excursion + ;; Remove part-information from lazy part-region + (put-text-property (button-start button) (1+ (button-end button)) :notmuch-part nil) + (goto-char (button-end button)) (insert "\n") (let* ((inhibit-read-only t) -- 1.7.9.1