l i n u x - u s e r s - g r o u p - o f - d a v i s
Next Meeting:
July 7: Social gathering
Next Installfest:
Latest News:
Jun. 14: June LUGOD meeting cancelled
Page last updated:
2004 Apr 22 00:11

The following is an archive of a post made to our 'vox-tech mailing list' by one of its subscribers.

Report this post as spam:

(Enter your email address)
[vox-tech] Email formatting fun
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[vox-tech] Email formatting fun

Hey all,

I use mutt to read my email, and vim to compose messages.  Judging from
the headers on the mail messages around the list, many of you are in the
same boat.

I like my email to be as well-formatted as possible.  Towards that end,
I use a paragraph formatter named par[1] to format my email messages.
par reflows paragraphs and chooses line breaks that are optimal (in
some sense), using a dynamic programming algorithm that outperforms the
greedy one used by "fmt" and most other mail clients.

Anyhow, my messages tend to consist of at least three different classes
of text:

1. Paragraphs - the most basic unit.  These may contain a quote prefix
   (>, etc), an indent, or some other prefix, which must be preserved as
   the paragraph is reflowed to email line length.

2. Lists - such as this one.  These are formatted as "hanging indent"
   paragraphs.  For instance, this list is formatted as a set of
   paragraphs with a hanging indent of 3.

3. Raw - text that should not be touched by the formatter.  For
   instance, code snippets and my signature could be considered to be
   "raw" text.

At any rate, my current system of email formatting is somewhat
time-consuming.  Parts of the email that fall into class (1) must be
passed to par; parts that fall into class (2) must be passed to par with
a special argument indicating the level of hanging indent to be used;
and parts that fall into class (3) must not be passed to par.  Thus, I
must manually highlight groups of lines and filter them through par with
the appropriate command-line options.  This only takes a few seconds,
but it's something that could be automated.

So, the question for you Unix/text gurus is simply: what do you use
for your email? and do you have any recommendations for how I could
automate the above process?  Ideally I'd like to just have the entire
email filtered through one script that Does the Right Thing.

I'm thinking about using awk to separate the classes and pass them to
par, but I'm having more trouble doing that than seems reasonable.  Of
course, I've never used awk before, so... (-:



[1] http://www.nicemice.net/par/
vox-tech mailing list

LUGOD Group on LinkedIn
Sign up for LUGOD event announcements
Your email address:
LUGOD Group on Facebook
'Like' LUGOD on Facebook:

Hosting provided by:
Sunset Systems
Sunset Systems offers preconfigured Linux systems, remote system administration and custom software development.

LUGOD: Linux Users' Group of Davis
PO Box 2082, Davis, CA 95617
Contact Us

LUGOD is a 501(c)7 non-profit organization
based in Davis, California
and serving the Sacramento area.
"Linux" is a trademark of Linus Torvalds.

Sponsored in part by:
Sunset Systems
Who graciously hosts our website & mailing lists!