From: Ben Gamari <bgamari.foss@gmail.com>
To: Jesse Rosenthal <jrosenthal@jhu.edu>, notmuch <notmuch@notmuchmail.org>
Subject: Re: My mail configuration
Date: Fri, 18 Mar 2011 08:32:36 -0400 [thread overview]
Message-ID: <87zkos623f.fsf@gmail.com> (raw)
In-Reply-To: <877hbwevf4.fsf@lucky.home>
On Fri, 18 Mar 2011 03:31:59 -0400, Jesse Rosenthal <jrosenthal@jhu.edu> 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
next prev parent reply other threads:[~2011-03-18 12:32 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-02-23 14:22 My mail configuration Ben Gamari
2011-03-06 21:34 ` Michal Sojka
2011-03-11 14:55 ` Ben Gamari
2011-03-18 7:31 ` Jesse Rosenthal
2011-03-18 12:32 ` Ben Gamari [this message]
2011-05-20 22:39 ` eric casteleijn
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://notmuchmail.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87zkos623f.fsf@gmail.com \
--to=bgamari.foss@gmail.com \
--cc=jrosenthal@jhu.edu \
--cc=notmuch@notmuchmail.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://yhetil.org/notmuch.git/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).