From b07dfdd2c5b67ee28cbe967ea5d2ebcb5081e35a Mon Sep 17 00:00:00 2001 From: jao Date: Sat, 12 Jun 2021 00:27:18 +0100 Subject: mail scripts --- email.org | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'email.org') diff --git a/email.org b/email.org index 8b86842..2f62ca6 100644 --- a/email.org +++ b/email.org @@ -251,7 +251,7 @@ #+begin_src emacs-lisp (defun jao-list-mailboxes (base) (let ((dir (expand-file-name base "~/var/mail"))) - (seq-difference (directory-files dir) '("." ".." "sent" "trash")))) + (seq-difference (directory-files dir) '("." ".." "sent" "trash" "spam")))) #+end_src * consult narrowing #+begin_src emacs-lisp @@ -812,9 +812,23 @@ tag_list mailutils bug-mailutils -lists tag_list feeds Lobsters +programming -lists #+end_src +*** move shell script + #+begin_src bash :shebang "#!/bin/bash" :tangle ./bin/notmuch-move.sh :tangle-mode (identity #o755) + # Move a message file while removing its UID-part + function safe_move { s=${1##*/}; s=${s%%,*}; mv -f $1 $2/$s; } + function move_spam { + for i in $(notmuch search --output=files \ + tag:spam and tag:$1 AND NOT folder:$1/spam); do + safe_move $i ~/var/mail/$1/spam/cur + done + } + + move_spam jao + move_spam bigml + notmuch new >/dev/null + #+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|gmane)$/\"" function tag_deleted { @@ -826,6 +840,7 @@ tag_deleted "tag:bigml AND tag:support" 7d tag_deleted "tag:jao and tag:\"/^(drivel|lists|books|think|local)$/\"" 3d tag_deleted "tag:feeds" 3d + tag_deleted "tag:spam and folder:/spam/" 3d notmuch new > $HOME/var/log/notmuch-expire.log 2>&1 notmuch compact >> $HOME/var/log/notmuch-expire.log 2>&1 -- cgit v1.2.3