MH & nmh: Email for Users & Programmers

May, 2006

Show MIME Message Parts with showpart

When you show parts of messages with mhn -part or mhshow -part, you'll see the message header before you see the part. You may have mhn or mhshow configured to pause and prompt with "Press <return> to show content" before it displays body parts with that content-type. If you just want to see the contents of the part, you could configure mhn -store or mhstore to write the part to its standard output -- but it wouldn't use a pager program and, besides, mhn -store has a bug in MH 6.8.3 that prevents writing to standard output.

The MH command version named showpart solves all of those problems. It shows a message part with a pager, with no header, and with no pause before the part. Unfortunately, showpart has to use undocumented mhn switches to do this: -nomoreproc and -moreproc. So showpart may not work after MH 6.8.3.

The first argument to showpart is the part number you want to see. Any other arguments can be additional mhn options and/or message numbers. For example, to show part 1 of messages 8 through 10:

    % showpart 1 8-10
To make showpart as a version of mhn, see the Section Making a New Command Version. To make an alias or function, see the Section Writing Command Versions as Aliases or Functions.

Add the following entry to your MH profile, or add the arguments to your alias or function. This entry uses the pager less(1); if you want to use a different pager, use its name instead:

    showpart: -nomoreproc -moreproc less -nopause -form /dev/null -part
The option -form /dev/null gives mhl an empty format file so that mhl won't show any header fields.