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 DDBB5431FB6 for ; Fri, 18 Mar 2011 05:32:44 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -0.799 X-Spam-Level: X-Spam-Status: No, score=-0.799 tagged_above=-999 required=5 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.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 AKD9PI20L7AP for ; Fri, 18 Mar 2011 05:32:44 -0700 (PDT) Received: from mail-qy0-f174.google.com (mail-qy0-f174.google.com [209.85.216.174]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id E2925431FB5 for ; Fri, 18 Mar 2011 05:32:43 -0700 (PDT) Received: by qyk7 with SMTP id 7so757960qyk.5 for ; Fri, 18 Mar 2011 05:32:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:from:to:subject:in-reply-to:references :user-agent:date:message-id:mime-version:content-type; bh=r+3xKcpGeEcA+iUAwj8MApi2a1hLtxr/3x9LRbltOyc=; b=jXLzhP4biiQJ3J0fU//0JyXV4P1cGqkuGK/iK9wyFpUri6IRTRVWa29Wym2qhN9WZ8 jL0J+m6x6iX+3hQxtjzbvnUwubme6USRbPuJTQ+P/WJ5U/ki4mXxW8a5u256Ow0QYkEj 4mIUdHPQXrwYLIPah914i7XcevGhmwYn1/7rM= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:subject:in-reply-to:references:user-agent:date:message-id :mime-version:content-type; b=JAnwOq/iFN1kLe9iWgKmehLDm1s0jJgzLkyBov4RjH+q8Mcp56luggfaMbyWVFfjrh ujfEKdin4G1Nc1oMvYYPD3+QCFV4jN1imnPccEtSR9D1iBbfiKJMZ6fbJ0lTqHs7iorf p8w31r2uVb0SuXZa0yQG7OdlwYeQz+xr895/A= Received: by 10.224.18.129 with SMTP id w1mr802680qaa.382.1300451561805; Fri, 18 Mar 2011 05:32:41 -0700 (PDT) Received: from localhost (pool-96-240-215-129.spfdma.east.verizon.net [96.240.215.129]) by mx.google.com with ESMTPS id s32sm2195910qco.2.2011.03.18.05.32.39 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 18 Mar 2011 05:32:39 -0700 (PDT) From: Ben Gamari To: Jesse Rosenthal , notmuch Subject: Re: My mail configuration In-Reply-To: <877hbwevf4.fsf@lucky.home> References: <87tyfu3k5a.fsf@gmail.com> <877hbwevf4.fsf@lucky.home> User-Agent: Notmuch/0.5-64-gdd23272 (http://notmuchmail.org) Emacs/23.1.1 (x86_64-pc-linux-gnu) Date: Fri, 18 Mar 2011 08:32:36 -0400 Message-ID: <87zkos623f.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii 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: Fri, 18 Mar 2011 12:32:45 -0000 On Fri, 18 Mar 2011 03:31:59 -0400, Jesse Rosenthal wrote: > > # Freeze new messages > > q_new = notmuch.Query(db, 'tag:new') > > n_msgs = 0 > > for msg in q_new.search_messages(): > > msg.freeze() > > n_msgs += 1 > > It seems like every time you iterate over `q_new.search_messages()', you > run a new search on tag:new. So at the end, when you thaw the messages, > you're running that search again, from scratch: > Ouch, yes, you are absolutely right. Thankfully, as you noted, notmuch seems to be cleaning up after me when I exit. > > # Tag remaining new items for inbox > > tag_search(db, 'tag:new', '+inbox', '-new') > > > > # Thaw new messages > > for msg in q_new.search_messages(): > > msg.thaw() > > But there are no longer and "tag:new"s, so there shouldn't be any > results for `q_new.search_messages()', should there? It seems like > it's thawing 0 messages. Playing around with it, it doesn't seem to make > a difference, so perhaps thawing is unneccessary if you're exiting after > tagging. Or am I misunderstanding something? > > By the way, my understanding of the bindings is that you can avoid > running the new searches by dumping a Messages object into a list. So, > you can do something like: > > new_msg_obj = q_new.search_messages() > new_msg_list = [m for m in new_msg_obj] > > and then deal with the list from there on out. Not sure if that would > buy you much performance over running the query repeatedly, but it > couldn't hurt, and it would seem closer to the effect that you're aiming > at (since the members of the list would be set from the first query, and > therefore you'd be thawing the same elements you froze in the first > place). > This is true, although I'd be worried about memory usage when there are many new messages. I suppose this probably won't be a problem, however, and even in the worst case it would probably only be a few hundred MB. I'll consider this. Thanks for your note! Cheers, - Ben