aboutsummaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
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)