Am Sa., 21. Sept. 2024 um 18:24 Uhr schrieb Panayotis Manganaris <panos.manganaris@gmail.com>: ... > notmuch search --output=messages 'tag:new' > /tmp/msgs > notmuch search --output=files 'tag:new' |\ > bogofilter -o0.7,0.7 -bt |\ > paste - /tmp/msgs |\ > awk '$1 ~ /S/ { print "-new +spam", "-", $3 }' |\ > notmuch tag --batch > ... > This script operates on the assumption that the order of results from notmuch queries are > always the same, which is fortunately true. It also operates under the assumption that you receive no duplicate messages with the same message-id (such as list copies, sent/reveived), or else `paste` will have a hard time matching lines. Note that you can loop over the msgs, treat them individually, and still collect input for `notmuch tag --batch`, which solves both the problem with duplicate messages and potential ordering instability while keeping batch efficiency. > Your instinct to use batch tagging and id: queries is correct. I collect my new message ids in > /tmp/msgs. These ids are unique, they are definitely unique enough to be used to tag individual > messages on a daily basis. I'm sorry, but either they're unique or not. What's unique enough? I'm pestering on this because part of the OP's problem is being clear about the notion of message, which is uniquely identified by a message id in the notmuch db. I tried to clear that up in my previous answer in this thread. > > It might be useful for the reasons I stated, namely in case the Message-ID does not exist or > > is not unique. > > I think mail that is successfully transmitted through a mail host necessarily obtains a message > id, but I might be wrong. I believe notmuch indexes on both it's own unique thread ids and the > message ids. Thereby further decreasing the already minuscule chance of message id collisions. No. Messages can arrive without mid. In that case, notmuch creates one (without altering the message file) and uses it for indexing. "Thread-id" is something completely different from message-ids. They do not identify a message uniquely (but a thread of messages "joint" by references), albeit indirectly (such as "root message of the thread", assuming one root). Cheers Michael _______________________________________________ notmuch mailing list -- notmuch@notmuchmail.org To unsubscribe send an email to notmuch-leave@notmuchmail.org