# HG changeset patch # User Meredith Howard # Date 1578428858 21600 # Node ID 3d460b026be9ee174d5f54f4c7d0e7ce6a3db754 # Parent 2786ee9990c6bda145330717110f6d1ac448fbec Better multipart, working tmpfile cleanup diff --git a/.muttrc b/.muttrc --- a/.muttrc +++ b/.muttrc @@ -100,14 +100,12 @@ macro compose \eh "F mutt-md2html \ny^T^ # Turn a text/plain markdown part into proper multipart macro compose \em \ "set pipe_decode\ -~/bin/mutt-md2multipart /tmp/$hostname\ -unset pipe-decode\ -a^U/tmp/$hostname/msg.txt\n^Da^U/tmp/$hostname/msg.html\n^D^T^Utext/html; charset=utf-8\n\ -=DTT&d^U\n" \ +~/bin/mutt-md2html -o /tmp/mutt-$hostname.msg.html\ +unset pipe_decode\ +a^U/tmp/mutt-$hostname.msg.html\n^Du^T^Utext/html; charset=utf-8\n\ +=TT&d^U\n" \ "multipartify" -shutdown-hook 'shell-escape rm -rf /tmp/$hostname' - push # Appearance diff --git a/bin/mutt-md2multipart b/bin/mutt-md2multipart deleted file mode 100755 --- a/bin/mutt-md2multipart +++ /dev/null @@ -1,37 +0,0 @@ -#!/bin/sh -set -eu - -output=$1 - -# Output directory is going to be one-per-process. I'd like to have a fully -# random tmpdir but doing that and having it mutt clean up is "hard". Note -# that when these two parts get attached, we can't just clean files inside the -# macro, because they aren't read into memory until send/save. - -mkdir -p $output - -# Store stdin because we're using it twice. -cat - > $output/msg.orig - -# Noting the above, there may be old output here. pandoc likes to confirm -# overwrites so we handle it. -rm -f $output/msg.{txt,html} - -pandoc \ - --quiet \ - -f markdown-blank_before_blockquote+smart \ - -t plain \ - -o $output/msg.txt \ - $output/msg.orig - -pandoc \ - --quiet \ - --standalone \ - -f markdown-blank_before_blockquote+smart \ - -t html5 \ - --self-contained \ - --template=mail \ - --highlight-style=monochrome \ - --email-obfuscation=none \ - -o $output/msg.html \ - $output/msg.orig