From 02c12827e4dc38579ee6a1d895fecca14fbfb37e Mon Sep 17 00:00:00 2001 From: jao Date: Mon, 19 Apr 2021 03:55:22 +0100 Subject: simpler and faster notmuch tagging scripts --- email.org | 48 ++++++++++++++++++++++-------------------------- 1 file changed, 22 insertions(+), 26 deletions(-) (limited to 'email.org') diff --git a/email.org b/email.org index 60900d2..757073c 100644 --- a/email.org +++ b/email.org @@ -383,41 +383,37 @@ #+begin_src bash :tangle ./bin/notmuch-tags.sh :tangle-mode (identity #o755) notmuch new > $HOME/var/log/notmuch.log 2>&1 - function tag_deleted { - notmuch tag -inbox +deleted -- folder:$1 AND date:..3d AND NOT tag:flagged + function tag_expired { + notmuch tag +expired -- \ + "'folder:\"$1\"'" \ + AND date:..${2:-3d} AND NOT "tag:/flagged|unread|new/" } - for f in drivel lists reports deploys; do - notmuch tag +bigml +$f -- tag:new AND folder:bigml/$f - tag_deleted bigm/$f - done; - - for f in inbox support; do - notmuch tag +bigml +$f -- tag:new AND folder:bigml/$f - done; - - for f in ~/var/mail/feeds/*; do - f=$(basename $f) - notmuch tag +feeds +$f -- tag:new AND folder:feeds/$f - done - tag_deleted "/feeds.+/" - - notmuch tag +jao -- tag:new AND folder:/jao.+/ + function tag_folder { + notmuch tag +$1 +$2 -- tag:new AND folder:$1/$2 + } - for f in drivel lists books think; do - notmuch tag +$f -- tag:new AND folder:jao/$f - tag_deleted jao/$f - done + function tag_directory { + for f in ~/var/mail/$1/*; do + tag_folder $1 $(basename $f); + done + } - notmuch search --output=files --format=text0 tag:deleted | xargs -r0 rm + tag_directory bigml + tag_directory jao + tag_directory feeds - notmuch new >> $HOME/var/log/notmuch.log 2>&1 - notmuch compact >> $HOME/var/log/notmuch.log 2>&1 + tag_expired "/bigml.(drivel|lists|deploys|bugs)/" 3d + tag_expired "/bigml.reports/" 1d + tag_expired "/jao.(drivel|lists|books|think)/" 3d + tag_expired "/feeds.+/" 3d + tag_expired "/bigml.inbox$/" 1y #+end_src *** expire shell script #+begin_src bash :tangle ./bin/notmuch-expire.sh :tangle-mode (identity #o755) - notmuch search --output=files --format=text0 tag:deleted | xargs -r0 rm + notmuch search --output=files --format=text0 tag:expired | xargs -r0 rm notmuch new > $HOME/var/log/notmuch-expire.log 2>&1 + notmuch compact >> $HOME/var/log/notmuch-expire.log 2>&1 #+end_src * gnus *** notmuch -> gnus -- cgit v1.2.3