From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by arlo.cworth.org (Postfix) with ESMTP id 123136DE0927 for ; Sun, 25 Sep 2016 03:17:53 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at cworth.org X-Spam-Flag: NO X-Spam-Score: -0.014 X-Spam-Level: X-Spam-Status: No, score=-0.014 tagged_above=-999 required=5 tests=[AWL=-0.144, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_PASS=-0.001] autolearn=disabled Received: from arlo.cworth.org ([127.0.0.1]) by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id xB_-JpK0kF62 for ; Sun, 25 Sep 2016 03:17:52 -0700 (PDT) Received: from mail-wm0-f52.google.com (mail-wm0-f52.google.com [74.125.82.52]) by arlo.cworth.org (Postfix) with ESMTPS id 383FE6DE091C for ; Sun, 25 Sep 2016 03:17:52 -0700 (PDT) Received: by mail-wm0-f52.google.com with SMTP id w84so102863835wmg.1 for ; Sun, 25 Sep 2016 03:17:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:subject:in-reply-to:references:user-agent:date:message-id :mime-version; bh=I0jUx3o0Yo9RX1aQpM+rvqaOBopOVyuEWJazE6aH9p0=; b=0YNAfQQxszQLxyZzuyntZ2em2GvLiw/VgD3SKuB/xoyQGqY6DIXcnppU9MCUrNB2mS xpw7GYX/fgXLZghFcqSflhuvC9LydPn/iB2RQ0SwRoL9TzAiprwPptJmAZ5UYbOCbIpT /MakBR+lPAeR7rI+NyGR/iUAWZuE2rwdeagml5FCKEnTsKpjT7X0GazTMlL9wAcl8emb 5PmHqno48mFZGqu0WlCAnBTOlicnNUeFgvUCPNa9Yjr9WP1TsZvvnRtLO/hjjHkFznrY otYYz5ACnNdD/elGsMSN+0Y02InWSKiEqiIz5Bvwcw360unZIKM2PlzpjQB/Fcs4rqlM Ghiw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:subject:in-reply-to:references :user-agent:date:message-id:mime-version; bh=I0jUx3o0Yo9RX1aQpM+rvqaOBopOVyuEWJazE6aH9p0=; b=gHPiYUiFdCz2od6sUrNQAd0b3oDLehvgNV46p8CKpbkueHcgHhMj4RNS6ZRZERUsoN 5L7q41t3WYAKvdcV3Xh5qzmJY4nZqK4PmJHN7VM9DGzTJRwH7O2uAO4YSEaCWNWACalI /4nF7oSMLNH3/jDwg5czr7XTxTPJvjA+AwSDhT8Vyz9ieKgkMqvA1hFItG1dsCEaQQUT dxinExNv8iu4d0Lnv7YJmuUWZ2h1NHUMC5imvABp7AjSu8H/Y5+y5LL5YGo4epEEWZty EZeZaphZhsWARCEWqPFD8hMgqAIm7fASdY/WIjH1nd4bf2opmVLn97P149hanZuVBFNH qHYg== X-Gm-Message-State: AA6/9RlaGTn+o6SVBBX7MHiHE9MdDwj7luMjUDXGW2SSa4+JUYJe09c3P/OSQfPufV2OFw== X-Received: by 10.194.84.67 with SMTP id w3mr13319602wjy.148.1474798670696; Sun, 25 Sep 2016 03:17:50 -0700 (PDT) Received: from localhost (5751dfa2.skybroadband.com. [87.81.223.162]) by smtp.gmail.com with ESMTPSA id c134sm5276552wme.5.2016.09.25.03.17.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 25 Sep 2016 03:17:50 -0700 (PDT) From: Mark Walters To: Ioan-Adrian Ratiu , notmuch@notmuchmail.org Subject: Re: [PATCH v2 1/4] emacs: reuse buffer when refreshing searches In-Reply-To: <20160924200735.25425-2-adi@adirat.com> References: <20160924200735.25425-1-adi@adirat.com> <20160924200735.25425-2-adi@adirat.com> User-Agent: Notmuch/0.18.1+485~gca076ce (https://notmuchmail.org) Emacs/24.4.1 (x86_64-pc-linux-gnu) Date: Sun, 25 Sep 2016 11:17:49 +0100 Message-ID: <87zimwuvua.fsf@qmul.ac.uk> MIME-Version: 1.0 Content-Type: text/plain X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.22 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: Sun, 25 Sep 2016 10:17:53 -0000 On Sat, 24 Sep 2016, Ioan-Adrian Ratiu wrote: > There's no reason to completely kill a buffer while refreshing its > search results because the buffer name is constant between refreshes > (based on the search query), only its contents may change and notmuch > search kills all local variables, so it's safe to reuse. > > Reusing the same buffer also makes it possible to do things like > refreshing a buffer which is not focused or even not shown in any > window - this will be used in the next patches to add auto-refresh > capabilities to all existing notmuch buffers + a function to call > after syncing mail to refresh everything. > > Signed-off-by: Ioan-Adrian Ratiu > --- > emacs/notmuch.el | 7 ++++--- > 1 file changed, 4 insertions(+), 3 deletions(-) > > diff --git a/emacs/notmuch.el b/emacs/notmuch.el > index 8e14692..05687b7 100644 > --- a/emacs/notmuch.el > +++ b/emacs/notmuch.el > @@ -984,7 +984,7 @@ the configured default sort order." > (defun notmuch-search-refresh-view () > "Refresh the current view. > > -Kills the current buffer and runs a new search with the same > +Erases the current buffer and runs a new search with the same > query string as the current search. If the current thread is in > the new search results, then point will be placed on the same > thread. Otherwise, point will be moved to attempt to be in the > @@ -992,8 +992,9 @@ same relative position within the new buffer." > (let ((target-line (line-number-at-pos)) > (oldest-first notmuch-search-oldest-first) > (target-thread (notmuch-search-find-thread-id 'bare)) > - (query notmuch-search-query-string)) > - (notmuch-bury-or-kill-this-buffer) > + (query notmuch-search-query-string) > + (inhibit-read-only t)) > + (erase-buffer) Hi Something I missed previously: I think erase-buffer does not remove overlays (see the comment in notmuch-show-refresh-view). Thus it is probably worth removing them manually. I don't think there will be any visual artefacts in this case, but I think emacs's speed is quadratic in the number of overlays. Anyway I suggest adding a (remove-overlays) before or after the erase-buffer. Best wishes Mark > (notmuch-search query oldest-first target-thread target-line) > (goto-char (point-min)))) > > -- > 2.10.0