MH & nmh: Email for Users & Programmers

May, 2006

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:

  1. 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:
          repl: -query -editor emacs
          
    You use the same syntax for other MH commands, including the command versions explained in the Chapter New Versions of MH Commands. Lines 32-44 and lines 45-70 of the next Example are this kind.
  2. 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:
          Editor: vi
          
    Your online 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.

  3. MIME message handling is different in MH and nmh:
  4. exmh version 1.5 uses a few MH profile entries of its own. xmh and MH-E don't have any special profile entries.
  5. 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 certain hosts.

  6. 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!
          XXXrepl: -querry
          
    Lines 1-3, 37, and others in the Example below, show another way to make comments.
  7. 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: examples/mh/misc/mh_profile.
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.

Example: A big MH profile

     1> #:
     2> #: First section: Overall setup for MH
     3> #:
     4> Aliasfile: aliases
     5> Alternate-Mailboxes: ehuser@*.xxx.yyy.zzz, emma@animals*,
     6>     ehuser@quack.phl.ph.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
    21> #:
    22> #: MIME setup (Overrides mhn_defaults.  Overridden by $MHN, if any.)
    23> #:
    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'
    32> #:
    33> #: Lines for specific standard MH programs:
    34> #:
    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
    45> #:
    46> #: Stuff for new versions of MH programs and shell scripts:
    47> #:
    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 each part.