From 6ed472ea5d5478429bb2d28090c1168466e31ca3 Mon Sep 17 00:00:00 2001 From: Mark Walters Date: Wed, 5 Dec 2012 12:11:49 +0000 Subject: [PATCH] [PATCH v2] emacs: show: refresh buffer did not remove overlays --- 9a/406eb64999dc51b475092063e18e30185f6501 | 101 ++++++++++++++++++++++ 1 file changed, 101 insertions(+) create mode 100644 9a/406eb64999dc51b475092063e18e30185f6501 diff --git a/9a/406eb64999dc51b475092063e18e30185f6501 b/9a/406eb64999dc51b475092063e18e30185f6501 new file mode 100644 index 000000000..7ee7aca1b --- /dev/null +++ b/9a/406eb64999dc51b475092063e18e30185f6501 @@ -0,0 +1,101 @@ +Return-Path: +X-Original-To: notmuch@notmuchmail.org +Delivered-To: notmuch@notmuchmail.org +Received: from localhost (localhost [127.0.0.1]) + by olra.theworths.org (Postfix) with ESMTP id B9B3C431FAE + for ; Wed, 5 Dec 2012 04:12:02 -0800 (PST) +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 6VOGGDGMRfmN for ; + Wed, 5 Dec 2012 04:12:02 -0800 (PST) +Received: from mail-wi0-f169.google.com (mail-wi0-f169.google.com + [209.85.212.169]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) + (No client certificate requested) + by olra.theworths.org (Postfix) with ESMTPS id 2621C431FB6 + for ; Wed, 5 Dec 2012 04:12:02 -0800 (PST) +Received: by mail-wi0-f169.google.com with SMTP id hq12so1676972wib.2 + for ; Wed, 05 Dec 2012 04:11:59 -0800 (PST) +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; + h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; + bh=bPjU01hRxu1BibQhnq0W8aPcUJGF0uVKeUCLCXaJ3Ys=; + b=bzKPCzHOidI2YQ+Yzvp0AY5gxmH6P7q73fkUZQe38copqLEwsqOGAICPlMKBLcLvT9 + ZwBKho38125HpPgJxoi6MvEPD7ji5Zeb9CzTWShSOJ13whCF4bnOVZ/KFwluEdihobI8 + 5RaXEgD+bRWydBYB/PeihVpwmdE19QYG3wSunZuqnjZGbp+ZLhbk3IOBIZEfkOCd4hD5 + 4k+uPD44s8p9eKe0J+ZsPYR0rubESa5QKaYHujjBDiYjhI0svXojU/XFSqUMnP5r0XAY + aREKQ2R8Pj3I2twQGzj/zSM1osaYSh4ZvTQHOGTNyXR4Ib/ADwqFJnOPORtd3FMpD8WI + DDzA== +Received: by 10.180.81.170 with SMTP id b10mr2803549wiy.16.1354709519504; + Wed, 05 Dec 2012 04:11:59 -0800 (PST) +Received: from localhost (93-97-24-31.zone5.bethere.co.uk. [93.97.24.31]) + by mx.google.com with ESMTPS id y3sm18821305wix.6.2012.12.05.04.11.57 + (version=TLSv1/SSLv3 cipher=OTHER); + Wed, 05 Dec 2012 04:11:58 -0800 (PST) +From: Mark Walters +To: notmuch@notmuchmail.org +Subject: [PATCH v2] emacs: show: refresh buffer did not remove overlays +Date: Wed, 5 Dec 2012 12:11:49 +0000 +Message-Id: <1354709509-22123-1-git-send-email-markwalters1009@gmail.com> +X-Mailer: git-send-email 1.7.9.1 +In-Reply-To: <20121203164730.GE1020@mit.edu> +References: <20121203164730.GE1020@mit.edu> +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: Wed, 05 Dec 2012 12:12:02 -0000 + +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 + -- 2.26.2