From 90bbd45d50c8de4807bcf8782253d7b074e616d0 Mon Sep 17 00:00:00 2001 From: Felix Van der Jeugt Date: Thu, 6 May 2021 23:53:06 +0200 Subject: [PATCH] send and display format=flowed messages --- config/vis/visrc.lua | 9 +++++++++ local/bin/mreflow | 25 +++++++++++++++++++++++++ mblaze/filter | 1 + mblaze/headers | 1 + 4 files changed, 36 insertions(+) create mode 100755 local/bin/mreflow create mode 100644 mblaze/headers diff --git a/config/vis/visrc.lua b/config/vis/visrc.lua index 170a573..af3c4e8 100644 --- a/config/vis/visrc.lua +++ b/config/vis/visrc.lua @@ -162,6 +162,15 @@ vis:map(vis.modes.VISUAL, ';a', function() end end) +vis:map(vis.modes.NORMAL, ';a', function() + if vis.count then + vis:command(string.format(':1,$|mreflow %d', vis.count)) + vis.count = nil + else + vis:command(':1,$|mreflow') + end +end) + -------------------------------------------------------------------------------- -- Strip trailing spaces diff --git a/local/bin/mreflow b/local/bin/mreflow new file mode 100755 index 0000000..e359db1 --- /dev/null +++ b/local/bin/mreflow @@ -0,0 +1,25 @@ +#!/bin/sh + +# Do not modify headers +while read line && [ -n "$line" ]; do + printf "%s\n" "$line" +done +printf "\n" + +read line || exit 0 +while true; do + if [ "${line% wrote:}" != "$line" ]; then + printf "%s\n" "$line" + read line || exit 0 + fi + while [ -n "$line" ]; do + printf "%s\n" "$line" + read line || exit 0 + done | par $* | sed 's/$/ /;$s/ $//' + read line || exit 0 + if [ -z "$line" ]; then + exit 0 + else + printf "\n" + fi +done diff --git a/mblaze/filter b/mblaze/filter index 1f65c63..5bc9029 100644 --- a/mblaze/filter +++ b/mblaze/filter @@ -1,2 +1,3 @@ text/html: w3m -dump -o display_link_number=1 -I $PIPE_CHARSET -T text/html text/calendar: cat +text/plain: mflow diff --git a/mblaze/headers b/mblaze/headers new file mode 100644 index 0000000..9f129f2 --- /dev/null +++ b/mblaze/headers @@ -0,0 +1 @@ +Content-Type: text/plain; charset=UTF-8; format=flowed \ No newline at end of file