I'm sure there are other ways to handle this, but I use Par[1], somewhat
integrated with my editor of choice Jove, to deal with it. I've got Par
installed. The Par package provides a utility named "par", which can be run
like "fmt" to filter a chunk of text and re-wrap it. It has a couple of big
advantages over fmt: it uses a sophisticated algorithm (the same sort of
algorithm as TeX) for filling text; so it attempts to find the best line
breaks using a "global" analysis of a whole paragraph, rather than just
blindly forcing as many words onto each line as will fit.

And (more to the point for this discussion) it attempts to automatically
detect prefixes, and handle them intelligently. It gets it right often enough
so I routinely expect to be able to use it to re-wrap a paragraph that is
quoted with the email-standard prefix of one or more ">" and a space, and
preserve the quoting properly.

When I said "somewhat integrated with ... Jove", here's what I use; in my
$HOME/.joverc, I have the lines:

        define-macro par-fill-paragraph 
^F^[xbackward-paragraph^M^@^[]^[xfilter-region^Mpar w78^M^F
        bind-macro-to-key par-fill-paragraph ^[j

This makes M-j (default bound to the builtin "fill-paragraph", which
implements essentially the identical algorithm to fmt(1)) pipe the current
paragraph through "par w78".

Like I said, I'm sure there are other ways to handle this, and it could well
be that some of 'em are better. I've used this solution for years, with many
MUAs and newsreaders.

Warning: the Par documentation is bad. It is _so_bad_ ("How bad is it", I hear
you cry) it is _So_Bad_, that it comes with an apology. Don't try to
understand it, it will make your head explode. Just shove text through par(1),
and if you want a different margin use an argument of "wNN" to specify the
margin width.

-Bennett

[1] <URL:http://www.cs.berkeley.edu/~amc/Par/>

Reply via email to