[PATCH] notmuch new --new-tags=tags...
Michal Sojka
sojkam1 at fel.cvut.cz
Mon Apr 12 08:11:24 PDT 2010
On Mon, 12 Apr 2010, Jameson Rollins wrote:
> On Mon, 12 Apr 2010 10:00:37 +0200, "Sebastian Spaeth" <Sebastian at SSpaeth.de> wrote:
> > On 2010-04-10, Anthony Towns wrote:
> > > The attached patch makes "notmuch new --new-tags=unread,new" set the
> > > "unread" and "new" tags on any new mail it finds rather than "unread"
> > > and "inbox". Or whatever other tags you happen to specify.
> >
> > Thanks for the patch. I can't comment on the code quality, but rather
> > than having to specify the set of new tags on the command line every
> > time, I think it would make more sense to put them in the notmuch config
> > file as this patch does:
> > id:1268432006-24333-2-git-send-email-bgamari.foss at gmail.com
>
> I was thinking about this, and it seems to me that we really need is a
> way to just specify which tags should be applied to new messages based
> on search terms. It's becoming pretty clear that most people are doing
> some sort of post-notmuch-new tag processing to modify the tags of new
> messages to suite their needs. Why not just integrate this directly
> into the notmuch-new processing itself? It seems like if this was
> integrated into notmuch-new directly, the entire processing of new
> messages could be sped up considerably, so that one wouldn't have to
> call multiple notmuch-new processes in succession.
In my mailstore abstraction patches, I suppose that tags for new
messages are derived in some way from mailstore. The idea is, that once
we have a mail store which can store tags (e.g. git-based mails store),
the tags will be assigned on delivery by tools like procmail and notmuch
will only index that tags for faster searching. The problem is the it
will take some time to implement all of this and we want this
functionality now.
>
> I'm not sure exactly what the best way to handle it would be, but I can
> imagine something like this:
>
> [new-tags]
> +sent -new -- from:jrollins at finestructure.net
> +drafts -new -- folder:draft
> +notmuch -- from:notmuch at notmuchmail.org
> +unread +inbox -new -- tag:new
>
> These are all just commands for "notmuch tag" that would be run on all
> the new messages as they're processed. Each new message would be given
> "new" tag by default, and then the new tag commands would be run. So it
> would be the equivalent of running the following commands:
>
> notmuch new --new-tags=new
> notmuch tag +sent -new -- from:jrollins at finestructure.net
> notmuch tag +drafts -new -- folder:draft
> notmuch tag +notmuch -- from:notmuch at notmuchmail.org
> notmuch tag +unread +inbox -- tag:new
The problem I see with this approach is, that all notmuch searches are
build around Xapian. A simple implementation of the above would mean
that whenever you add a new message to the database, you would need to
execute a Xapian query to see if the new message matches your rule or
not. This would be, of course, very expensive.
If we do not want to use xapian for searching, we would have to
implement all the query parsing. building and whatever in notmuch and I
do not think it belongs there.
I do not know much about Xapian internals, so there might be a way of
doing this without reimplementing everything, so correct me if I'm
wrong.
-Michal
More information about the notmuch
mailing list