[PATCH v2] emacs: show: refresh buffer did not remove overlays
authorMark Walters <markwalters1009@gmail.com>
Wed, 5 Dec 2012 12:11:49 +0000 (12:11 +0000)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:51:31 +0000 (09:51 -0800)
9a/406eb64999dc51b475092063e18e30185f6501 [new file with mode: 0644]

diff --git a/9a/406eb64999dc51b475092063e18e30185f6501 b/9a/406eb64999dc51b475092063e18e30185f6501
new file mode 100644 (file)
index 0000000..7ee7aca
--- /dev/null
@@ -0,0 +1,101 @@
+Return-Path: <markwalters1009@gmail.com>\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 B9B3C431FAE\r
+       for <notmuch@notmuchmail.org>; Wed,  5 Dec 2012 04:12:02 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 0.201\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=0.201 tagged_above=-999 required=5\r
+       tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,\r
+       FREEMAIL_ENVFROM_END_DIGIT=1, FREEMAIL_FROM=0.001,\r
+       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 6VOGGDGMRfmN for <notmuch@notmuchmail.org>;\r
+       Wed,  5 Dec 2012 04:12:02 -0800 (PST)\r
+Received: from mail-wi0-f169.google.com (mail-wi0-f169.google.com\r
+       [209.85.212.169]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
+       (No client certificate requested)\r
+       by olra.theworths.org (Postfix) with ESMTPS id 2621C431FB6\r
+       for <notmuch@notmuchmail.org>; Wed,  5 Dec 2012 04:12:02 -0800 (PST)\r
+Received: by mail-wi0-f169.google.com with SMTP id hq12so1676972wib.2\r
+       for <notmuch@notmuchmail.org>; Wed, 05 Dec 2012 04:11:59 -0800 (PST)\r
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;\r
+       h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references;\r
+       bh=bPjU01hRxu1BibQhnq0W8aPcUJGF0uVKeUCLCXaJ3Ys=;\r
+       b=bzKPCzHOidI2YQ+Yzvp0AY5gxmH6P7q73fkUZQe38copqLEwsqOGAICPlMKBLcLvT9\r
+       ZwBKho38125HpPgJxoi6MvEPD7ji5Zeb9CzTWShSOJ13whCF4bnOVZ/KFwluEdihobI8\r
+       5RaXEgD+bRWydBYB/PeihVpwmdE19QYG3wSunZuqnjZGbp+ZLhbk3IOBIZEfkOCd4hD5\r
+       4k+uPD44s8p9eKe0J+ZsPYR0rubESa5QKaYHujjBDiYjhI0svXojU/XFSqUMnP5r0XAY\r
+       aREKQ2R8Pj3I2twQGzj/zSM1osaYSh4ZvTQHOGTNyXR4Ib/ADwqFJnOPORtd3FMpD8WI\r
+       DDzA==\r
+Received: by 10.180.81.170 with SMTP id b10mr2803549wiy.16.1354709519504;\r
+       Wed, 05 Dec 2012 04:11:59 -0800 (PST)\r
+Received: from localhost (93-97-24-31.zone5.bethere.co.uk. [93.97.24.31])\r
+       by mx.google.com with ESMTPS id y3sm18821305wix.6.2012.12.05.04.11.57\r
+       (version=TLSv1/SSLv3 cipher=OTHER);\r
+       Wed, 05 Dec 2012 04:11:58 -0800 (PST)\r
+From: Mark Walters <markwalters1009@gmail.com>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH v2] emacs: show: refresh buffer did not remove overlays\r
+Date: Wed,  5 Dec 2012 12:11:49 +0000\r
+Message-Id: <1354709509-22123-1-git-send-email-markwalters1009@gmail.com>\r
+X-Mailer: git-send-email 1.7.9.1\r
+In-Reply-To: <20121203164730.GE1020@mit.edu>\r
+References: <20121203164730.GE1020@mit.edu>\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: Wed, 05 Dec 2012 12:12:02 -0000\r
+\r
+Previously refreshing the notmuch show buffer did not remove overlays\r
+which meant that if the user refreshed a message with images the\r
+images would remain and then the new text was added after.\r
+\r
+One might have guessed that erase-buffer would have removed them but\r
+it seems not.  Thus force the removal of overlays with remove-overlays.\r
+---\r
+\r
+This version fixes the problems that Austin mentioned in his review. I\r
+have not investigated whether the erase-buffer here can be removed: it\r
+looks like it could be but the worst that this does is call\r
+erase-buffer twice (slightly wasteful but no harm).\r
+\r
+Best wishes\r
+\r
+Mark\r
+\r
+\r
+ emacs/notmuch-show.el |    4 ++++\r
+ 1 files changed, 4 insertions(+), 0 deletions(-)\r
+\r
+diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el\r
+index 4d6c014..20f8997 100644\r
+--- a/emacs/notmuch-show.el\r
++++ b/emacs/notmuch-show.el\r
+@@ -1185,6 +1185,10 @@ reset based on the original query."\r
+   (let ((inhibit-read-only t)\r
+       (state (unless reset-state\r
+                (notmuch-show-capture-state))))\r
++    ;; erase-buffer does not seem to remove overlays, which can lead\r
++    ;; to weird effects such as remaining images, so remove them\r
++    ;; manually.\r
++    (remove-overlays)\r
+     (erase-buffer)\r
+     (notmuch-show-build-buffer)\r
+     (if state\r
+-- \r
+1.7.9.1\r
+\r