[notmuch] How to list archived mails

Carl Worth cworth at cworth.org
Wed Nov 18 15:38:01 PST 2009

On Wed, 18 Nov 2009 20:35:26 +0530, aneesh.kumar at linux.vnet.ibm.com (Aneesh Kumar K.V) wrote:
> Once i mark the mail as archived how do i search for them ?
> Right now with notmuch.el i am adding a tag "archive" when
> i am archiving the mail. I am just wondering is this the right
> way ?

You might expect to be able to find all archived messages with:

	notmuch search not tag:inbox

(And if I had written the query parser that would work fine.)

But oddly, that fails because in Xapian's query parser the NOT operator
is not a unary operator but is instead a binary operator of AND_NOT.

I think the lack of a unary not is a bug in Xapian. In the meantime,
what we could use here is some syntax for a query that is guaranteed to
match all messages. Anyone have any ideas?

Meanwhile, if it's not that you're trying to list all archived messages,
(which I think would be a rare thing to want), but instead you want all
archived messages matching <some-term> then you can simply do:

	notmuch search <some-term> and not tag:inbox

I hope that helps.

Happy hacking,


More information about the notmuch mailing list