diff --git a/.config/notmuch/default/hooks/pre-sync.sh b/.config/notmuch/default/hooks/pre-sync.sh new file mode 100755 index 0000000..b78bb83 --- /dev/null +++ b/.config/notmuch/default/hooks/pre-sync.sh @@ -0,0 +1,27 @@ +#!/usr/bin/env sh + +# Archive files that are NOT tagged Inbox +accounts="david.julien@univ-nantes.fr" + +# Update paths & tags +notmuch new --no-hooks + +filter() { + notmuch search --output=files --format=text0 $parameters and tag:new| xargs -0 --no-run-if-empty mv -t "$XDG_DATA_HOME/mail/$account/$tag/new/" + notmuch search --output=files --format=text0 $parameters and not tag:new| xargs -0 --no-run-if-empty mv -t "$XDG_DATA_HOME/mail/$account/$tag/cur/" +} + +for account in $accounts +do + tags_location="$XDG_CONFIG_HOME/notmuch/tags/$account" + tags="$(grep "+" "$tags_location" | sed -e 's/^.//' -e 's/ .*//')" + for tag in $tags + do + [ "univ" = $tag ] && continue + parameters="folder:$account/INBOX and tag:$tag" + filter + done +done + +# Update paths +notmuch new --no-hooks diff --git a/.config/notmuch/tags/david.julien@univ-nantes.fr b/.config/notmuch/tags/david.julien@univ-nantes.fr new file mode 100644 index 0000000..3cb706f --- /dev/null +++ b/.config/notmuch/tags/david.julien@univ-nantes.fr @@ -0,0 +1,18 @@ +# vim: filetype=none + +# !filters will be applied top to bottom + +# mailbox ++univ -- to:david.julien@univ-nantes.fr or to:david.julien@ls2n.fr + ++teaching/X11I020 -- subject:x11i020 ++teaching/X11I040 -- subject:x11i040 + ++publications -- subject:[hal] ++forge -- from:gitlab@univ-nantes.fr + ++velo -- subject:[ls2n-velo] ++login -- from:login@univ-nantes.fr + ++admin -- from:virginie.dupont or from alexiane.brard or from emmanuelle.sale ++thesis -- from:benoit.delahaye or from:guillaume.cantin or from:gilles.ardourel