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

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

Date: Wed, 05 Dec 2012 10:59:04 -0500

To: Mark Walters, notmuch@notmuchmail.org

Cc:

From: Austin Clements


LGTM.

On Wed, 05 Dec 2012, Mark Walters <markwalters1009@gmail.com> wrote:
> 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-overlays.
> ---
>
> This version fixes the problems that Austin mentioned in his review. I
> have not investigated whether the erase-buffer here can be removed: it
> looks like it could be but the worst that this does is call
> erase-buffer twice (slightly wasteful but no harm).
>
> Best wishes
>
> Mark
>
>
>  emacs/notmuch-show.el |    4 ++++
>  1 files changed, 4 insertions(+), 0 deletions(-)
>
> diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
> index 4d6c014..20f8997 100644
> --- a/emacs/notmuch-show.el
> +++ b/emacs/notmuch-show.el
> @@ -1185,6 +1185,10 @@ reset based on the original query."
>    (let ((inhibit-read-only t)
>  	(state (unless reset-state
>  		 (notmuch-show-capture-state))))
> +    ;; erase-buffer does not seem to remove overlays, which can lead
> +    ;; to weird effects such as remaining images, so remove them
> +    ;; manually.
> +    (remove-overlays)
>      (erase-buffer)
>      (notmuch-show-build-buffer)
>      (if state
> -- 
> 1.7.9.1
>
> _______________________________________________
> notmuch mailing list
> notmuch@notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch

Thread: