On Sun, Jul 31, 2022 at 01:47:06PM -0400, Kurt Hackenberg <k...@panix.com> 
wrote:

> On Sun, Jul 31, 2022 at 06:09:56PM +0200, Thomas Wei??schuh wrote:
> 
> >currently mutt always prepends `$indent_string` verbatim to each line when
> >quoting messages.
> >When quoting parts of messages that themselves already were quoted this leads
> >to additional space characters in addition to the quote characters.
> ...
> >I would like to modify the quoting algorithm to remove those additional 
> >spaces.
> >
> >```
> ># Quoted twice (new)
> >quux
> >> baz
> >>> bar
> >>>> foo
> >```
> >
> >Even if such a patch is not acceptable to the main mutt project because it is
> >in maintenance mode, I would like to gather feedback from the list about
> >potential issues with interoperability and standards-conformance.
> 
> You may not have to modify code.  I have this in .muttrc:
> 
> set indent_string = '>'
> 
> You can see the results of that above.
> 
> You could argue that should be the default value of $indent_string.

Not successfully. Changing a default affects all users who are obviously
happy with the default and forces them to "fix" their configuration to put
it back the way it was. There is rarely a good reason to do that. A recently
discovered security flaw is a good reason, but that's about it.

> I agree there should not be a space after the '>'.  The trouble is,
> that space is ambiguous: software can't tell whether it's part of the
> quoting or part of the original message.
> 
> RFC 3676 (text/plain format=flowed) forbids that space, for that
> reason.
> 
> If you propose that software add a space after the rightmost '>', but
> not after others, I think it's thirty years too late to change that
> quoting mechanism.  You'd have to change all the mail readers in the
> world, and also RFC 3676.  We know that won't happen.

For what it's worth, I prefer '> '. Not because it
avoids the "problem" of not knowing whether or not the
final space is part of the message or part of the
quote (it's part of the quote), but just because I
think it looks better/clearer. The liberal use of
spaces and blank lines can make things so much easier
for a reader to comprehend.

But if you want this behaviour (despite any ambiguity),
mutt doesn't need to change. You can set the editor
parameter to a script that modifies the quoted reply
to your liking before invoking the real editor.
Something like this perhaps:

    #!/bin/sh

    # Change "> > > blah" quotes to ">>> blah" before editing

    perl -i -e '
        sub requote { my $s = $_[0]; $s =~ s/ >/>/g; $s; }
        while (<>) { s/^([> ]+)/requote($1)/e; print; }
    ' "$@"

    ${VISUAL:-${EDITOR:-vi}} "$@"

Note that this script will cope with a mixture like "> >>> > >> blah"
and make it consistent like ">>>>>>> blah". And it won't add a final
space if there isn't one in the input.

I'm sure there's a better way to do it, but this'll do.

A good trick would be to follow any existing quote string. :-)
But the fact that there can be a mixture probably doesn't help.

Hmm, I might adopt the above but do the opposite, and add spaces
where they are "missing". :-)

cheers,
raf

Reply via email to