aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2019-01-03 23:49:45 -0200
committerSilvio Rhatto <rhatto@riseup.net>2019-01-03 23:49:45 -0200
commitd4a2c219491eaf9d4f8c7d11be19cb8bc5647864 (patch)
treef6a73587f4112e7d9be7f817cae9f5533690ec30
parent4031e959bca096704b50e5735c05646c8aa39eac (diff)
downloadutils-mail-d4a2c219491eaf9d4f8c7d11be19cb8bc5647864.tar.gz
utils-mail-d4a2c219491eaf9d4f8c7d11be19cb8bc5647864.tar.bz2
Fix mutt-notmuch-tag
-rwxr-xr-xmutt-notmuch-tag22
1 files changed, 15 insertions, 7 deletions
diff --git a/mutt-notmuch-tag b/mutt-notmuch-tag
index 9b80a19..16b81cf 100755
--- a/mutt-notmuch-tag
+++ b/mutt-notmuch-tag
@@ -2,20 +2,28 @@
# Simple and crude script to tag multiple messagess in mutt using notmuch.
# See http://upsilon.cc/~zack/blog/posts/2011/01/how_to_use_Notmuch_with_Mutt/
-grep "Message-ID" - > temp.txt
-sed -e 's|Message-ID:.*<\(.*\)>.*|id:\1|' temp.txt > temp1.txt
-sed '{:q;N;s/\n/ OR /g;t q}' temp1.txt > temp2.txt
+TMP="$HOME/temp/mutt/misc"
+
+grep "Message-ID" - > $TMP/notmuch-tag-id.txt
+sed -e 's|Message-ID:.*<\(.*\)>.*|id:\1|' $TMP/notmuch-tag-id.txt > $TMP/notmuch-tag-tmp.txt
+sed '{:q;N;s/\n/ OR /g;t q}' $TMP/notmuch-tag-tmp.txt > $TMP/notmuch-tag-tagged.txt
## When vi opens up list the tagging commands, e.g. +tag1 -tag2
-vi tags.txt
+vi $TMP/notmuch-tag-tags.txt
-TAGS=`cat tags.txt`
-SEARCHEXPR=`cat temp2.txt`
+TAGS=`cat $TMP/notmuch-tag-tags.txt`
+SEARCHEXPR=`cat $TMP/notmuch-tag-tagged.txt`
## For debugging
-echo "notmuch tag $TAGS -- $SEARCHEXPR" >> temp2.txt
+echo "notmuch tag $TAGS -- $SEARCHEXPR" >> $TMP/notmuch-tag-tagged.txt
## Now apply the tags
notmuch tag $TAGS -- $SEARCHEXPR
+## Cleanup
+rm $TMP/notmuch-tag-id.txt
+rm $TMP/notmuch-tag-tmp.txt
+rm $TMP/notmuch-tag-tags.txt
+rm $TMP/notmuch-tag-tagged.txt
+
# End of mutt-notmuch-tag.sh