aboutsummaryrefslogtreecommitdiffstats
path: root/notmuch
diff options
context:
space:
mode:
authorGravatar Tom Willemse2022-05-29 17:00:13 -0700
committerGravatar Tom Willemse2022-05-29 17:00:13 -0700
commite7bac680ad4208d2be66a6589aa2b36a4a2b7402 (patch)
tree5c60002a66a13783260ac012fc0f8009fff06156 /notmuch
parent6c3bf820142ffcb4f3f36ff2a845babebd3ed086 (diff)
downloadnew-dotfiles-e7bac680ad4208d2be66a6589aa2b36a4a2b7402.tar.gz
new-dotfiles-e7bac680ad4208d2be66a6589aa2b36a4a2b7402.zip
[notmuch] Replace pre-new script with SCSH script
This also handles finding 0 emails that have the ‘deleted’ tag without showing an error.
Diffstat (limited to 'notmuch')
-rwxr-xr-xnotmuch/.config/notmuch/default/hooks/pre-new15
1 files changed, 12 insertions, 3 deletions
diff --git a/notmuch/.config/notmuch/default/hooks/pre-new b/notmuch/.config/notmuch/default/hooks/pre-new
index eb7730a..bdc15f6 100755
--- a/notmuch/.config/notmuch/default/hooks/pre-new
+++ b/notmuch/.config/notmuch/default/hooks/pre-new
@@ -1,4 +1,13 @@
-#!/usr/bin/env bash
+#!/usr/bin/env sh
+# # -*- mode:scheme; -*-
+IFS=" "
+exec scsh -s "$0" "$@"
+!#
-notmuch search --output=files tag:deleted | tr '\n' '\0' | xargs -0 -L 1 rm -v
-mbsync -a
+(define deleted
+ (run/sexp (notmuch search --output=files --format=sexp tag:deleted)))
+
+(if (> (length deleted) 0)
+ (map (lambda (mail) (run (rm -v ,mail))) deleted))
+
+(run (mbsync -a))