From 1d562af8927d932bc3329de3b06c94a966047238 Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Mon, 30 Jan 2023 17:33:06 -0600 Subject: Add a bunch of stuff Forgot I had to `git add -f' these! --- notmuch/default/hooks/post-insert | 14 ++++++++++++++ notmuch/default/hooks/post-new | 22 ++++++++++++++++++++++ notmuch/default/hooks/pre-new | 15 +++++++++++++++ 3 files changed, 51 insertions(+) create mode 100755 notmuch/default/hooks/post-insert create mode 100755 notmuch/default/hooks/post-new create mode 100755 notmuch/default/hooks/pre-new (limited to 'notmuch/default') diff --git a/notmuch/default/hooks/post-insert b/notmuch/default/hooks/post-insert new file mode 100755 index 0000000..b983dfc --- /dev/null +++ b/notmuch/default/hooks/post-insert @@ -0,0 +1,14 @@ +#!/usr/bin/env bash +# Notmuch post-insert hook + +# This hook is invoked by the insert command after the message has +# been delivered, added to the database, and initial tags have +# been applied. The hook will not be run if there have been any +# errors during the message delivery; what is regarded as success‐ +# ful delivery depends on the --keep option. + +# Typically this hook is used to perform additional query-based +# tagging on the delivered messages. + +# TODO: In notmuch v0.35, the location of this hook becomes configurable. +# When I have that installed, I want to move this to ~/.config/notmuch. diff --git a/notmuch/default/hooks/post-new b/notmuch/default/hooks/post-new new file mode 100755 index 0000000..744c334 --- /dev/null +++ b/notmuch/default/hooks/post-new @@ -0,0 +1,22 @@ +#!/usr/bin/env bash +# Notmuch post-new hook + +# This hook is invoked by the new command after new messages have +# been imported into the database and initial tags have been ap‐ +# plied. The hook will not be run if there have been any errors +# during the scan or import. + +# Typically this hook is used to perform additional query-based +# tagging on the imported messages. + +# TODO: In notmuch v0.35, the location of this hook becomes configurable. +# When I have that installed, I want to move this to ~/.config/notmuch. + +# Update tags based on folders +for fdir in ~/var/mail/fastmail/* ; do + if [[ $(basename "$fdir") != "INBOX" ]]; then + notmuch tag +$(basename "$fdir") -inbox -- "folder:${fdir##$HOME/var/mail/}" + fi +done + +notmuch tag --batch --input="${XDG_CONFIG_HOME:-$HOME/.config}/notmuch/post-new.tags" diff --git a/notmuch/default/hooks/pre-new b/notmuch/default/hooks/pre-new new file mode 100755 index 0000000..443e3f2 --- /dev/null +++ b/notmuch/default/hooks/pre-new @@ -0,0 +1,15 @@ +#!/usr/bin/env bash +# Notmuch pre-new hook + +# This hook is invoked by the new command before scanning or im‐ +# porting new messages into the database. If this hook exits with +# a non-zero status, notmuch will abort further processing of the +# new command. + +# Typically this hook is used for fetching or delivering new mail +# to be imported into the database. + +# TODO: In notmuch v0.35, the location of this hook becomes configurable. +# When I have that installed, I want to move this to ~/.config/notmuch. + +/home/case/usr/scripts/syncmail -- cgit 1.4.1-21-gabe81