From e7bac680ad4208d2be66a6589aa2b36a4a2b7402 Mon Sep 17 00:00:00 2001 From: Tom Willemse Date: Sun, 29 May 2022 17:00:13 -0700 Subject: [PATCH] [notmuch] Replace pre-new script with SCSH script MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This also handles finding 0 emails that have the ‘deleted’ tag without showing an error. --- notmuch/.config/notmuch/default/hooks/pre-new | 15 ++++++++++++--- 1 file 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))