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 124306DE0352 for ; Sat, 26 Aug 2017 10:15:57 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at cworth.org X-Spam-Flag: NO X-Spam-Score: 0.073 X-Spam-Level: X-Spam-Status: No, score=0.073 tagged_above=-999 required=5 tests=[AWL=-0.157, FREEMAIL_FORGED_FROMDOMAIN=0.249, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=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 OVXMo3fh8o5e for ; Sat, 26 Aug 2017 10:15:56 -0700 (PDT) Received: from mail-wm0-f41.google.com (mail-wm0-f41.google.com [74.125.82.41]) by arlo.cworth.org (Postfix) with ESMTPS id EB05E6DE0350 for ; Sat, 26 Aug 2017 10:15:55 -0700 (PDT) Received: by mail-wm0-f41.google.com with SMTP id z132so11869873wmg.1 for ; Sat, 26 Aug 2017 10:15:55 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=yfmaITPMVLWw+NvXFqQ5Ghn+PkSTOMwV9ABetMkmptk=; b=mpT12X8Viy1tQsW/2h0FYXEQFgvyDDpZgxEcSLWOe7vq3xDVJCZ64wokqgcj8+rHyl PbX5jqCFQroLPq+HnhF9EAacr3HBaPaVmcjCW8mZ8PpMvgpXK7LEP+DRWglXfUbpe1dp 0CQ2BUK67S/w+k5U/GI2/vDEKUF8luIw0FW58iKr/RV/Z3AtXjJN8oPEHS+iHaJVeAkM uX2f8k+qunONnTN3POO/kRfNpmBk3Wsobl/gKFgvPzkP+iyS0Ml4dKS9Yv3AHDfIR6z4 GyG+Eb7vyJ8Ff01TFkRJJ+cg7138YPzG4ZwgGwwkAwdQvmHdIUzWzu88sUwTabrQcKWD rexw== X-Gm-Message-State: AHYfb5iXewFE4MKem0lWHJx0yjHP4UcUMdvx1g1w/YAl3XctnCODl8zn /M0RvJnRGCZSdQ== X-Received: by 10.80.134.216 with SMTP id 24mr2004153edu.15.1503767754365; Sat, 26 Aug 2017 10:15:54 -0700 (PDT) Received: from home.thecybershadow.net (CyberShadow-1-pt.tunnel.tserv1.bud1.ipv6.he.net. [2001:470:1f1a:172::2]) by smtp.gmail.com with ESMTPSA id x35sm1507836eda.9.2017.08.26.10.15.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 26 Aug 2017 10:15:53 -0700 (PDT) Subject: Re: [PATCH v2] emacs: Add notmuch-update-search-tags To: Mark Walters , notmuch@notmuchmail.org Cc: Vladimir Panteleev References: <41a586b8-5059-7190-3ae6-ab6017795c28@gmail.com> <20170826015541.25937-1-notmuch@thecybershadow.net> <87a82mzkyg.fsf@qmul.ac.uk> From: Vladimir Panteleev Message-ID: Date: Sat, 26 Aug 2017 17:15:52 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 In-Reply-To: <87a82mzkyg.fsf@qmul.ac.uk> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.23 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: Sat, 26 Aug 2017 17:15:57 -0000 On 2017-08-26 10:23, Mark Walters wrote: > 1) Suppose a new message arrives in the thread. Then triggering a tag > change in the show buffer, (eg notmuch automatically removing an unread > tag) pulls that message into original search buffer. > > 2) If that new message has some tags that aren't in the thread they will > get marked as "added tags" Yes, AFAICT this is correct. > I think 3 is probably rare enough not to be real concern (though we > should make sure we don't actually give an error). But 1 and 2 seem > undesirable. If the thread is gone, then it won't be in the results of the tag query, therefore it simply won't be updated. > If we do that then I think the only change in these buffers is the tag > updates, and exactly as if you changed those tags in the search buffer > itself, the threads shown etc don't change. > > What do you think? I think it's doable in theory, just not efficiently. In order to fetch correct results for the messages currently displayed in the search buffer, we need to pass those exact message IDs to notmuch. If a tagging operation affects many messages from a large search buffer, doing one notmuch search invocation per thread can add up to a lot of notmuch invocations. It may be possible to optimize this down to one batch search query per notmuch-search buffer - however, this results in a large search query. Not only would one take a while to execute, but the resulting query can become too large to be passed as a command-line parameter, and "notmuch search" does not seem to have a --batch switch to read queries from standard input. Even if the above were to work sufficiently well, it is still necessary to do one notmuch invocation per search buffer, as individual search buffers may capture results from different points in time. In the patch above just one additional invocation in total is necessary. So, I don't see a way to do this in a sufficiently efficient way. Performance does matter here, as notmuch will perform tag updates in situations where a user shouldn't expect significant delays - e.g. holding down the "down arrow" key in a notmuch-show buffer with some unread messages will cause notmuch to remove the "unread" tag as point travels over each unread message. What do you think? -- Best regards, Vladimir