summaryrefslogtreecommitdiff
path: root/.fmail/.notmuch/hooks/post-new
blob: f5abcbe671421b8b2a4d94bd8062cae44af0bc3c (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
25
#!/bin/sh

. $HOME/.shenv

# mark all sent mail as read
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

# start a background process to expand-annex-mboxes; mail in these
# will be processed on the next `notmuch new` run
( nice ionice -c 3 expand-annex-mboxes >/dev/null 2>&1 || exit 0 ) &