[comp.mail.mh] mhl formatting

smoot@linus.Berkeley.EDU (Stephen [Steve] R Smoot) (06/21/91)

I've just discovered mhl, and am trying to get something neat, but have
been struggling with syntax.

What I'd like to produce is:
To: my_addr
when that is all there is, and:
To: my_addr                cc: other-addrs
when there is a cc.

I've tried using formatfield, but as the mh_format man page suggests, its
for wizards only....

anyone know an easy solution (post).

-s

jerry@ora.com (Jerry Peek) (06/23/91)

In article <1991Jun21.020839.16361@agate.berkeley.edu> smoot@linus.Berkeley.EDU (Stephen [Steve] R Smoot) writes:
> What I'd like to produce is:
> To: my_addr
> when that is all there is, and:
> To: my_addr                cc: other-addrs
> when there is a cc.
> 
> I've tried using formatfield...

Using formatfield won't help you because the only component escape
that's defined in there is %{text}.  You can't use %{to} or %{cc} there.
As a demo, let's look at a message that has the following headers:

	Date: Thu, 20 Jun 1991 21:01:18 PDT
	From: xxx!yyy (Foo Bar)
	To: Jerry Peek <ora!jerry>
	cc: ora!zzzz

with a format file named mhl.format.tmp that includes these lines:

	Date:compress,formatfield="%<(nodate{text})%{text}%|%(pretty{text})%>"
	From:
	To:formatfield="to is '%{to}', cc is '%{cc}' and text is '%{text}'"
	cc:

The output with "show -form mhl.format.tmp" is:

	Date:    Thu, 20 Jun 91 21:01:18 PDT
	From:    xxx!yyy (Foo Bar)
	To:      to is '', cc is '' and text is 'Jerry Peek <ora!jerry>'
	cc:      ora!zzzz

Instead, how about using an awk or perl script as your "-showproc"?  Or:
	- keep mhl as your showproc, and
	- use a simple "-moreproc" shell script that joins the
	  To: and cc: lines, then feeds the result through a pager.

Anybody have better ideas?

--Jerry Peek, O'Reilly & Associates, jerry@ora.com or uunet!ora!jerry