Change duplicate priority?

Subject: Change duplicate priority?

Date: Thu, 28 Sep 2023 10:10:26 -0400



From: Jesse Rosenthal

Dear All,

My work email comes through an Outlook server, which scans some
attachments. The process seems to be to first post an email with an
"Advanced Threat Protection" message and a link to a preview of the
attachment. Then, after the scan is complete, to delete that message and
post a second message, with the same Message ID, and the actual

Depending on how long the scan takes, getmail might pull down both of
these emails. The second duplicate is available through the emacs change
index command, but the attachment is not available (since it tries to
pull the first attachment from the first version, which is just an html

I can usually solve this by deleting the first one by hand, something

    notmuch search --output=files id:<mid> | head -1 | xargs rm

This has a couple of problems, though. (1) It's relying on the Maildir file
name being a time stamp to get rid of the earlier file, and (2) it
doesn't actually reindex the file when I run notmuch new, just treating
it as a rename, so I still get the search results for the older deleted

I guess I could do a bindings-based script that gives me a bit more
confidence, dump the tags, delete the messages, reindex, and reapply the

But I wonder if there is some way to change the priority of duplicates
so that later versions overwrite earlier versions. Alternately, could
there be a way to specify which file name notmuch commands pull
attachments from? This would allow me to get the attachment that is only
on the second dup from the emacs interface.

The other (classical) approach, I guess, would be to put an mda in there
which only lets the second one through. But I'm trying to avoid
/dev/null-ing emails non-interactively if I possible can.


notmuch mailing list --
To unsubscribe send an email to