proposing "notmuch purge"

Teemu Likonen tlikonen at
Mon Jan 13 21:01:08 PST 2020

Daniel Kahn Gillmor [2020-01-13T17:28:38-05] wrote:

> So i'm proposing "notmuch purge", which could be something as simple as
> the equivalent of:
>    notmuch search --output=files --format=text0 tag:deleted | \
>       xargs --null --no-run-if-empty rm && \
>          notmuch new --no-hooks
> (credit for the pipeline above goes to anarcat, in Cc; i added the
> "notmuch new --no-hooks" part, because i would want the items gone from
> the db as well)

I agree with the proposal but I would like to add one important point to
the discussion and semantics. If the implementation goes through
"notmuch search" we should understand what search.exclude_tags does.

Let's say a user has this settings: "search.exclude_tags=deleted;spam".
Then "notmuch search tag:deleted" will not find messages which have both
of the excluded tags, "deleted" and "spam". We would need "notmuch
search --exclude=false tag:deleted" to really find all messages with
tag:deleted. So here's the search semantics I propose:

    notmuch search --exclude=false --output=files \
        --format=text0 SEARCH-TERMS

I think that the "SEARCH-TERMS" part should be configurable, not
hard-coded. A user could have setting like
"search.purge_tags=deleted;spam" and that would lead to search terms
"tag:deleted OR tag:spam" in the purge operation.

///  OpenPGP key: 4E1055DC84E9DFF613D78557719D69D324539450
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 694 bytes
Desc: not available
URL: <>

More information about the notmuch mailing list