From bc2a199ea92b1ba3fed47414c74540e49412b021 Mon Sep 17 00:00:00 2001
From: jao <jao@gnu.org>
Date: Mon, 7 Jun 2021 04:58:34 +0100
Subject: more notmuch tagging rules

---
 email.org | 31 ++++++++++++++++++++-----------
 1 file changed, 20 insertions(+), 11 deletions(-)

diff --git a/email.org b/email.org
index a2f5bd6..e2a07fb 100644
--- a/email.org
+++ b/email.org
@@ -489,9 +489,10 @@
           (let ((p) (cnt))
             (while (setq p (text-property-search-forward
                             :notmuch-message-properties))
+              (unless cnt (setq cnt 0))
               (let ((tags (plist-get (prop-match-value p) :tags)))
                 (when (or (member "unread" tags) (member "new" tags))
-                  (setq cnt (1+ (or cnt 0))))))
+                  (setq cnt (1+ cnt)))))
             cnt)))
 
       (defun jao-notmuch-tree-update-buffer-name (&optional n)
@@ -722,26 +723,34 @@
       tag_directory jao
       tag_directory feeds
 
+      nbml="tag:new AND tag:bigml AND"
+
       notmuch tag +bug -lists -drivel \
-       -- "tag:new AND tag:bigml AND (List:bigmlcom/wintermute OR List:bigmlcom/universe)"
+       -- "$nbml (List:bigmlcom/wintermute OR List:bigmlcom/universe)"
+      notmuch tag +support -inbox -drivel -lists \
+       -- "$nbml (List:support OR List:education)"
       notmuch tag +gmane -- tag:new AND folder:/gmane/
 
     #+end_src
 *** expiry shell script
     #+begin_src bash :shebang "#!/bin/bash" :tangle ./bin/notmuch-expire.sh :tangle-mode (identity #o755)
+
+      spared_tags="tag:\"/^(trove|new|flagged|unread|draft)$/\""
+
       function tag_deleted {
-        notmuch tag +deleted -- \
-                "folder:\"/$1/\"" AND date:..${2:-3d} \
-                AND NOT "tag:\"/^(trove|new|flagged|unread|draft)$/\""
+        notmuch tag +deleted -- "$1 AND date:..${2:-3d} AND NOT $spared_tags"
+      }
+
+      function tag_deleted_foldr {
+        tag_deleted "folder:\"/$1/\"" $2
       }
 
-      tag_deleted "bigml.(drivel|lists|deploys|bugs)" 3d
-      tag_deleted "bigml.reports" 1d
-      tag_deleted "bigml.support$" 7d
-      tag_deleted "jao.(drivel|lists|books|think|local)" 3d
-      tag_deleted "feeds.+" 3d
+      tag_deleted_foldr "bigml.(drivel|lists|deploys|bugs)" 3d
+      tag_deleted_foldr "bigml.reports" 1d
+      tag_deleted_foldr "jao.(drivel|lists|books|think|local)" 3d
+      tag_deleted_foldr "feeds.+" 3d
 
-      notmuch tag +deleted +trash -new -unread -- "folder:trash and tag:new"
+      tag_deleted "tag:support AND tag:bigml" 7d
 
       notmuch new > $HOME/var/log/notmuch-expire.log 2>&1
       notmuch compact >> $HOME/var/log/notmuch-expire.log 2>&1
-- 
cgit v1.2.3