diff options
Diffstat (limited to 'notmuch/default')
-rwxr-xr-x | notmuch/default/hooks/post-insert | 14 | ||||
-rwxr-xr-x | notmuch/default/hooks/post-new | 22 | ||||
-rwxr-xr-x | notmuch/default/hooks/pre-new | 15 |
3 files changed, 51 insertions, 0 deletions
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 @@ | |||
1 | #!/usr/bin/env bash | ||
2 | # Notmuch post-insert hook | ||
3 | |||
4 | # This hook is invoked by the insert command after the message has | ||
5 | # been delivered, added to the database, and initial tags have | ||
6 | # been applied. The hook will not be run if there have been any | ||
7 | # errors during the message delivery; what is regarded as success‐ | ||
8 | # ful delivery depends on the --keep option. | ||
9 | |||
10 | # Typically this hook is used to perform additional query-based | ||
11 | # tagging on the delivered messages. | ||
12 | |||
13 | # TODO: In notmuch v0.35, the location of this hook becomes configurable. | ||
14 | # 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 @@ | |||
1 | #!/usr/bin/env bash | ||
2 | # Notmuch post-new hook | ||
3 | |||
4 | # This hook is invoked by the new command after new messages have | ||
5 | # been imported into the database and initial tags have been ap‐ | ||
6 | # plied. The hook will not be run if there have been any errors | ||
7 | # during the scan or import. | ||
8 | |||
9 | # Typically this hook is used to perform additional query-based | ||
10 | # tagging on the imported messages. | ||
11 | |||
12 | # TODO: In notmuch v0.35, the location of this hook becomes configurable. | ||
13 | # When I have that installed, I want to move this to ~/.config/notmuch. | ||
14 | |||
15 | # Update tags based on folders | ||
16 | for fdir in ~/var/mail/fastmail/* ; do | ||
17 | if [[ $(basename "$fdir") != "INBOX" ]]; then | ||
18 | notmuch tag +$(basename "$fdir") -inbox -- "folder:${fdir##$HOME/var/mail/}" | ||
19 | fi | ||
20 | done | ||
21 | |||
22 | 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 @@ | |||
1 | #!/usr/bin/env bash | ||
2 | # Notmuch pre-new hook | ||
3 | |||
4 | # This hook is invoked by the new command before scanning or im‐ | ||
5 | # porting new messages into the database. If this hook exits with | ||
6 | # a non-zero status, notmuch will abort further processing of the | ||
7 | # new command. | ||
8 | |||
9 | # Typically this hook is used for fetching or delivering new mail | ||
10 | # to be imported into the database. | ||
11 | |||
12 | # TODO: In notmuch v0.35, the location of this hook becomes configurable. | ||
13 | # When I have that installed, I want to move this to ~/.config/notmuch. | ||
14 | |||
15 | /home/case/usr/scripts/syncmail | ||