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

. $HOME/.shenv

# Fix copies of my own mail returned to folder:inbox by mailing lists.  This
# is a workaround for a bug in notmuch; see <id:87ee1c7s7s.fsf@tethera.net>.
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

[ -r "$HOME/doc/notmuch-killfile" ] && perl \
    -we'length and system "notmuch", "tag", "-unread", "--", "($_)"
          for join ") or (", grep length, map s/^\s+|\s*(#.*)?$//gr, <>' \
    "$HOME/doc/notmuch-killfile"