MH & nmh: Email for Users & Programmers

May, 2006

Command-line Options

You'll make most changes to xmh with resource entries; Section Changing How Commands Work explains that. This section explains xmh command-line options.

MH Directory Path

As explained in the Chapter Key Parts of the UNIX Filesystem, MH keeps messages, folders, and other files in a directory. By default, xmh looks for a subdirectory named Mail in your home directory. You can change that by changing the Path: entry in your MH profile. Or, you can use the -path option to xmh (but see the NOTE in the Section Conflicts Between xmh and MH Customization). For example, to use a directory named .Mail (the dot at the start of the directory name hides the directory from the ls command), you might start xmh this way:

    xmh -path /xxx/yyy/.Mail &
where /xxx/yyy is your home directory.

NOTE: As explained in Section Sharing Other Users' Folders, everyone in a group can share an MH directory if they have UNIX filesystem permission to read and write to the directory. But this might not be a good idea with xmh, because xmh keeps a "snapshot" of each folder in a hidden file named .xmhcache. If one xmh user changes the contents of a folder (packing it, moving messages, and so on) the other user won't see the changes until xmh rebuilds its .xmhcache file -- or the user selects Rescan Folder.

Worse, if a folder isn't writable, you can mark messages for deletion, copying, and so on -- when you use Commit Changes, xmh gives you an error but can also update the table of contents to show that the changes have been made!

The Rescan Folder command will usually get you back to reality. But, if you need to use unwritable folders, think about using MH instead.

Initial Folder

Normally, xmh begins with a view of your inbox folder. You can change that with the -initial command-line option. For instance, to start with your project folder, use a line such as:

    xmh -initial project &

Toolkit Options

Because xmh is built with the X Toolkit, it recognizes standard toolkit command-line options. For a complete list, see your online X(1) manual page.

Here are a few of the options:

Starts xmh as an icon instead of an open window. The icon will have the folder name (like inbox) in it. See the -flag option, too.
Tries to change the xmh icon into a mailbox. The icon can look different if there's new mail. The new icon with xmh Release 5 was more neatly drawn. I like the older one, shown in the Figure below.

Figure: Old-fashioned xmh -flag mailbox icons


Sets the border width in pixels. For example:
      xmh -bw 15 &
sets a 15-pixel-wide border.
-fg, -bg
Set the foreground and background colors, respectively. -bd is the border color. For instance, the following command would make red text on a dark blue background, with a yellow border and lines (don't tell my artistic friends that I said you could do this!):
      xmh -fg red -bg navyblue -bd yellow &
Lets you use other resource entries without typing them in your resource file. For a partial list of these, see the Section Changing How Commands Work. Here are three useful examples.
  1. To make a pick window that's wider than it is tall (you might do this to get room for lots of Or buttons), type:
          xmh -xrm '*PickGeometry:600x450' &
  2. To change the font that xmh uses, set the font resource entry. When you're trying to see which font works best, it's handy to try the fonts from the command line. (After that, you can set a permanent font in your resource file.) As an example, to set the 6x9 font (for someone with good eyes...), type:
          xmh -xrm '*font: 6x9'
  3. You can use more than one -xrm switch. For instance, to set the PickGeometry (as in the previous example) and also disable the default HideBoringHeaders feature (which scrolls off header fields like Received:), use:
          xmh -display :0.1 -xrm '*PickGeometry:600x450' -xrm '*HideBoringHeaders:off' &