Skip to content

Instantly share code, notes, and snippets.

Embed
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" . "to:trev@trevdev.ca")
("+work" . "to:trevor@voltagenewmedia.com")))
(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