2013-08-27 My mail client is mmh, of course. ;-) Thus I compose my mails in a text editor. My choice is vi, to be exact: ex-vi of the Heir- loom tools. I have the `wrapmargin' set to 10, which results in about 75 character lines. It's a failure of the original vi to go for `wrapmargin' (relative margin from the right) instead of the `textwidth' (absolute length from the left) that vim has. Thus, the line length depends on the size of the terminal (window) but not on some user-chosen value. If I like mails to be wrapped below 80 chars, this is not portably possible with the original vi. (I like to have windows full screen and I do work regularily from different clients via ssh.) Automatic folding of lines is likely to be imperfect because I usually fails on lists and other stuff that was manually layouted. But there are folding tools. Vim has `gq', which is quite handy. As I don't use vim but plain old vi, I use fmt(1). (fmt is not part of POSIX but fold(1), which is, is too bad for the job.) If I want to refold some paragraph, I use: !}fmt It does the job in a second and is quick enough to type and yet flexible enough to adjust to other ranges than the current para- graph. There's one thing though, that I truly detest in Unix: The En- glish sentence spacing. It is horrible to the eyes and only poor- ly supportable by tools. (How would a tools know where the sen- tence ends and not take ``e.g.'' or ``Mr.'' as a sentence end- ing?) It would have been consequent (``general'' to use their own words) if the authors of Unix would have used french spacing throughout their system. Now we are stuck with tools that keep inserting two spaces after each [.!?]. To me this meant, that after running fmt on the paragraph I searched for double spaces and deleted one of them: / / x n x n ... I did this manually because I sometimes use multiple spaces in- tensionly, e.g. for lists. Filtering the output of fmt would not have been a good choice be- cause it preserves the indention, thus collapsing all double spaces would unindent the whole block. Today I was annoyed of the manual correction work that I did much too often, so I solved the problem the most pragmatic way: I've modified the sources of my implementation of fmt. :-) This is why Free Software is so important. If I would not have had the sources, if I would not have been allowed to change them, the most pragmatic choice would have been an impossible choice. Instead of modifying the GNU coreutils's fmt, I rather blindly took the Heirloom's fmt, for I know that their sources are small and readable, whereas in the other case I'm not sure. It took me a minute to open the single fmt.c, search for ``sentence'' to find the appropriate location, and remove the following two lines: if (strchr(".:!?", cp[-1])) *cp2++ = ' '; (You see, they also double-spaced after the colon but not after the semicolon. The rules aren't deterministic.) I've compiled the source, which took a second and copied the pro- gram into the path. I've chosen to add it as `f' to `~/bin'. Now I can use `!}f' to reformat the paragraph as desired. One task is left open: Correct reformating of quotes (or comments in source code). At least GNU fmt has the -p option to provide `> ' or so which is better than nothing. Heirloom fmt does not have -p. But even -p is far from good. There is also the tool `par'. [0] I've not yet used it. Its man page writes: par is necessarily complex. That's a bit of a stopper, but perhaps it only shows that the au- thor knows about the problem of complexity and made it only as complex as necessary ... When I had a look at the sources, I was surprised that they are only 1500 lines of C. (Heirloom fmt has 500 lines of C.) I should probably give it a try. [0] http://www.nicemice.net/par/ http://marmaro.de/lue/ markus schnalke