aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorÓscar Nájera <hi@oscarnajera.com>2022-11-12 13:46:50 +0100
committerÓscar Nájera <hi@oscarnajera.com>2022-11-12 13:47:06 +0100
commit3a39cdcdbee17eeb15d4bed19ded8e2046812e5c (patch)
tree66f13e31050309aeb3dc91457e32cead05f7e348
parent74f2ba2eba69c40ab8ff0132b51d48d1e7112d5e (diff)
downloaddotfiles-3a39cdcdbee17eeb15d4bed19ded8e2046812e5c.tar.gz
dotfiles-3a39cdcdbee17eeb15d4bed19ded8e2046812e5c.tar.bz2
dotfiles-3a39cdcdbee17eeb15d4bed19ded8e2046812e5c.zip
some mail cleanups
-rwxr-xr-xbin/tagmail16
1 files changed, 8 insertions, 8 deletions
diff --git a/bin/tagmail b/bin/tagmail
index febbdd5..af1c939 100755
--- a/bin/tagmail
+++ b/bin/tagmail
@@ -176,8 +176,8 @@ LD_LIBRARY_PATH=$HOME/.guix-profile/lib exec guile -e main -s "$0" "$@"
(define (clear-inbox options ffi-db)
(display "[Inbox]\n")
- (let* ((my-emails (list "hi@oscarnajera.com" "hello@oscarnajera.com" "najera.oscar@gmail.com"))
- (sent (format #f "(~{from:~a~^ OR ~}) AND NOT (~:*~{to:~a~^ OR ~})" my-emails)))
+ (let ((sent (format #f "(~{from:~a~^ OR ~}) AND NOT (~:*~{to:~a~^ OR ~})"
+ (assq-ref options 'my-emails))))
(map (notmuch-tag options ffi-db #t)
`(("+sent" ,sent "Emails I have sent")
("+inbox" "*" "Inbox for the rest")))))
@@ -187,19 +187,19 @@ LD_LIBRARY_PATH=$HOME/.guix-profile/lib exec guile -e main -s "$0" "$@"
(let* ((mail-repo (string-append
(passwd:dir (getpwuid (geteuid)))
"/.mail/" ))
+ (my-emails (list "hi@oscarnajera.com" "hello@oscarnajera.com" "najera.oscar@gmail.com"))
(option-spec '((version (single-char #\V) (value #f))
(help (single-char #\h) (value #f))
(all (value #f))
(dry-run (single-char #\n) (value #f))))
- (options (cons (cons 'mail-repo mail-repo)
+ (options (append (list (cons 'mail-repo mail-repo)
+ (cons 'my-emails my-emails))
(getopt-long args option-spec)))
(account (assq-ref options '()) ))
(delete-email-files! options)
- (when (or (and (null? '())
- (access? (string-append mail-repo "hi_pers") W_OK))
- (and (string? account)
- (string=? account "hi_pers")))
+ (when (and (or (null? account) (and (string? account) (string=? account "hi_pers")))
+ (access? (string-append mail-repo "hi_pers") W_OK))
(move-mail! options "hi_pers" "tag:spam" "Inbox" "Junk"))
@@ -210,7 +210,7 @@ LD_LIBRARY_PATH=$HOME/.guix-profile/lib exec guile -e main -s "$0" "$@"
(system "notmuch new"))
(with-nm-database
- (ffi-db (assq-ref options 'mail-repo) 1)
+ (ffi-db mail-repo 'NOTMUCH_DATABASE_MODE_READ_WRITE)
(let ((new (not (option-ref options 'all #f))))
(display "[TAG rules]\n")
(map (notmuch-tag options ffi-db new) tag-rules)