about summary refs log tree commit diff stats
path: root/notmuch/default/hooks/post-new
blob: b60ea787bfe6126397a920a98c5bf916390f79c3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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"