diff options
-rw-r--r-- | email.org | 104 |
1 files changed, 0 insertions, 104 deletions
@@ -639,107 +639,3 @@ :link link :description description))))))) #+end_src -* notmuch tagging scripts -*** tag shell script - #+begin_src bash :tangle ./bin/notmuch-tags.sh - notmuch new > $HOME/var/log/notmuch.log 2>&1 - - function tag_folder { - notmuch tag +$1 +$2 -- tag:new AND folder:$1/$2 - } - - function tag_directory { - for f in ~/var/mail/$1/*; do - tag_folder $1 $(basename $f); - done - } - - function tag_list () { - notmuch tag "+$1" $3 -- tag:new AND List:${2:-$1} - } - - tag_directory bigml - tag_directory jao - tag_directory feeds - - notmuch tag -new -unread -- tag:spam - - nbml="tag:new AND tag:bigml AND" - - notmuch tag +bug -lists -drivel \ - -- "$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/ - - for l in clojure elixir geiser notmuch haskell erlang emacs-devel emacs-diffs emacs; do - tag_list $l - done - - for l in chicken guile gambit scheme chez; do - tag_list scheme $l - done - - tag_list emacs-bugs bug-gnu-emacs -lists - tag_list mailutils bug-mailutils -lists - tag_list feeds Lobsters +programming -lists - #+end_src -*** move shell script - #+begin_src bash :tangle ./bin/notmuch-move.sh - # 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 :tangle ./bin/notmuch-expire.sh - spared_tags="tag:\"/^(trove|new|flagged|unread|draft|gmane)$/\"" - - function tag_deleted { - notmuch tag +deleted -- "$1 AND date:..${2:-3d} AND NOT $spared_tags" - } - - tag_deleted "tag:bigml and tag:\"/^(drivel|lists|deploys|bugs)$/\"" 3d - tag_deleted "tag:bigml and tag:reports" 1d - 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|trash)$/\" and folder:\"/(spam|trash)$/\"" 3d - - notmuch new > $HOME/var/log/notmuch-expire.log 2>&1 - notmuch compact >> $HOME/var/log/notmuch-expire.log 2>&1 - #+end_src -*** delete shell script - #+begin_src bash :tangle ./bin/notmuch-delete.sh - notmuch search --output=files --format=text0 tag:deleted | xargs -r0 rm - - notmuch new > $HOME/var/log/notmuch-delete.log 2>&1 - notmuch compact >> $HOME/var/log/notmuch-delete.log 2>&1 - #+end_src -*** cron fetcher - #+begin_src bash :tangle ./bin/mail.sh - minute=$(date +%_M) - hour=$(date +%k) - - mbs=/usr/local/bin/mbsync - $mbs jao > $HOME/var/log/mbsync.jao.log - $mbs bml > $HOME/var/log/mbsync.bml.log - - $HOME/bin/notmuch-tags.sh - $HOME/bin/notmuch-move.sh - - [[ $minute -gt 5 ]] || $HOME/bin/notmuch-expire.sh - [[ $(($hour % 12)) -eq 0 && $minute -lt 5 ]] && $HOME/bin/notmuch-delete.sh - - XDG_RUNTIME_DIR='/run/user/1000' \ - /usr/local/bin/emacsclient -e '(jao-notmuch-notify)' > /dev/null - #+end_src |