couple of naive questions about search patterns

Michal Sojka sojkam1 at fel.cvut.cz
Fri Jul 16 02:21:58 PDT 2010


On Wed, 07 Jul 2010, Dmitry Monakhov wrote:
> I want to tag new patches, but not replay messages.
> I've tried to do it like this:
> notmuch tag +patch-new "tag:inbox and subject:'patch' \
>                         and not subject:'re:'"
> but last rule (subject:'re:') seems to be ignored, as soon as i
> understand this happens because pattern 're:' is too short.
> Am i right? 

No, this is because 're:' in subject is not indexed. See
skip_re_in_subject() in index.cc.

> Are any other ways to accomplish this task? 

A possible way would be to use an external script to find the messages
you want to tag. Roughly something like

 notmuch tag +patch-new $(notmuch show tag:inbox and subject:'patch'|\
                          grep -o 'filename:[^ ]*'|\
                          while read fn; do fn=${fn#filename:};\
                            grep -q '^Subject: \[PATCH\]' $fn && grep -i ^Message-ID: $fn|\
                            sed -e 's/.*<\(.*\)>/id:\1/'; \
                          done)

There was also a discussion around
http://mid.gmane.org/87ochrdpjy.fsf@wsheee.2x.cz for adding some new
search operators to notmuch, but no patches were sent.

> BTW: Is it possible to specify beginning(^) or the end in subject
> search pattern?

I don't think so.

-Michal



More information about the notmuch mailing list