On 07Oct2019 09:31, martin f krafft <[email protected]> wrote:
I've set up Vim in tandem with Mutt to compose format=flowed emails, i.e. using &fo+=aw in Vim.

For the record, I use:

 set formatoptions=walqj

It also matters what your mail headers are set to. Your Content-Type header says:

 Content-Type: text/plain; charset="UTF-8"; format=flowed

Notably there is no delsp=yes; that means delsp=no.

When delsp is "yes", the trailing space on the line before the physical line ending is logically removed when assembling the post-flowed line.

I'm also in the habit of using numbered and bulletted lists in emails a lot.

Unfortunately, the two don't seem to work together well, or I am doing something wrong.

RFC 3676 doesn't address lists in any way. It is deliberately designed to turn plain text into flowable text. The RFC is here:

 https://tools.ietf.org/rfcmarkup?doc=3676

For instance, consider the following:

1. This is the first item, spanning two rows because the text is a bit longer than 80 characters, or whatever &tw is set to.

The quoted text above seems to be 2 physical lines here (in vim), with 3 spaces at the end. The final space is the padding to indicate a flowedline. I find that a little weird myself. because your original (quoted-printable) message has:

 1. This is the first item, spanning two rows because the text is a=20
    bit longer than 80 characters, or whatever &tw is set to.

I've indented that 2 spaces, but what we've got there, post quoted printable decoding, is:

- a line hard against the left margin starting with "1" and ending in a single space.

- an indented line with 3 leading spaces and no trailing spaces.

So the former line is flowed (trailing space) and the latter line is space stuffed (a leading space). A leading space is dropped from the logical line.

Post handling format=flowed, that should become a single logical line with 2 or 3 spaces between "a" and "bit" depending on delsp=yes or no respectively.

The purpose of delsp is to make the SP-CR-LF phusical line break entirely removed; in principle it can thus be planted anywhere in the logical line, though it is meant to occur between words.

2. This is the second item.

The way I have Vim configured means that the second line of the first item is properly indented, i.e. I see:

| 1. This is … |
|    bit long… |

At first, I thought those spaces at the start of the second line are "local" in that they are only needed for presentation.

The first space is. The others are not, at least as far as format=flowed is concerned.

However, when Mutt creates a MIME message, it includes those spaces!

| 1. This is … text is a=20 |
| ···bit longer             |

This means that recipients who don't use exactly the same font and window size as I do might see the following instead:

| 1. This is … text  |
| is a    bit longer |

Yes, because those leading spaces are just... spaces.

So there is no indent, but there are multiple subsequent spaces in the middle of the line, which makes the whole thing harder to read.

I think all of this would be avoided if Vim didn't add those spaces it needs for indenting (presentation) in format=flowed mode.

I agree.

Is this possible? Or am I doing something fundamentally wrong?

Well, vim is producing text which is unfriendly to a format-flowed mail presenter.

What you may need to do is to post process your message before mutt picks it up, eg by wrapping the invocation of vim in a little script to post process nicely indents list items item format=flowed friendly lines, eg by recognising a numbered or bulleted item and dropping the leading spaces from the second and following lines.

All that would be unnecessary if someone pipes up with some nice vim setting to help.

For the record, I compose format=flowed mutt emails in vim by setting $editor to my script "vim-flowed", which presently just invokes vim like this:

   exec vim \
       -c 'silent 1,/^$/s/  *$//' \
       -c 'set filetype=mail' \
       -c 'set formatoptions=walqj' \
       ${1+"$@"}

Cheers,
Cameron Simpson <[email protected]>

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_use/20191007092421.GA6211%40cskk.homeip.net.

Reply via email to