proposing "notmuch purge"
Daniel Kahn Gillmor
dkg at fifthhorseman.net
Mon Jan 13 14:28:38 PST 2020
This e-mail proposes a new notmuch subcommand "purge", which actually
removes explicitly deleted messages from the mailstore.
Notmuch currently never deletes mail, but notmuch-emacs makes it easy to
tag mail with "deleted" (via the "d") key, and "notmuch setup"
automatically adds "deleted" to the search.exclude_tags setting.
Users typically do actually want to delete messages, and they want them
gone from their filesystem and from the index.
while everyone who has used notmuch for a while probably has a clever
way of doing this, those techniques are all probably slightly different
(and possibly buggy), and the cognitive burden of figuring out how to do
this sensibly for new users seems like something we should avoid.
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)
If i was to implement this, i'd probably implement it directly in C, not
as a shell script, because this lets us drop messages from the db as we
unlink() the files.
Inevitably, someone will come up with some more clever
options/generalizations (i can already think of at least one), but if we
have a particular implementation to hang these proposals on, it should
help us to build something sensibly robust with a wider consensus, and
new users can pick up and use that functionality easily/safely/with
I note that this is a divergence from the historical expectation of
having all "notmuch" subcommands not directly tamper with the
mailstore. I think given the context that divergence is OK.
Any objections to this approach?
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 227 bytes
Desc: not available
More information about the notmuch