summaryrefslogtreecommitdiff
path: root/.fmail
diff options
context:
space:
mode:
authorSean Whitton <spwhitton@spwhitton.name>2017-06-11 12:53:21 +0100
committerSean Whitton <spwhitton@spwhitton.name>2017-06-11 12:53:31 +0100
commit783d03af6a88b12ac3c1831aba6550e3b4687c03 (patch)
tree4703f4c0ad9ad30162ea8a85dc01747ea1a5a3f5 /.fmail
parent1ca6332c3c5cf18129ee8fbb11e8ff526d9b1f68 (diff)
downloaddotfiles-783d03af6a88b12ac3c1831aba6550e3b4687c03.tar.gz
expand notmuch post-new processing
Diffstat (limited to '.fmail')
-rwxr-xr-x.fmail/.notmuch/hooks/post-new20
1 files changed, 19 insertions, 1 deletions
diff --git a/.fmail/.notmuch/hooks/post-new b/.fmail/.notmuch/hooks/post-new
index 6cef2f96..3f239be4 100755
--- a/.fmail/.notmuch/hooks/post-new
+++ b/.fmail/.notmuch/hooks/post-new
@@ -1,12 +1,21 @@
#!/bin/sh
+# The primary purpose of this script is to maintain the 'draft',
+# 'spam' and 'unread' tags such that the only data in the notmuch
+# database that cannot be reproduced from the Maildir is which threads
+# have been killed, which is not important information. Then there is
+# no need to sync the notmuch database between machines. Syncing the
+# maildir with mbsync(1) is sufficient.
+
+# Note that another aspect of this setup is not using an 'inbox' tag.
+
# mark all sent mail as read
notmuch tag -unread -- folder:sent
# ensure all drafts are in the drafts folder
floating_drafts=$(notmuch search --output=files -- tag:draft and not folder:drafts)
if [ ! -z "$floating_drafts" ]; then
- mv $floating_drafts $HOME/.fmail/drafts/cur
+ mdmv $floating_drafts $HOME/.fmail/drafts
fi
# mark all drafts as drafts, and as read
@@ -17,3 +26,12 @@ killed_threads=$(notmuch search --output=threads tag:killed)
if [ ! -z "$killed_threads" ]; then
notmuch tag -unread -- $killed_threads
fi
+
+# ensure all spam is in the spam folder to train FastMail's spam filter
+floating_spam=$(notmuch search --output=files -- tag:spam and not folder:spam)
+if [ ! -z "$floating_spam" ]; then
+ mdmv $floating_spam $HOME/.fmail/spam
+fi
+
+# mark all spam as spam
+notmuch tag +spam -- folder:spam