summaryrefslogtreecommitdiff
path: root/.fmail/.notmuch/hooks/post-new
blob: 564b1de71233b04344a3982cc08607ba7b3cd6d2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/bin/sh

. $HOME/.shenv

# mark all sent mail as read.  mark it as unread first to ensure that
# copies of the mail in other folders actually get their maildir Seen
# flag added
notmuch tag +unread -- folder:sent
notmuch tag -unread -- folder:sent

# mark all drafts as drafts, and as read
notmuch tag -unread +draft -- folder:drafts

# mark all spam as spam
notmuch tag +spam -- folder:spam

# mark all trash as trash
notmuch tag +deleted -- folder:trash

# propagate the 'killed' tag to all messages in the killed message's thread
killed_threads=$(notmuch search --output=threads tag:killed)
if [ ! -z "$killed_threads" ]; then
    notmuch tag -unread -- $killed_threads
fi