Dear Notmuch,

I am trying to figure out how to adapt a script I wrote for filtering messages, to apply 
notmuch tags to each message. A difficulty is that the messages are already in the 
Notmuch database, because another tool has delivered them to a maildir and run 
"notmuch new".

Now, Notmuch can provide me with the paths of all the new (unfiltered) 
messages, which I can give to my script. The question I have is, once the 
filter is done, how can the script tell Notmuch which message to apply the tags 
to?

I've tentatively concluded that the best way to locate each message in the Notmuch 
database is to extract the Message-ID and search for it with "id:"? But the FAQ 
says that multiple messages can have the same Message-ID (and some spam messages don't 
have one at all).

If I could access the message using the filename that the script is processing, it would 
seem slightly more reliable. It seems like there should be some way to allow a Notmuch 
database entry to be accessed directly by filename, without even creating a Notmuch-style 
search query containing that filename, but rather by passing the filename as a 
command-line argument to "notmuch". It would be nice not to have to worry about 
quoting and unquoting.

When I try to search for a message using "path:", nothing seems to work.

    $ notmuch show id:"enwiki.66eda276579298.42329...@en.wikipedia.org" | grep 
filename
    message{ id:enwiki.66eda276579298.42329...@en.wikipedia.org depth:0 match:1 
excluded:0 filename:/home/me/mail/notmuch//gmail-me/mail/cur/1921042a466e0b3b:2,
    $ notmuch search id:"enwiki.66eda276579298.42329...@en.wikipedia.org"
    thread:000000000003a7a9 33 mins. ago [1/1] Wikipedia; Wikipedia page SpaceX 
Raptor has been changed by Canterbury Tail (important inbox unread updates)
    $ notmuch search 
path:"/home/me/mail/notmuch//gmail-me/mail/cur/1921042a466e0b3b:2,"
    notmuch search: A Xapian exception occurred
    A Xapian exception occurred parsing query: unmatched regex delimiter in 
'/home/me/mail/notmuch//gmail-me/mail/cur/1921042a466e0b3b:2,'
    Query string was: 
path:/home/me/mail/notmuch//gmail-me/mail/cur/1921042a466e0b3b:2,
    [1]$ notmuch search 
path:"\/home\/me\/mail\/notmuch\/gmail-me\/mail\/cur\/1921042a466e0b3b:2,"
    $ notmuch search 
path:"\/home\/me\/mail\/notmuch\/\/gmail-me\/mail\/cur\/1921042a466e0b3b:2,"
    $ notmuch search path:"*1921042a466e0b3b*"
    $ notmuch search path:".*1921042a466e0b3b.*"
    $ notmuch search path:"/.*1921042a466e0b3b.*/"
    $ notmuch search path:"notmuch/gmail-me/mail/cur/1921042a466e0b3b:2,"
    $ notmuch search path:"notmuch//gmail-me/mail/cur/1921042a466e0b3b:2,"
    $ notmuch search path:"gmail-me/mail/cur/1921042a466e0b3b:2,"
    $ notmuch search path:"mail/cur/1921042a466e0b3b:2,"
    $ notmuch search path:"cur/1921042a466e0b3b:2,"
    $ notmuch search 
path:"/\/home\/me\/mail\/notmuch\/gmail-me\/mail\/cur\/1921042a466e0b3b:2,/"

There were no results for any of the "path:" searches, although the "id:" 
search worked. I am using version 0.32.2 and can update if this may be related to a bug that was 
fixed in the past few years.

I am not subscribed so please kindly Cc me if you have any ideas.

Thank you,

Frederick
_______________________________________________
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-le...@notmuchmail.org

Reply via email to