An MH Profile, in General
An introductory section gave an
overview and showed a short MH profile. Here's more information
and a bigger MH profile.
An MH profile entry starts with the name of a command or other
parameter followed by a colon (:). If there's more one
entry for a command, only the first one will be used (in MH 6.8.3,
at least). If an entry is longer than one line, indent all lines
except the first with space or tab character(s).
There are several kinds of entries in your MH profile:
Entries for individual MH commands, such as repl
and inc. These entries start with the name of the command
and a colon. The other part of each entry is one or more
command-line parameters that you'd like the command to use by
default. For example, the entry below tells repl first to
ask you who should get copies of your reply, then to start
the emacs editor:
Other entries apply to (in general) more than one MH command.
For example, the following entry tells MH commands that you want
to use the vi editor wherever possible:
mh-profile(5) manual page has a list of these. See lines
1-18 of the next Example.
In most cases, those general settings are overriden by settings
you make for individual MH commands. For instance, repl:
-editor emacs would override a setting like
Editor: vi when you use repl.
MIME message handling is different in MH and nmh:
In MH, the mhn command handles all MIME
processing. (This is mostly also true in nmh before version
mhn can have its own profile entry (mhn:). It
also uses a set of profile entries that start
with mhn-, like mhn-store-text/plain:.
(mhn will also read
two other profiles:
mhn_defaults and $MHN.)
In nmh-1.0 and above, the commands
mhbuild, mhlist, mhshow, and mhstore
have replaced the does-it-all mhn command. Each has its
own profile entry (mhbuild:, etc.). Each also uses a
set of MIME profile entries that start with a string like
mhbuild-, such as mhbuild-compose-text/plain:.
(These commands will also read
two other profiles:
mhn.defaults for all commands, and the individual profile
named in the environment variables $MHBUILD, etc.)
If you use both MH and front-ends (like xmh), be careful
of conflicts. MH profile entries that work fine with one may
cause problems with the other. The
Section Conflicts Between xmh and
MH Customization has some tips for xmh that you can
also apply to MH-E and exmh.
The tips in that section work for other
purposes too. For example, you might need a different value
of showproc: or Editor: on different hosts.
You could choose a different MH profile on different hosts by
adding tests to your shell's login setup file
(like .profile). For instance, test the hostname and set
a different value for the
MH environment variable on
You can make comments in the MH profile by
typing an "impossible" command name, followed by a colon. For
instance, if you don't have an MH command named comment
(which you won't, unless you followed the steps for
Making a New Command Version) -- you
can use that as a label for comments. Another popular
comment-starter is #: (a hash sign is a comment in some
programming languages, the colon is required for the MH
profile). You can also add other characters, like
XXX, to "comment out" an existing entry. Here's one way
you might make a comment, and comment out an entry:
comment: this isn't working now; figure out why!
Don't leave blank (empty) lines in the MH profile.
The example below shows a
highly-customized MH profile. The line numbers to the left of each
line (like 12>) are not part of the file; they
are for reference only. You can also grab the whole file, without
the line numbers, from the book's online archive:
NOTE for users of the online version of this book: This
example is followed by long explanations. To avoid jumping
between the example and its explanation, it's a good idea to
open a new browser window to show the example. (Check your
browser's menu for a command like
New Web Browser or Open in New Window). Then, use
the original browser to read the explanation while you view the
example in the second browser window.
2> #: First section: Overall setup for MH
4> Aliasfile: aliases
5> Alternate-Mailboxes: ehuser@*.xxx.yyy.zzz, emma@animals*,
6> email@example.com, *uucpit!ehuser
7> Draft-Folder: drafts
8> Folder-protect: 750
9> Msg-protect: 640
10> library: /usr/local/lib/mh
11> lproc: show
12> Path: .Mail
13> Previous-Sequence: pseq
14> prompter-next: vi
15> rmmproc: /home/ehuser/.bin/rmmer
16> Sequence-Negation: not
17> showproc: mhl
18> Signature: Emma H User
19> Unseen-Sequence: unseen
20> vi-next: spel
22> #: MIME setup (Overrides mhn_defaults. Overridden by $MHN, if any.)
24> automhnproc: mhn
25> mhn-charset-iso-2022-jp: %s | less
26> mhn-compose-text/x-tek: |gettek
27> mhn-private-cache: /home/ehuser/tmp/mhn-cache
28> mhn-show-text/enriched: %prichtext -e -p '%F'
29> mhn-show-application/postscript: %lghostview -safer '%F'
30> mhn-storage: /home/ehuser/mhn-storage
31> mhn-store-text/x-tek: |tekconvert '%m%P.%s'
33> #: Lines for specific standard MH programs:
35> anno: -inplace
36> dist: -annotate -inplace -editor distprompter
37> #: -nodashmunging only works if you give -filter or -format:
38> forw: -anno -inpl -form components -format -nodash
39> inc: -form scan.time
40> mhl: -nobell
41> mhn: -norealsize
42> pick: -seq picked -list
43> repl: -query -nocc me -annotate -inplace -editor prompter.nopre
44> rmf: -interactive
46> #: Stuff for new versions of MH programs and shell scripts:
48> auto_forw_send: -draftfolder +drafts
49> bomb: -form bombcomps -anno -inpl -editor head -query -nocc me -nocc cc
50> checkm: -file /usr/spool/mail/ehuser -form scan.checkm -width 150
51> cur: cur -form scan.more -width 235
52> curlast: cur-last
53> fo: -fast
54> foll: -form follcomps
55> follx: -form follcomps -filter follxfilt -editor vi
56> l10: last:10
57> l20: last:20
58> l5: last:5
59> l: last
60> msgnums: -format %(msg)
61> prompter.nopre: -noprepend -rapid
62> push: -push -draftfolder +drafts -forward -verbose
63> rapid: -rapid -prepend
64> replx: -filter replxfilt -query -nocc me -anno -inpl -editor prompter.nopre
65> resend: -editor resend.fixmsg
66> #: for 'rn' replies... there's gotta be a better way!:
67> rn-ans: -editor rn-ans.fixmsg
68> showpr: -format 'Message %(msg)' -mhl
69> showv: -showproc more
70> thanks: -form thankscomps -anno -inpl -editor cat -nocc all -whatnow push
Let's take a look at some of the entries in
the Example above. The file is divided
into four arbitrary parts with a label block of comments above
Lines 5-6 list other addresses where this
user, ehuser, gets mail. It lets MH find all messages
which are actually from the user. See the
Section Defining Alternate Mailboxes.
Lines 8-9 set the default UNIX filesystem protections
that MH will use for new folders and messages. The numbers are
like the modes that
chmod(1) uses. This particular protection scheme sets
folders (mode 750) so that people in ehuser's group
can scan them. All the messages (mode 640) will also be
readable by her group. Also see the
Section Sharing Other Users' Folders.
The library: entry in
line 10 isn't an official part of MH. It's an entry that
lets the mhparam command give the pathname of the MH
library directory on your system. The
section Settings from the MH Profile
The signature in
line 18 doesn't go at the end of mail messages; it's put
in the From: header field. See the
Section Signature and From:.
Lines 24-31 have most of the MIME setup commands. (These
use MH syntax. As the start of this page explains, the nmh
syntax changed at version 1.0.) A related entry on
line 11 sets the command used when you type list
at the What now? prompt.
Line 37 is a comment for the entry below it, a reminder
of why the entry is written the way it is. This is a good thing
to do, especially in long MH profile files.
Line 49 is a version of repl that sends a picture
of a bomb with its fuse burning. (The Chapter
New Versions of MH Commands
explains how.) The idea and the bombcomps header template
file came from the
miscellany/mtrenv directory in the MH distribution.
The -editor head doesn't actually edit the
message; it uses the UNIX
head(1) command to show the first ten lines of the draft
on the screen. After that comes a What now? prompt,
where you can choose a real editor if you want to.
Lines 51-52 and lines 56-60 are all
versions of scan that scan
different ranges of messages. For example, l10: scans
the last 10 messages, and l20: scans the last 20.
Line 61 is a workaround for a common MH problem: needing
to give different switches to prompter for different
mail-composing commands. It's used in
line 43 and
line 64. See the Section Append
Text with prompter.nopre.
The rmmproc: entry in
line 15 uses the full pathname of a shell script that's
used for removing messages. You don't always need to give full
pathnames to commands -- for instance,
line 65 calls a program named
resend.fixmsg with only
its name; in this case, MH will search your shell's search path
for the command you specify. But during jobs run by "background"
processes like cron, the search path can be short. If a
background process gives an error like
unable to exec rn-ans.fixmsg: No such file or
directory, a full pathname can help.
Line 68 is for a shell script (program). Your shell
scripts can read the MH profile with
mhparam and mhprofile.