Created
June 21, 2022 21:05
-
-
Save trev-dev/efedd98c672ed65a0d5da5981e5dee5e to your computer and use it in GitHub Desktop.
Notmuch sync script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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