Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Notmuch sync script
#!/run/current-system/profile/bin/guile -s
(define (nm-tag terms)
(system* "notmuch" "tag" (car terms) "--" (cdr terms)))
(define %post-sync-terms '(("+inbox" . "path:/.*\\/INBOX/")
("+draft" . "path:/.*\\/Drafts/")
("+sent" . "path:/.*\\/Sent/")
("+trash" . "path:/.*\\/Trash/")
("+spam" . "path:/.*\\/Spam/")
("+todo -inbox -sent" . "tag:inbox and tag:sent")
;; Remove tags for moved messages
("-inbox" . "not path:/.*\\/INBOX/")
("-trash" . "not path:/.*\\/Trash/")
("-spam" . "not path:/.*\\/Spam/")
("+work" . "")
("+work" . "")))
(system* "mbsync" "-a")
(nm-tag '("-new" . "tag:new"))
(system* "notmuch" "new")
(map nm-tag %post-sync-terms)
;; TODO: Notify-send new mail count
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment