aboutsummaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorÓscar Nájera <hi@oscarnajera.com>2022-10-11 05:12:31 +0200
committerÓscar Nájera <hi@oscarnajera.com>2022-10-11 05:12:31 +0200
commite130c7984df9991e3158db02a5a54255e60c17bd (patch)
tree91731b72e895d6f5b384a7c46aca4209b34c514c /bin
parent406d8ddbceb2d0e33cebccf709b5b13ab2065f58 (diff)
downloaddotfiles-e130c7984df9991e3158db02a5a54255e60c17bd.tar.gz
dotfiles-e130c7984df9991e3158db02a5a54255e60c17bd.tar.bz2
dotfiles-e130c7984df9991e3158db02a5a54255e60c17bd.zip
Tagmail colorize in emacs reader not terminal output
Diffstat (limited to 'bin')
-rwxr-xr-xbin/tagmail28
1 files changed, 12 insertions, 16 deletions
diff --git a/bin/tagmail b/bin/tagmail
index 409aff1..687f0d3 100755
--- a/bin/tagmail
+++ b/bin/tagmail
@@ -27,8 +27,7 @@ LD_LIBRARY_PATH=$HOME/.guix-profile/lib exec guile -e main -s "$0" "$@"
(utils)
(srfi srfi-1)
(system ffi-help-rt)
- (system foreign)
- (term ansi-color))
+ (system foreign))
(define (on-all-messages-filenames query proc)
(nm-iter messages (nm-result-messages query)
@@ -40,16 +39,14 @@ LD_LIBRARY_PATH=$HOME/.guix-profile/lib exec guile -e main -s "$0" "$@"
(define (delete-email-files! options)
(define (logged-delete file-path)
(let ((do? (not (option-ref options 'dry-run #f))))
- (simple-format #t " [~a] ~a~%"
- (colorize-string "rm" 'BOLD (if do? 'RED 'NONE))
- file-path)
+ (simple-format #t " [rm] ~a~%" file-path)
(if do? (delete-file file-path))))
(with-nm-database
(ffi-db (assq-ref options 'mail-repo) 0)
(with-nm-query
(ffi-db to-delete "tag:deleted")
(display (string-append
- (colorize-string "[DELETE] " 'BOLD 'YELLOW)
+ "[DELETE] "
(number->string (nm-count-messages to-delete))
" files marked\n"))
(on-all-messages-filenames to-delete logged-delete))))
@@ -60,8 +57,7 @@ LD_LIBRARY_PATH=$HOME/.guix-profile/lib exec guile -e main -s "$0" "$@"
(let* ((target-file (new-path (rename-higher file uidvalidity) target-folder))
(sub-len (string-prefix-length file target-file))
(do? (not (option-ref options 'dry-run #f))))
- (simple-format #t " [~a] ~a -> ~a~%"
- (colorize-string "mv" 'BOLD (if do? 'RED 'NONE))
+ (simple-format #t " [mv] ~a -> ~a~%"
(substring file sub-len)
(substring target-file sub-len))
(when do? (rename-file file target-file)))))
@@ -74,10 +70,10 @@ LD_LIBRARY_PATH=$HOME/.guix-profile/lib exec guile -e main -s "$0" "$@"
(with-nm-query
(ffi-db to-move (format #f "~a and folder:~a/~a" query account start-dir))
(display (string-append
- (colorize-string "[MOVE] " 'BOLD 'YELLOW)
+ "[MOVE] "
(number->string (nm-count-messages to-move))
" messages marked in "
- (colorize-string account 'GREEN 'BOLD)
+ account
"\n"))
(on-all-messages-filenames to-move (move-file uidvalidity target-folder))))))
@@ -108,7 +104,7 @@ LD_LIBRARY_PATH=$HOME/.guix-profile/lib exec guile -e main -s "$0" "$@"
(nm-iter messages (nm-result-messages query) (apply-tags-to-message options tags))))))
(define (list-tag options ffi-db new)
- (display (colorize-string "[LISTS filters]\n" 'BOLD 'YELLOW))
+ (display "[LISTS filters]\n")
(let ((query-str (query-with-new '("+lists" "not tag:lists") new))
(tags-str (tags-with-new '("+lists" "not tag:lists") new))
(reg (make-regexp "<([a-z0-9=_-]+)\\." regexp/icase)))
@@ -146,7 +142,7 @@ LD_LIBRARY_PATH=$HOME/.guix-profile/lib exec guile -e main -s "$0" "$@"
(call-with-pipe
"bogofilter -bTv"
(lambda (push result)
- (display (colorize-string "[SPAM Flag]\n" 'BOLD 'YELLOW))
+ (display "[SPAM Flag]\n")
(let ((spam? (spam-channel push result)))
(with-nm-query
(ffi-db query query-str)
@@ -176,7 +172,7 @@ LD_LIBRARY_PATH=$HOME/.guix-profile/lib exec guile -e main -s "$0" "$@"
("+calls" "folder:hi_pers/Calls")))
(define (clear-inbox options ffi-db)
- (display (colorize-string "[Inbox]\n" 'BOLD 'YELLOW))
+ (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)))
(map (notmuch-tag options ffi-db #t)
@@ -205,15 +201,15 @@ LD_LIBRARY_PATH=$HOME/.guix-profile/lib exec guile -e main -s "$0" "$@"
(unless (option-ref options 'dry-run #f)
- (display (colorize-string "[SYNC]\n" 'BOLD 'YELLOW))
+ (display "[SYNC]\n")
(system (string-append "mbsync " (if (null? account) " -a" (car account))))
- (display (colorize-string "[notmuch new]\n" 'BOLD 'YELLOW))
+ (display "[notmuch new]\n")
(system "notmuch new"))
(with-nm-database
(ffi-db (assq-ref options 'mail-repo) 1)
(let ((new (not (option-ref options 'all #f))))
- (display (colorize-string "[TAG rules]\n" 'BOLD 'YELLOW))
+ (display "[TAG rules]\n")
(map (notmuch-tag options ffi-db new) tag-rules)
(list-tag options ffi-db new)
(clear-inbox options ffi-db)