[PATCH] emacs: show: refresh buffer did not remove overlays
[notmuch-archives.git] / 47 / efd3eec03fa603c31d6ab8d11f4fee3a8b2d37
1 Return-Path: <markwalters1009@gmail.com>\r
2 X-Original-To: notmuch@notmuchmail.org\r
3 Delivered-To: notmuch@notmuchmail.org\r
4 Received: from localhost (localhost [127.0.0.1])\r
5         by olra.theworths.org (Postfix) with ESMTP id 9E937431FBC\r
6         for <notmuch@notmuchmail.org>; Mon,  3 Dec 2012 05:11:05 -0800 (PST)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: 0.201\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=0.201 tagged_above=-999 required=5\r
12         tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,\r
13         FREEMAIL_ENVFROM_END_DIGIT=1, FREEMAIL_FROM=0.001,\r
14         RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\r
15 Received: from olra.theworths.org ([127.0.0.1])\r
16         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
17         with ESMTP id pQZjcwT4wON6 for <notmuch@notmuchmail.org>;\r
18         Mon,  3 Dec 2012 05:11:05 -0800 (PST)\r
19 Received: from mail-wi0-f181.google.com (mail-wi0-f181.google.com\r
20         [209.85.212.181]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
21         (No client certificate requested)\r
22         by olra.theworths.org (Postfix) with ESMTPS id 0EE1C431FAE\r
23         for <notmuch@notmuchmail.org>; Mon,  3 Dec 2012 05:11:04 -0800 (PST)\r
24 Received: by mail-wi0-f181.google.com with SMTP id hm9so1011810wib.2\r
25         for <notmuch@notmuchmail.org>; Mon, 03 Dec 2012 05:11:04 -0800 (PST)\r
26 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;\r
27         h=from:to:cc:subject:date:message-id:x-mailer;\r
28         bh=rf2JUMYk3zwhrNc+f/0R3cU1dFQvRlKq4jUv1Vz7KdQ=;\r
29         b=KIUJl5ZiALuGEhn+6IFx81kh5jPMsrA35Eo6uqaoKkebLCj5UV6fg09vawmgsPpwhe\r
30         C+MUTnCnpIOZyEVkmlgSdNCHLJXZhfZQGgqdVomZEbKCnwMEIgDB+mYfxqVFWkJ9zDAk\r
31         mBGzblfWmP/nlelouk8K142C799AWEt/SB0U0R3cphDiFYqq6VyKvdsvOmwzJrs3Yg0x\r
32         tz8qNxTi3WLc1A8/nEy/qTi8SJTmBcv3CSrCPciL60svO6h0cYlHUupnKFG1q9SQCF1q\r
33         mj03KAcwWfe9a/qdRxoKm9mHF4P4UIZolgLPJuwOr96bCHrjcBji1uZecBBP5OZq6Neh\r
34         uWKw==\r
35 Received: by 10.216.206.152 with SMTP id l24mr3290838weo.93.1354540263889;\r
36         Mon, 03 Dec 2012 05:11:03 -0800 (PST)\r
37 Received: from localhost (93-97-24-31.zone5.bethere.co.uk. [93.97.24.31])\r
38         by mx.google.com with ESMTPS id cf6sm12492971wib.3.2012.12.03.05.11.01\r
39         (version=TLSv1/SSLv3 cipher=OTHER);\r
40         Mon, 03 Dec 2012 05:11:02 -0800 (PST)\r
41 From: Mark Walters <markwalters1009@gmail.com>\r
42 To: notmuch@notmuchmail.org\r
43 Subject: [PATCH] emacs: show: refresh buffer did not remove overlays\r
44 Date: Mon,  3 Dec 2012 13:11:00 +0000\r
45 Message-Id: <1354540260-21814-1-git-send-email-markwalters1009@gmail.com>\r
46 X-Mailer: git-send-email 1.7.9.1\r
47 X-BeenThere: notmuch@notmuchmail.org\r
48 X-Mailman-Version: 2.1.13\r
49 Precedence: list\r
50 List-Id: "Use and development of the notmuch mail system."\r
51         <notmuch.notmuchmail.org>\r
52 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
53         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
54 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
55 List-Post: <mailto:notmuch@notmuchmail.org>\r
56 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
57 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
58         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
59 X-List-Received-Date: Mon, 03 Dec 2012 13:11:05 -0000\r
60 \r
61 Previously refreshing the notmuch show buffer did not remove overlays\r
62 which meant that if the user refreshed a message with images the\r
63 images would remain and then the new text was added after.\r
64 \r
65 One might have guessed that erase-buffer would have removed them but\r
66 it seems not.  Thus force the removal of overlays with remove-overlay.\r
67 ---\r
68 The new toggle-parts code makes this bug much more likely to trigger\r
69 (as the user is quite likely to toggle a part in a message with an\r
70 image). However, it was already present if anyone tried refreshing a\r
71 show buffer with an image in it.\r
72 \r
73 It would be good if someone could check whether there is anything else\r
74 that also needs to be manually removed. But, for me at least, this\r
75 seems to fix the problem.\r
76 \r
77 Many thanks to Jani for finding the bug and helping with the diagnosis.\r
78 \r
79 Best wishes\r
80 \r
81 Mark\r
82 \r
83 \r
84 \r
85 \r
86  emacs/notmuch-show.el |    3 +++\r
87  1 files changed, 3 insertions(+), 0 deletions(-)\r
88 \r
89 diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el\r
90 index c8c1657..e89dba2 100644\r
91 --- a/emacs/notmuch-show.el\r
92 +++ b/emacs/notmuch-show.el\r
93 @@ -1214,6 +1214,9 @@ reset based on the original query."\r
94                    (setq notmuch-show-message-multipart/alternative-display-parts nil)\r
95                  (notmuch-show-capture-state))))\r
96      (erase-buffer)\r
97 +    ;; erase-buffer does not seem to remove overlays so do it manually.\r
98 +    ;; This can lead to weird effects such as remaining images.\r
99 +    (remove-overlays)\r
100      (notmuch-show-build-buffer)\r
101      (if state\r
102         (notmuch-show-apply-state state)\r
103 -- \r
104 1.7.9.1\r
105 \r