notmuch: Remove move-and-untag pre hook
This commit is contained in:
parent
c130b2a6b6
commit
4328cbba39
1 changed files with 0 additions and 39 deletions
|
|
@ -1,39 +0,0 @@
|
|||
#!/usr/bin/env sh
|
||||
# Little script which moves some tags to specific folders.
|
||||
#
|
||||
# These 'folder-tags' (e.g. trash, archive, inbox) are transient tags
|
||||
# which then get removed when the file is in the correct folder.
|
||||
#
|
||||
# So later when trying to find the emails always use the 'folder:< >'
|
||||
# notmuch search, not the 'tag:< >' search - as the tag only signals that
|
||||
# an e-mail is currently still in the 'wrong' folder and a move action
|
||||
# is necessary.
|
||||
|
||||
MAIL_DIR="$MAIL_PATH"
|
||||
MAIL_DIR="${XDG_DOCUMENTS_DIR:-$HOME/documents}/mail"
|
||||
|
||||
# all folders: -archive -drafts +inbox -jobs -junk -receipts -sent -trash
|
||||
|
||||
# idea: archive, inbox, trash, sent -> transient tags
|
||||
# if anything is tagged, it should be moved into the folder and the tag removed.
|
||||
# Transient tags describe the _type_ of a message (essentially its importance to me)
|
||||
#
|
||||
# jobs, junk, receipts -> describe _what_ a message is (topics etc)
|
||||
# -> stable tags, which stay on a message
|
||||
|
||||
move_and_untag() {
|
||||
tag_to_remove=$1 # e.g. trash
|
||||
folder=$2 # e.g. Trash
|
||||
filter="tag:$tag_to_remove not folder:$folder"
|
||||
id_list=$(notmuch search --output=messages --format=text "$filter")
|
||||
# echo "Moving $(notmuch count "$filter") messages to $folder." # TODO: optional loud mode?
|
||||
notmuch search --output=files --format=text0 "$filter" | xargs -0 --no-run-if-empty mv -t "$MAIL_DIR/$folder/new/"
|
||||
if [ "$id_list" != "" ]; then
|
||||
echo "$id_list" | sed -e "s/^/-$tag_to_remove -- /" | notmuch tag --batch
|
||||
fi
|
||||
}
|
||||
|
||||
move_and_untag trash Trash
|
||||
move_and_untag inbox Inbox
|
||||
move_and_untag archive Archive
|
||||
move_and_untag sent Sent
|
||||
Loading…
Add table
Add a link
Reference in a new issue