aboutsummaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorÓscar Nájera <hi@oscarnajera.com>2022-10-08 14:50:39 +0200
committerÓscar Nájera <hi@oscarnajera.com>2022-10-08 14:50:39 +0200
commit1324f71540659fa6c95f3ed7f0ee8f15748db136 (patch)
tree80566ce33355324874631cf0db364e6f34acea21 /bin
parent533486ef8869e062717df67e81dbce9b99214204 (diff)
downloaddotfiles-1324f71540659fa6c95f3ed7f0ee8f15748db136.tar.gz
dotfiles-1324f71540659fa6c95f3ed7f0ee8f15748db136.tar.bz2
dotfiles-1324f71540659fa6c95f3ed7f0ee8f15748db136.zip
separate logging of tagged mails
Diffstat (limited to 'bin')
-rwxr-xr-xbin/tagmail22
1 files changed, 14 insertions, 8 deletions
diff --git a/bin/tagmail b/bin/tagmail
index d846d73..409aff1 100755
--- a/bin/tagmail
+++ b/bin/tagmail
@@ -87,18 +87,24 @@ LD_LIBRARY_PATH=$HOME/.guix-profile/lib exec guile -e main -s "$0" "$@"
(unless (option-ref options 'dry-run #f)
(nm-apply-tags message tags)) #t))
+(define (log-msg-tag count rule new)
+ (let* ((query-str (query-with-new rule new))
+ (tags (tags-with-new rule new))
+ (info (if (null? (cddr rule)) query-str (caddr rule))))
+ (when (< 0 count)
+ (simple-format #t " ~a messages: ~a~a~%"
+ count
+ (if (string=? info query-str) ""
+ (string-append info " | "))
+ tags))))
+
(define (notmuch-tag options ffi-db new)
(lambda (rule)
- (let* ((query-str (query-with-new rule new))
- (tags (tags-with-new rule new))
- (info (if (null? (cddr rule)) query-str (caddr rule))))
+ (let ((query-str (query-with-new rule new))
+ (tags (tags-with-new rule new)))
(with-nm-query
(ffi-db query query-str)
- (simple-format #t " ~a messages: ~a~a~%"
- (nm-count-messages query)
- (if (string=? info query-str) ""
- (string-append info " | "))
- tags)
+ (log-msg-tag (nm-count-messages query) rule new)
(nm-iter messages (nm-result-messages query) (apply-tags-to-message options tags))))))
(define (list-tag options ffi-db new)