[PATCH] emacs: show: refresh buffer did not remove overlays

Subject: [PATCH] emacs: show: refresh buffer did not remove overlays

Date: Mon, 3 Dec 2012 13:11:00 +0000

To: notmuch@notmuchmail.org

Cc:

From: Mark Walters


Previously refreshing the notmuch show buffer did not remove overlays
which meant that if the user refreshed a message with images the
images would remain and then the new text was added after.

One might have guessed that erase-buffer would have removed them but
it seems not.  Thus force the removal of overlays with remove-overlay.
---
The new toggle-parts code makes this bug much more likely to trigger
(as the user is quite likely to toggle a part in a message with an
image). However, it was already present if anyone tried refreshing a
show buffer with an image in it.

It would be good if someone could check whether there is anything else
that also needs to be manually removed. But, for me at least, this
seems to fix the problem.

Many thanks to Jani for finding the bug and helping with the diagnosis.

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 c8c1657..e89dba2 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -1214,6 +1214,9 @@ reset based on the original query."
 		   (setq notmuch-show-message-multipart/alternative-display-parts nil)
 		 (notmuch-show-capture-state))))
     (erase-buffer)
+    ;; erase-buffer does not seem to remove overlays so do it manually.
+    ;; This can lead to weird effects such as remaining images.
+    (remove-overlays)
     (notmuch-show-build-buffer)
     (if state
 	(notmuch-show-apply-state state)
-- 
1.7.9.1


Thread: