From: Austin Clements Date: Mon, 3 Dec 2012 16:47:30 +0000 (+1900) Subject: Re: [PATCH] emacs: show: refresh buffer did not remove overlays X-Git-Url: http://git.tremily.us/gitweb.cgi?a=commitdiff_plain;h=c7b8392c9e6f74c4328302727aa17e07e446b3a0;p=notmuch-archives.git Re: [PATCH] emacs: show: refresh buffer did not remove overlays --- diff --git a/47/37a6cf36ec432947b52bc78cd502a23298fb10 b/47/37a6cf36ec432947b52bc78cd502a23298fb10 new file mode 100644 index 000000000..204c9cb9b --- /dev/null +++ b/47/37a6cf36ec432947b52bc78cd502a23298fb10 @@ -0,0 +1,146 @@ +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 293B0431FBC + for ; Mon, 3 Dec 2012 08:47:37 -0800 (PST) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: -0.7 +X-Spam-Level: +X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5 + tests=[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 MVHHrjhI-qm8 for ; + Mon, 3 Dec 2012 08:47:36 -0800 (PST) +Received: from dmz-mailsec-scanner-6.mit.edu (DMZ-MAILSEC-SCANNER-6.MIT.EDU + [18.7.68.35]) + by olra.theworths.org (Postfix) with ESMTP id 8E324431FB6 + for ; Mon, 3 Dec 2012 08:47:36 -0800 (PST) +X-AuditID: 12074423-b7fcb6d000000927-25-50bcd7a791a2 +Received: from mailhub-auth-1.mit.edu ( [18.9.21.35]) + by dmz-mailsec-scanner-6.mit.edu (Symantec Messaging Gateway) with SMTP + id 54.94.02343.7A7DCB05; Mon, 3 Dec 2012 11:47:35 -0500 (EST) +Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103]) + by mailhub-auth-1.mit.edu (8.13.8/8.9.2) with ESMTP id qB3GlYiU029477; + Mon, 3 Dec 2012 11:47:35 -0500 +Received: from awakening.csail.mit.edu (awakening.csail.mit.edu [18.26.4.91]) + (authenticated bits=0) + (User authenticated as amdragon@ATHENA.MIT.EDU) + by outgoing.mit.edu (8.13.6/8.12.4) with ESMTP id qB3GlVU3009563 + (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NOT); + Mon, 3 Dec 2012 11:47:33 -0500 (EST) +Received: from amthrax by awakening.csail.mit.edu with local (Exim 4.80) + (envelope-from ) + id 1TfZB4-0002U9-QR; Mon, 03 Dec 2012 11:47:30 -0500 +Date: Mon, 3 Dec 2012 11:47:30 -0500 +From: Austin Clements +To: Mark Walters +Subject: Re: [PATCH] emacs: show: refresh buffer did not remove overlays +Message-ID: <20121203164730.GE1020@mit.edu> +References: <1354540260-21814-1-git-send-email-markwalters1009@gmail.com> +MIME-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <1354540260-21814-1-git-send-email-markwalters1009@gmail.com> +User-Agent: Mutt/1.5.21 (2010-09-15) +X-Brightmail-Tracker: + H4sIAAAAAAAAA+NgFmpkleLIzCtJLcpLzFFi42IR4hRV1l1+fU+AwdRP/Bar5/JYXL85k9mB + yWPnrLvsHs9W3WIOYIrisklJzcksSy3St0vgyli9JbHgmXDFnJ1b2BoYb/N3MXJySAiYSDze + 0csOYYtJXLi3nq2LkYtDSGAfo8SPWc+ZIZz1jBLTG6azglQJCVxgkmju04dILGGU6Fswnxkk + wSKgIvHs4WGwUWwCGhLb9i9nBLFFBHQkbh9aABZnFpCW+Pa7mQnEFhbwkJh/pIUNxOYV0JZY + MncxE8QCT4nbW3exQMQFJU7OfMIC0aslcePfS6AaDrA5y/9xgIQ5BbwkHnasBVslCnTClJPb + 2CYwCs1C0j0LSfcshO4FjMyrGGVTcqt0cxMzc4pTk3WLkxPz8lKLdM30cjNL9FJTSjcxgkKa + 3UV5B+Ofg0qHGAU4GJV4eB982R0gxJpYVlyZe4hRkoNJSZT3+Zk9AUJ8SfkplRmJxRnxRaU5 + qcWHGCU4mJVEeHduBMrxpiRWVqUW5cOkpDlYlMR5r6Xc9BcSSE8sSc1OTS1ILYLJynBwKEnw + tl4DahQsSk1PrUjLzClBSDNxcIIM5wEa/uQqyPDigsTc4sx0iPwpRkUpcd6DIAkBkERGaR5c + LyzlvGIUB3pFmPcYSBUPMF3Bdb8CGswENPiF0G6QwSWJCCmpBkbuG2bnVsyYvKFr3+Hdp3I2 + z69evr6gcCn7hOspLXnbPqpbaHolBqs1h7x/HNYoeqyqWXfihJfHGuc3NJdfDWd6xyj+0Xra + udjNh58/m+VgfTsm6V/3y1/Pb2/byRT/JbCeI1ZQUsBS8KuV8z1nG5d5f36ciSstf61mev3Q + ncZ38/e5POlZYhWtxFKckWioxVxUnAgACfehuBQDAAA= +Cc: notmuch@notmuchmail.org +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: Mon, 03 Dec 2012 16:47:37 -0000 + +Quoth Mark Walters on Dec 03 at 1:11 pm: +> 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. + +>From the source for erase-buffer it's clear that it is not intended to +delete non-evaporating overlays (and overlays are non-evaporating by +default). + +AFAIK, the only other things that stick around are buffer-local +variables (which we clear in notmuch-show-refresh-view -> +notmuch-show-build-buffer -> notmuch-show-mode) and markers. + +> 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) + +This isn't exactly related to your patch, but it looks like +notmuch-show-build-buffer also calls erase-buffer, so I wonder if this +is redundant. + +> + ;; erase-buffer does not seem to remove overlays so do it manually. +> + ;; This can lead to weird effects such as remaining images. + +I parse this as "Doing this manually can lead to weird effects...". +Maybe + +erase-buffer does not seem to remove overlays, which can lead to weird +effects such as remaining images, so remove them manually. + +? + +> + (remove-overlays) + +For performance, it's probably slightly better to do this before the +erase-buffer so that erase-buffer doesn't have to shift around the +overlays. + +> (notmuch-show-build-buffer) +> (if state +> (notmuch-show-apply-state state)