CUSTOMIZING EXMH

Contents

NAME

exmh-custom - A guide to customizing the exmh mail user interface.

CUSTOMIZING EXMH

This man page describes the four mechanisms used to customize Exmh: , the MH profile, X resources, and custom Tcl code.

Exmh is built with the assumption that you will want to customize it to some degree. The simplest way is by the user interface, which exposes numerous knobs and dials that you can adjust to control a lot of the behavior of exmh. The second way is by defining X resources. You will need to do this if you want to control fonts and colors. It would be great if there was a user interface for this, but this is something that has not been crossed off the TODO list, yet. You also use X resources to define new buttons and menus. The third way is by adding custom Tcl code to the implementation of exmh. A personal library of Tcl routines is supported. You can either add new buttons or menus to invoke your functionality, or take advantage of some hook points inside exmh to slip in your new feature. It is also possible to completely replace any module of the exmh implementation. Finally, there are a few MH profile components introduced by exmh, although these may eventually migrate out of the profile and into the package.

PREFERENCES

After you have used exmh a little, you should explore all its capabilities by clicking on the button. There is a two-level preferences scheme, mainly because there are too many knobs and dials. At the top-level you see a menu that corresponds to different modules of the implementation. Clicking on one of the items brings up the preferences items for that module. Use the Help... button to display more detailed information about the preference items. If you click on the label of an item, the help text is scrolled to the information for that item.

There are three types of options you can set through the dialog: choices, booleans, and general items. Each of these are tied to a Tcl variable and an X resource name. Changes in the Preference user interface change the value of the Tcl variable, which affects the exmh runtime behavior. Then, when you click Save in the dialog, the values are saved as X resource settings in your ~/.exmh/exmh-defaults file.

Choices are represented by radio-style buttons where only one button in the set can be enabled at once. Changes take effect immediately. Booleans are represented by check-style buttons. If the checkbox is dark, then the option is turned on. Changes take effect immediately. Numeric and filename settings have entry widgets in which you can type in a new value. Press <Return> for the change to take effect immediately (or choose Save).

You can cycle through all the preference dialogs by using the Next button, which takes you to the next preference section. There is also a Prev button to go back. You should take time at least once to go through all the Preference sections to get an idea of what sort of options are available.

If you decide you like your settings, click Save in the main dialog to save them in a exmh-defaults file in your ~/.exmh directory. Click Reset All in the main dialog to restore all the settings to those of your last Save. Within each module's preference dialog there is a Reset button that resets only those module's settings.

Warning! If you click Dismiss in the main dialog, some preferences may have been set for the current session, but they will not have been saved to your ~/.exmh/exmh-defaults file.

PREFERENCE SECTIONS

Here is a short summary of the preference sections and what features they control. The Tcl module that the section corresponds to is listed so you can dig into the code if you want to.

The Top Ten
A collection of the ten most important preference settings.
Address Database
Control automatic address memorization, limit it to certain folders. (addr.tcl)
Background Processing
What actions occur in the background, and how frequently. (background.tcl)
Bayesian Spam Filter
An interface to external spam-filtering software, such as SpamAssassin, bogofilter, spamoracle, and others. (bogo.tcl)
Busy Indicator
What method of signaling that exmh is busy. (busy.tcl)
Editor Support
An external editor, spell program, and MHN command can be defined. (editor.tcl)
FS Box
The file selector has a few parameters, including the threshold size for large directories and whether or not you want to see files who's names begin with a period. (fileselect.tcl)
Faces
The use of the facesaver database and the decompression of X-Face and X-Image-URL components can be controlled. (faces.tcl)
Folder Cache
Set how many lines are in your folder cache display, and what folders are permanently in your folder cache. (fcache.tcl)
Folder Display
Set the number of rows of labels in the folder display. The style of nested folder display is controlled here. (fdisp.tcl)
Fonts
A font selection dialog. (fontsel.tcl)
General PGP Interface
exmh has support for a number of different versions of the Pretty Good Privacy email security program. This dialog allows you to set parameters that apply to all supported versions of PGP. For example, you can choose whether exmh can remember your pass phrase or if all PGP programs are run under an xterm instead. There are preferences dialogs for each supported version of PGP; they may or may not appear in your installed version depending on which versions of PGP are detected when exmh is run. (pgpMain.tcl)
Glimpse
Settings for the Glimpse full-text indexing system. (glimpse.tcl)
GnuPG Interface
Preferences that apply to GPG (the GNU Privacy Guard). (pgpGpg.tcl)
Hacking Support
A debug log can be enabled, and you can define the directory for personal Tcl code. (main.tcl)
Html Viewer
Settings for the built-in HTML viewer, including the proxy server and port. (html.tcl)
I-Spell
This is a module to allow interactive spelling within a sedit window it has many fine features include suggested correction and the ability to add new words to a session or to your personnel dictionary. For words that are either not correct or not generated by a combination of roots or compounds, the word is marked as not spelled correctly. (ispell.tcl)
Incorporate Mail
The method you use to Inc can be set. You can set inc to run when you start exmh and when you open the exmh window. (inc.tcl)
Intelligent Signatures
Controls how different signature files are chosen based on the recipient. (seditExtras.tcl)
MH Tweaks
Background sending can be enabled. The naming convention for deleted files (leading , or #) is set. The age of files to purge can be defined. (mh.tcl)
MIME
There are several adjustments you can make to the MIME message display. Note that the font sizes chosen here do not affect non-MIME messages. (mime.tcl)
NNTP Support
Set the news server here, and the newsgroups to retrieve if you have background news retrieval enabled. (post.tcl, getnews.tcl)
PGP 2.6 Interface
Preferences that apply to PGP 2.6. (pgpPgp2.tcl)
PGP 5.0 Interface
Preferences that apply to PGP 5.0. (pgpPgp5.tcl)
PGP 6.5 Interface
Preferences that apply to PGP 6.5. (pgpPgp6.tcl)
Printing
The print command can be defined. You can also enter an arbitrary UNIX command to apply to a message. (print.tcl)
Quoting
Exmh has the ability to write to a quoting file ('@' by default). This controls how this is done. (quote.tcl)
Scan Listing
You set the number of lines in the scan listing here. There are several tweaks on message viewing: Implied Direction, Next Guard, Auto Commit, Advance After Link, Show New Messages, Skip Marked. You can also choose the scan format width here. (ftoc.tcl)
Sequences Window
This is a summary window that lists which folders have messages in sequences. (seqwin.tcl)
Simple Editor
Formatting parameters can be adjusted and automatic signatures can be enabled. (sedit.tcl)
Slow Display
If your display is slow (due to being over a slow link or encryption or whatever), exmh will recognize that the display is slow and can disable certain network intensive, but non-critical operations. (extrasInit.tcl)
Sound
The sound effects can be controlled. (sound.tcl)
WWW
Exmh can communicate with an external HTML viewer (e.g., Mosaic or netscape) in order to display pages from the World Wide Web. It can scan the current message for embedded URL. The URLs are changed into active text buttons. Click on one and the web browser is asked to display the page. Use the preferences to choose the external viewer and to control if the URL scanning is done automatically. (uri.tcl)
Windows & Scrolling
Scrolling speed and parameters related to constrained text scrolling can be defined. Also can enable Wheel Mouse. Constrained scrolling keeps the last line of text stuck to the bottom of the text display. (exwin.tcl and widgetText.tcl)

BINDING UI

There are a number of keystroke bindings already defined by exmh that invoke different Tcl commands. You can change the bindings and add bindings for new commands via the Bind dialog. Open the dialog from the menu entry under the Bindings menu. The dialog presents a scrollable column of commands and their bindings, plus an area at the top to define a new binding.

Binding Syntax. The following is a very brief summary of the Tk bind syntax. For the complete story, consult the Tk man page for the bind command. The Tk syntax for the bindings events looks like this:

<modifier-type-detail>
A modifier is a key that you hold down while pressing another key. The modifiers you are likely to use are listed below. Capitalization is important.
Control Shift Meta
The type is the event type, and it can left out if the detail part implies the type. The types you will usually use are:
Key Button
The detail specifies the key or button number for the event. Keys are named by their X keysym. For the letters and digits, the keysym is just the letter or digit, e.g., <Key-a>, which can be shortened to <a>. For punctuation, however,

the keysyms are words. Here are some examples, and again the Key type is left out.

<comma> <period> <dollar> <asciicircum> <question> <exclam>
Perhaps the easiest way to figure out the keysym is to use the following Tcl/Tk command. Run the Tcl/Tk shell, wish, and enter this command. Then type with the mouse over the little window it displays.
bind . <Any-Key> {puts stdout "keysym = %K letter = %A"}

MH PROFILE

Exmh uses a couple of things from your .mh_profile file, including several components that are new.

Header-Suppress and Header-Display
You control what headers are displayed in a message with a combination of the Header-Suppress and Header-Display profile components. Hidden headers are just scrolled off the top of the message display window. Each of these profile components is a list of regular expression patterns that are used to match against the header. Case is not significant in the patterns. Its easiest to explain by giving the algorithm that uses these patterns.
By default, show all headers. If a header is in the Header-Suppress list, do not show it. If a header is in the Header-Display list, show it. The default values for these profile components are: Header-Suppress: .* Header-Display: Subject To From Date Cc Newsgroups

If you are a mail junky, you may want to use Header-Suppress to explicitly suppress the boring header components you already know about. The new, interesting components inserted by random mailers will be displayed for you to check out. In contrast, the default for Header-Suppress will hide everything, and you explicitly choose what headers you want to see by setting Header-Display.

Folder-Order
The Folder-Order component defines a sort ordering for your folder labels in the folder display area. Each item in the order can be the name of a folder, or a string match pattern to match on the folder names. All folder names that match the same pattern are sorted alphabetically. Longer pattern matches have priority over shorter patterns. The patterns use the syntax of Tcl's string match function, which is similar to that used in many shells.
* matches a sequence of any characters. ? matches any character. The default Folder-Order puts your inbox first. Folder-Order: inbox * My Folder-Order looks like: Folder-Order: personal exmh mxedit * mail* sun m3 mach background

The other effect of Folder-Order is to define a traversal order for visiting folders with unread mail in them. When you do a Next and are at the end of a folder, exmh will automatically change folders to the next one in the Folder-Order that has unseen messages, if any. When there are no more folders with unseen mail, then you will change back to the first folder in your Folder-Order, unless you disable this by turning off the Cycle back to first preference setting under the Unseen Folders section.

Folder-Unseen
The Folder-Unseen component lets you constrain the search through folders for the ones with messages in the unseen message sequence. Its value is a set of string match patterns that are matched against folder names. If a folder name matches the pattern, it is searched for unseen messages. If the pattern begins with a !, however, then a folder that matches the pattern (not including the !) is excluded from the search. The default is *, which matches everything. Put the negated patterns first in your list of patterns (e.g., !junk* inbox*).
Folder-Ignore
The Folder-Ignore component specifies a set of string match patterns for folder names you want to ignore. These folders are not even displayed by exmh. It defaults to ".* */.* */*/.* */*/*.*" , which causes exmh to ignore directories whose name begins with a period.
Draft-Folder
The Draft-Folder component is used to know where to put messages being composed. Exmh will ask you if it is OK to create a Draft-Folder entry if you do not already have one.
ExmhShowProc
The ExmhShowProc component lets you define a program that pre-filters a message before displaying it. If an ExmhShowProc is defined, then exmh runs that program with the current message as the standard input and displays what is generated on the program's standard output. Note that the Header-Suppress and Header-Display mechanism is still used even if you have a special show proc.
Scan-Proc
The Scan-Proc component can be used to define an alternative scan program. If you change the scan format, you need to make sure that the first item on each scan line is the message number. Exmh depends on this. (It makes no attempt to decipher scan formats.)
MailDrop
The MailDrop component is required if you do not have your system mail spool file in the "standard" location, which is typically /usr/spool/mail/username. If you do not define MailDrop correctly then Inc will not do anything because it will not file your new messages in the system spool file.
Path
The Path component is used to find your mail folders. Exmh will abort if this entry is not there on the presumption that you have not set yourself up to use MH properly.

X RESOURCES

The X resource database is used as a repository of Preference settings, window positions, and definitions of fonts, colors, buttons, and menus. The information in the database can come from a variety of sources, which can be confusing. The default values come from the app-defaults file that is kept in the script library directory for exmh. Color-specific resources are contained in the app-defaults-color or app-defaults-mono file. One of these two is used depending on the display.

A site administrator can add local resource specifications in the local-app-defaults file. Put this into the exmh script library directory (the same place as app-defaults). To handle site-specific color-specific resources, exmh will also read the local.app-defaults-color or local.app-defaults-mono if those files exist.

Each user has a ~/.exmh/exmh-defaults file in their home directory. To handle personal color-specific resources, exmh will also read your ~/.exmh/exmh-defaults-color or ~/.exmh/exmh-defaults-mono if those files exist.

I do not recommend putting exmh-related resource settings in your ~/.Xdefaults, although you can do that. If you do, be warned that values from the ~/.Xdefaults file and the RESOURCE_MANAGER property on the root window will be overridden by things in your ~/.exmh/exmh-defaults file.

The ~/.exmh/exmh-defaults file is divided into sections. The first section is for things you add by hand. The remaining sections are automatically managed by exmh. If you manually add settings to your ~/.exmh/exmh-defaults file, add entries to the beginning of this file. Add them before the comment about the rest of the file being automatically generated and you will not lose your changes.

If a resource has a multiword value, you *should not quote* the value in the resource file. The right way to specify these in your ~/.exmh/exmh-defaults file is shown below. The leading "*" gets around quirks in the way Tk names its applications; different instances of the application have different names.

*scrollbarSide: left *c_current: violet red

Finally, if you are really serious about fiddling with resources, you should look through the app-defaults file. For one thing, there is no guarantee that the resource names used in this man page, which correspond to version 1.5, will be exactly the same in later versions of exmh. Furthermore, there might be new goodies that appear in future versions that are not described here. Only by reading the app-defaults file of the current version will you be sure you are setting things correctly in your ~/.exmh/exmh-defaults file. (Hint: read through the main exmh script for the definition of the exmh(library) Tcl variable, which is the script library where app-defaults lives. The script is short, and the definition is near the beginning.)

WIDGET CLASS HIERARCHY

If you want to dive into the widget tree and fiddle with fonts and colors and such, here are the class descriptions. I also highly recommend the tkinspect program, which you can find in the Tcl archives.

Main
Top row of buttons and title label
Fdisp
Folder label display
Fltop
Folder label display when it is in a detached toplevel.
Fops
Folder operation buttons and folder label
Ftoc
Folder table of contents display
Mid
Frame around Face, Msgid, Status, Mops
Mid.Face
Bitmap display
Mid.Right.Status.label
Message label
Mid.Right.Status.msg
Status line
Mid.Right.Mops
Message buttons
Msg
Message display
Clip
Detached message display
Sedit
Simple editor top-levels
Help
Help window
Key
Color key window
Pref
Preferences dialogs
Log
Error/debug log
Pick
The pick dialog
Glimpse
The glimpse dialog
NewFolder
The new folder dialog.
DeleteFolder
The delete folder dialog.
WhatNow
The What Now? dialog.
Error
Error popups
Dialog
General popups

RESOURCES FOR BUTTONS

exmh uses X resources to specify its buttons and menus on the main display, the editor window, and the What Now dialog. You can add a button to one of these areas of the user interface by listing it in a ubuttonlist resource and then adding some more resources that describe the button. X resource names are hierarchical, and these are the button list resources used by exmh.

*Main.ubuttonlist *Fops.ubuttonlist *Mops.ubuttonlist *Sedit.Menubar.ubuttonlist *WhatNow.ubuttonlist
Fops is the set of folder operation buttons. Mops is the set of message operations buttons. Sedit.Menubar is the buttons in the built-in editor. WhatNow is the What Now dialog used with external editors. The ubuttonlist resource is necessary because there is no easy way to enumerate the contents of the resource database.

There are actually several resources associated with each set of buttons in order to provide maximum flexibility. There are three sources of button definitions: system buttons are defined by the base release ("at the factory"); local buttons are defined by your site administrator; user buttons are defined by each user. In addition, the site and the user can delete buttons with other resources. The resources are:

buttonlist The list of system defined buttons lbuttonlist The list of local (site) defined buttons ubuttonlist The list of user defined buttons l-buttonlist The list of buttons deleted at the local level. u-buttonlist The list of buttons deleted at the user level.
When exmh creates a set of buttons, (e.g., the *Main buttons), t asks for the definition of all these resources to determine what buttons are being defined (e.g., *Main.buttonlist, *Main.ubuttonlist, and so on.) For each of these buttons, additional resources specify the text label and command for each button. This is best explained by an example. Here are the definitions for the main buttons:
*Main.buttonlist: quit pref alias *Main.quit.text: Quit *Main.quit.command: Exmh_Done *Main.pref.text: Preferences *Main.pref.command: Preferences_Dialog *Main.alias.text: Aliases *Main.alias.command: Aliases_Pref
The *Main.buttonlist resource names the buttons that appear in the top row of buttons. Its value, in turn causes exmh to look around for the other resources that define the text and command attributes for each button. The command is a Tcl command, and most are simple commands of one or two words. If you are really inspired you can set many different attributes of a Tk button via resources, but you'll have to consult the Tk man page on button for the details.

As another example, here is how you would add a Repl button to the message buttons. By default, there are a few variations on Reply under the Reply... menu. You might like a Repl button that does your most common form of reply. The Msg_Reply Tcl command takes regular arguments for the MH repl program.

*Mops.ubuttonlist: myrepl *Mops.myrepl.text: Repl *Mops.myrepl.command: Msg_Reply -filter myrepl.filter -cc all

If you hate the Reply... menu altogether, you can remove it by adding it to the u-buttonlist resource. You'll have to look at the master app-defaults file to find out the internal name of each button.

*Mops.u-buttonlist: reply

RESOURCES FOR MENUS

The menus in exmh are defined in a similar way. It is a little more complex because there is more to a menu than a button, but the general idea is the same. There are parallel sets of resources for the system-defined and user-defined parts. Each section has a list of menus defined with the following resources:

menulist The list of system defined menus lmenulist The list of local (site) defined menus umenulist The list of user defined menus l-menulist The list of menus deleted at the local level. u-menulist The list of menus deleted at the user level.

Each menu, in turn, has a text resource that defines the label on the menubutton. The entrylist resource lists the entries that are found under the menu. Again, the system-defined entries are listed under entrylist, the administrator defines lentrylist, and users are meant to add new entries to uentrylist. System (or local) defined entries can be removed by adding them to the l-entrylist and u-entrylist resources.

For each menu entry there are resources with the following naming convention (this is not standard Tk): if the entrylist item is foo, then:

l_foo defines the label (text) for the entry. c_foo defines the command. t_foo defines the type: "command", "check", "radio", "cascade", or "separator". v_foo defines the variable associated with check and radio entries. m_foo defines the menu associated with cascade entries.
For more information, it might be helpful to consult the Tk man page for menu. For example, here is how the main menus for exmh are defined:
*Main.menulist: bind help *Main.bind.text: Bindings *Main.bind.m.entrylist: command sedit *Main.bind.m.l_command: Commands *Main.bind.m.c_command: Bind_Pref *Main.bind.m.l_sedit: Simple Edit *Main.bind.m.c_sedit: Sedit_Pref *Main.help.text: Help... *Main.help.m.entrylist: help colorkey faq *Main.help.m.l_colorkey: Color Legend *Main.help.m.c_colorkey: Help_KeyDisplay *Main.help.m.l_help: Quick Intro *Main.help.m.c_help: Help *Main.help.m.l_faq: Frequently Asked Questions *Main.help.m.c_faq: Help FAQ

Note the additional .m component in the *Main.help.m.entrylist resource name. The *Main.help resource corresponds to the menubutton, and *Main.help.m corresponds to the menu associated with that button.

For another example, we can use the uentrylist resource to add a new menu entry to the message More... menu. It will be a check-button type entry that will set the Tcl variable that controls the "skip marked" behavior of Next and Prev. In addition, we will separate the user-defined entries from the system entries with a special separator menu entry. The resources in your ~/.exmh/exmh-defaults would look something like this:

*Mops.more.m.uentrylist: sep skip *Mops.more.m.t_sep: separator *Mops.more.m.t_skip: check *Mops.more.m.l_skip: Skip marked messages *Mops.more.m.v_skip: ftoc(skipMarked)

In this case the Tcl variable is ftoc(skipMarked), which is an element of an associative Tcl array. Menu entries that use Tcl variables defined by exmh might stop working in a future release. However, you can easily get an idea of what the important variables are by searching through the code for Preferences_Add calls. These calls set up the relationship between the internal Tcl variables and the Preference items you see in the interface. In most cases the variables are elements of an associative array. In this example, ftoc is the array that holds the state variables for ftoc.tcl, which implements the scan listing.

BUTTON GROUPS

When you use exmh, you will notice that some of the message buttons are disabled when there is no current message. This is implemented by putting the Mops buttons and menu entries into groups. The group membership is defined via resources. The groups are current, range, and nodraft. The current group contains all the buttons and menu entries that are enabled when there is a current message. The range group contains buttons and menu entries that can be applied to multiple messages. The nodraft group is for those buttons and menu entries that ought to be disabled when you are in the drafts folder.

For each group there are several corresponding resources that list the buttons, (system, local, and user), and menu entries, (system, local, and user), in the group. These are the group-defining resources and (part of) their default values.

*Mops.g_current: link move delete reply forward *Mops.gm_current: Print {Unmark (Undo)} Clip Redistribute {Burst Digest} *Mops.lg_current: *Mops.lgm_current: *Mops.ug_current: *Mops.ugm_current: *Mops.l-g_current: *Mops.l-gm_current: *Mops.u-g_current: *Mops.u-gm_current: *Mops.g_range: link move delete forward *Mops.gm_range: Print Unmark {Mark Unseen} *Mops.lg_range: *Mops.lgm_range: *Mops.ug_range: *Mops.ugm_range: *Mops.l-g_range: *Mops.l-gm_range: *Mops.u-g_range: *Mops.u-gm_range: *Mops.g_nodraft: reply forward *Mops.gm_nodraft: Redistribute *Mops.lg_nodraft: *Mops.lgm_nodraft: *Mops.ug_nodraft: *Mops.ugm_nodraft: *Mops.l-g_nodraft: *Mops.l-gm_nodraft: *Mops.u-g_nodraft: *Mops.u-gm_nodraft:
The naming convention for buttons and menu entries is different. The buttons are named the same way they appear in the buttonlist resource specification. The menu entries are named by their textual label. If a menu entry label includes spaces, then the label must be grouped. Braces are used for compatibility with the Tcl grouping syntax.

Warning! If you move things between the *Mops.buttonlist and the *Mops.more.m.entrylist, then you will have to adjust your group settings because the naming convention for buttons and menus is different.

COLOR RESOURCES

The basic TK widget color attributes are listed below. Most of these are defined in app-defaults-color to obtain a family of gray levels.

background
The main background of a widget. Default is a light gray (#efefef)
foreground
The foreground, (e.g., for text). Default is black.
activeBackground
The background of a button or menu when the mouse is over it. Default is white.
activeForeground
The foreground of a button or menu when the mouse is over it. Default is black.
disabledForeground
The foreground color of a button or menu that has been disabled. Default is grey50.
selectBackground
The background of text when it is selected. Default is canary blue.
highlightColor
The color of the focus highlight rectangle when a widget has focus. Default is black.
highlightBackground
The color of the focus highlight rectangle when a widget does not have focus. Default is the same gray as background.
selector
The color of the checkbutton and radiobutton glyph when the button is selected. Default is black.
troughColor
The "other background" for scrollbars and scales. Default is gray (#dfdfdf)

You can specify colors for particular classes of widgets. All the labels are blue in exmh, by default, because of the following in app-defaults:

*Label.foreground: blue

The following resources are used to control the looks in the folder label display. The fact that some have a trailing Bg or Fg is purely historical accident. Originally you could only specify the foreground (for current and unseen) or the background (for moved and deleted) but now, for the benefit of grayscale users, you can specify all of them. You might also look at the fdispColor.tcl and ftocColor.tcl files that use these resources.

c_current
The color for the current message and current folder. Default is violet red.
c_unseen
The color for unseen messages and folders that contain unseen messages. Default is blue.
c_unseenBg
The background color for unseen messages. Default is normal background (same as text widget default background).
c_moved
The background color for messages that are marked for refile, and the background label color for the target folder for refile. Default is yellow.
c_movedFg
The foreground color for messages that are marked for refile. The default is normal foreground.
c_foreground
The foreground color for labels in the folder display. Default is black.
c_background
The background color for labels in the folder display. Default is white.
c_popup
The color for the popups that display nested folders. Default is grey.
c_st_normal
The color for normal status messages. Default is blue.
c_st_error
The color for error messages. Default is red.
c_st_warn
The color for warning messages. Default is purple.
c_st_bg_msgs
The color for messages from the background process. Default is medium sea green.
c_uri
The color used to highlight URL and URN text by the Highlight URI function. The default is thistle.
Text.c_link
The color used for links in HTML display. The default is blue.

The following resources are used to control how sequences are highlighted in the scan listing. This includes both (n)mh sequences and also some exmh specific sequences.

sequences
The priority of sequences for display. Sequences which are not in this list will not be displayed. If a message is in two different sequences, the latter sequence will be applied on top of the former seqeunce. To add your own sequences, simply redefine this resource and add a sequence_yoursequence resource. Default is: mrange drange range moved deleted. selected unseen current.
sequence_cur
"cur" is not really an (n)mh sequence. This describes how the current message is displayed. Default is: -foreground {violet red} -background white.
sequence_unseen
This is the sequence for unseen messages. Default is: -foreground blue.
sequence_moved
This is the seqeunce for moved messages. This is not an (n)mh sequence, but is instead merely a marking of messages which are to be moved to a different folder. Default is: -background yellow.
sequence_deleted
This is the sequence for deleted messages. This is not an (n)mh sequence, but is instead merely a marking of messages which are to be deleted. Default is: -overstrike 1.
sequence_selected
This is the seqeunce for selected messages. This is not an (n)mh sequence, but is instead merely a marking of messages which are to be processed. Default is: -foreground black -background #ececec.

COLORIZING HEADERS

A set of resources are used to specify colors and other font attributes of message headers.

m_tagnames
This defines a list of mail headers for which you want to define special looks when they are displayed in the message area. For each tagname, you should define another resource with name m_tagname (e.g, m_subject) that has the text tag configuration options for that header line. Consult the Tk man page on the text widget to see what sort of tag configuration options there are. In addition, two special tagnames are used for defaults if there are no more specific matching tag name. "default" applies to displayed headers, while "hidden" applies to hidden ones (scrolled off the top).

For example, here is what I have in my own ~/.exmh/exmh-defaults file:

*m_tagnames: hidden subject from x-filters-matched default *m_hidden: -font 6x10 *m_default: -foreground black *m_subject: -foreground blue *m_x-phase-of-moon: -foreground blue *m_from: -foreground "medium sea green"

GEOMETRY AND POSITION RESOURCES

Exmh automatically remembers the position of top-level windows, both within a session and between successive runs of exmh. It does this by saving some position resource specifications in your ~/.exmh/exmh-defaults file. In addition, exmh will remember the geometry of the main window and of the detached folder display.

Warning: If you use a virtual root window manager, the memory of a window location will cause problems if you start exmh in a new "room". If you move exmh to a new room, you'll have to edit your ~/.exmh/exmh-defaults and delete all the *position resource specifications. Or, you can turn off the Remember Window Positions preference item under Window Stuff. Then, when exmh exits, it removes these for you.

You can adjust the width and height of some of the text windows. Here are the default values.

*Fltop*Canvas.width:
300
*Fltop*Canvas.height:
100
*Sedit*Text.width:
80
*Sedit*Text.height:
24
*Clip*Text.width:
80
*Clip*Text.height:
48
*Help*Text.width:
80
*Help*Text.height:
30
*Log*Text.width:
80
*Log*Text.height:
20

ICON POSITIONS

The iconposition resources specify the location of the icons, both for the main window and the detached folder display (if any). The format is +X+Y to specify the upper-left hand point. If you use - instead of +, then the position is relative to the lower-right corner instead of the upper-left corner. By default no position is specified so your window manager will place the icon. The iconic resource indicates the startup disposition of the window.

exmh.iconposition:
(empty - no default position)
exmh.iconic:
0
*Fltop.iconposition:
(empty - no default position)
*Fltop.iconic:
0

ICON APPEARANCE

You can control the bitmap and the label on the icon. There are three states for the icon: no mail, spooled mail, and unread mail. For each of these states you can define a bitmap and a label. The label can include references to exmh variables, as you will see in the default values. The value for the Bitmap is a file name. If it is relative then it is assumed to be in the exmh script library. Specify an absolute pathname otherwise.

*iconUpBitmap:
flagup.bitmap
*iconDownBitmap:
flagdown.bitmap
*iconSpoolBitmap:
flagspool.bitmap
*iconUpMask:
flagup.mask
*iconDownMask:
flagdown.mask
*iconSpoolMask:
flagspool.mask
*iconUpLabel:
$flist(newMsgs) Unseen
*iconDownLabel:
exmh
*iconSpoolLabel:
$exmh(numUnInced) Spooled
*iconUpGlyph:
flagup.gif
*iconDownGlyph:
flagdown.gif
*iconSpoolGlyph:
flagspool.gif

You can reference any global exmh variable in the icon label. The two most useful are $flist(totalcount,unseen), which is a count across all folders of messages in the unseen sequence, and $exmh(numUnInced), which is the number of messages in your system spool file. This later value is only computed by the background "count" operation.

The icon*Glyph values are color images for the icons; the icon*Bitmap values are black & white images for the icons and are used if the Glyph is not available; the icon*Mask values are masks to allow transparency in black and white icons.

The color icons may be disabled and the black and white used in their place by providing a meaningless value (such as "none") for the Glyph.

FOLDER DISPLAY RESOURCES

fl_font
The font for the labels in the folder display. Default is "fixed".
fl_xgap
The horizontal gap, in pixels, between labels in the folder display. The default is 8.
fl_ygap
The vertical gap, in pixels, between labels in the folder display. The default is 8.
fl_curbutton
The button that chooses the current folder in the folder display. The default is 1. (1=left, 2=middle, 3=right).
fl_navbutton
The button that navigates nested folders in the folder display. The default is 2. (1=left, 2=middle, 3=right).
fl_tarbutton
The button that chooses the target folder for operations in the folder display. The default is 3. (1=left, 2=middle, 3=right).

MIME RESOURCES

Resources are used to define the set of understood MIME types and to define the font families used to display messages in various character sets.

mimeTypes
This lists the Content-Types for which handler procedures are defined. For each of these there is a corresponding mime_content/type resource that specifies the Tcl command used to display a part of that type. mimeUTypes is the parallel resource so that users can add content types of their own. For example:
text/plain text/richtext text/enriched multipart/mixed multipart/digest multipart/parallel multipart/alternative application/octet-stream message/external-body message/rfc822 image/gif *mimeUTypes: *mime_text/plain: Mime_ShowText *mime_text/richtext: Mime_ShowRichText *mime_text/enriched: Mime_ShowRichText *mime_multipart/mixed: Mime_ShowMultipart *mime_multipart/digest: Mime_ShowMultipartDigest *mime_multipart/parallel: Mime_ShowMultipartParallel *mime_multipart/alternative: Mime_ShowMultipartAlternative *mime_application/octet-stream: Mime_ShowApplicationOctet *mime_message/external-body: Mime_ShowMessageExternal *mime_message/rfc822: Mime_ShowRfc822 *mime_image/gif: Mime_ShowImage
mimeCharsets
A font has a character set, which is an encoding for the characters. This is an optional parameter to the text Content-type. us-ascii is the basic ASCII charset, which lacks special characters used in many European languages. The iso-8859-1 character set has 8-bit characters and is used to encode accented and other special characters used in latin-based languages. The iso-8859-8 is used for Hebrew. The iso-2022-jp is used for kanji. You need a specialized version of the Tk toolkit to display kanji.
*mimeCharsets: us-ascii iso-8859-1 iso-8859-8 iso-2022-jp *mimeUCharsets: *mime_us-ascii_registry: iso8859 *mime_us-ascii_encoding: * *mime_iso-8859-1_registry: iso8859 *mime_iso-8859-1_encoding: 1 *mime_iso-8859-8_registry: iso8859 *mime_iso-8859-8_encoding: 8 *mime_iso-2022-jp_registry: jisx0208.1983 *mime_iso-2022-jp_encoding: *
mime_charset_plain_families
A font has a family that determines the basic look for the font, like times or helvetica. Each of the family resources specifies a list of families that are tried, in order, to find a font that is supported by the X server. The plain family resource lists a set of font families that are used for ordinary text/plain messages.
*mime_us-ascii_plain_families: fixed clean lucidatypewriter courier terminal *mime_iso-8859-1_plain_families: lucidatypewriter fixed courier terminal *mime_iso-8859-8_plain_families: fixed *mime_iso-2022-jp_plain_families: fixed
mime_charset_fixed_families
The fixed families are used to display fixed-width fonts. Fixed is one of the types allowed by text/enriched fonts.
*mime_us-ascii_fixed_families: lucidatypewriter fixed clean courier terminal *mime_iso-8859-1_fixed_families: lucidatypewriter fixed courier terminal *mime_iso-8859-8_fixed_families: fixed *mime_iso-2022-jp_fixed_families: fixed
mime_charset_proportional_families
The proportional families are used for text/enriched.
*mime_us-ascii_proportional_families: times "new century schoolbook" lucidabright charter lucida helvetica *mime_iso-8859-1_proportional_families: times "new century schoolbook" lucidabright charter lucida helvetica *mime_iso-8859-8_proportional_families: *mime_iso-2022-jp_proportional_families:
mime_charset_title_families
The title families are used for menu and section titles.
*mime_us-ascii_title_families: times "new century schoolbook" lucidabright charter lucida helvetica *mime_iso-8859-1_title_families: times "new century schoolbook" lucidabright charter lucida helvetica *mime_iso-8859-8_title_families: *mime_iso-2022-jp_title_families:
mimeExtMethods
This resource lists the set of external access methods for use with message/external-body MIME parts. For each of these methods there is a corresponding resource that lists the Tcl command that handles the access method.
*mimeExtMethods: local-file anon-ftp *mimeUExtMethods: *mime_local-file: MimeLocalFileTransfer *mime_anon-ftp: MimeFTPTransfer

SEDIT BINDING RESOURCES

sedit_typeKillsSel
Set to 1 or 0 to enable or disable type-in-kills selection: if there is selected text, typing new characters delete the selection.
sedit_scrollButton
Set to Middle (the default), Shift-Middle, or Right, to control which button is used for drag-scrolling text widgets.
sedit_editprocs
This is a list of built-in editing functions. It doesn't really make sense to change this unless you edit seditBind.tcl to provide an implementation for the edit function.
sedit_key_function
There is a corresponding resource for each function listed in sedit_editprocs. The value of the resources is one or more event sequences that trigger the function.

MISCELLANEOUS RESOURCES

helpInOneWindow
Set this to 1 to get a new preferences interface.

localTimeFormat
If a message was sent from another time zone, the local equivalent is calculated and appended in parentheses to the displayed Date: header. This resource describes the format, which uses the strftime(3C) syntax. The default value is:
%H:%M %Z
mime_alternative_prefs
If a message contains a MIME part of type multipart/alternative, exmh will select one of the alternatives for display. You can control the order of preference of the various alternatives. The most common use for this is to establish the precedence of text/plain over text/html for exmh users who do not use the in-line html viewer for showing text/html content.

Example:

*mime_alternative_prefs: text/plain text/richtext text/html
If no value of mime_alternative_prefs is provided, exmh will display the last alternative that it is capable of displaying.

PROGRAMMING EXMH

Exmh is implemented as a Tcl/Tk script that uses the MH programs to manage your mail. The script is interpreted at runtime and is therefore distributed in source form. You can read the source to figure out what really going on. Furthermore, you can take advantage of the Tcl library facility in order to override parts of the implementation. Warning: it is easy to add new Tcl procedures, or to replace whole modules (i.e., files) of the exmh implementation. It is more awkward to override the definition of a single Tcl procedure, as explained below.

By the way, if you do anything interesting to the sources, send the results to exmh-workers@redhat.com so they can be folded back into the master sources. Many of the good features in exmh came about this way.

Even if you do not know Tcl you can probably figure it out as you read through the source. There is not enough room here to talk in any detail about Tcl programming. There are reasonably good on-line manual pages that come with Tcl and Tk. There are books about Tcl, too. John Ousterhout, the creator of Tcl and Tk, has written Tcl and the Tk Toolkit, by Addison-Wesley. I have written Practical Programming in Tcl and Tk, published by Prentice-Hall, ISBN 0-13-616830-2.

Your custom Tcl code is kept in your ~/.tk/exmh directory. You maintain this as a Tcl library, which amounts to keeping a file called tclIndex up-to-date. This index file records which files implement which Tcl procedures. The normal Tcl shells (tclsh and wish) provide a Tcl command auto_mkindex that generates this file for you. Within a Tcl shell you use it like this:

auto_mkindex ~/.tk/exmh *.tcl
The first argument is a directory name, and the second argument is a filename pattern, which is usually *.tcl. If you add a new file or procedure to this directory, remember to update the index by running this command.

The Tcl library facility is used by exmh for the main sources, too. The implementation has been chopped up into over 50 files, and these are loaded on demand as different features of exmh are invoked. The per-user library directory is search first, which means you can replace parts of the exmh implementation. While this is quite flexible, it is not ideal. The natural unit of replacement is a whole file, which might contain several Tcl procedures, even though you only want to change one. See below for an explanation of the patch procedure that lets you modify a main library script file.

NOTE: if you use TclX, then the auto_path stuff is different and the personal library seems not to work. If you figure out the right thing to do in auto_path_update (in the main exmh script), let me know.

In most cases you will merely supply new code as opposed to replacing (i.e., fixing) parts of the implementation. Because you can define buttons and menus that invoke this new code without touching the released sources, you should be able to graft on new functionality somewhat cleanly.

The user.tcl file contains two empty hook procedures, User_Init and User_Layout. User_Init is called early, before most other modules are initialized. User_Layout is called late, just after the widget tree has been created and basically every module initialized.

IMPORTANTYou must supply both User_Init and User_Layout because of the way Tcl auto-loading works. Just copy user.tcl and edit it.

Version 2.0.2 and later support a patching facility. Suppose you want to change the Msg_CompTo procedure in the standard msg.tcl file. You could edit a copy of msg.tcl and put that into your user script library directory. However, then you need to track changes to msg.tcl when new releases come out. Another way is to put the procedure definition into msg.patch and put that file into your script library. Now, enable the "source hook" preference item in Hacking Support and restart exmh. The next time exmh sources msg.tcl from its main library, it will also source the msg.patch file from your private library. Your new definition of Msg_CompTo will replace the standard version.

There are some optional hook procedures with names beginning with Hook_. These procedures are called if they exist, so you do not need stub versions if you don't use them. Because of the way the library facility works, though, you have to include your Hook procedures in your copy of user.tcl or source the file that contains them from inside your User_Init procedure.

In addition, you can have several hook procedures called from the same point by appending things to the standard hook names. That is, the implementation will call all procedures that match the pattern Hook_Foo*, so you could define Hook_FooBrent and Hook_FooWelch and both would be called at the Foo hook point. The hook points are:

Hook_FolderChange $folder
Called after you changed into the named folder.
folderHook(enter,$folder)
folderHook(leave,$folder)
The folderHook array can be used to define enter and leave hooks for a folder. Just set these array elements to be the Tcl commands you want invoked before and after the folder change.
Hook_CheckPoint
Called at Quit time.
Hook_SeditSend $draft
Called as a message is being sent. The argument is the pathname of the draft message. You could frob the message here before it is delivered. If this raises an error, the message is not sent.
Hook_MsgShow $pathname mimeHdr
Called before a message is displayed. The first argument is the pathname of the message file. The second is the name of an array that contains the header information plucked out of the message. Because of multipart messages, the elements of the array look like:
mimeHdr(0=1,hdrs)
Lists all the headers defined in the message. The header keys are downcased (from, to, subject, etc.).
mimeHdr(0=1,hdr,key)
Contains the header line with the given key, e.g. from or subject.

Note that the MsgParseFrom procedure, which is defined in msgShow.tcl, will extract the address part of a header line, so use it as a starting point for your code.

CODE ORGANIZATION

I've tried to split up exmh into meaningful modules, separating out display modules (e.g., fdisp) from those that maintain display-independent data structures (e.g., flist). Things like the Find and Pick dialogs are in their own file, so you can easily replace those. I have not documented the interfaces between modules at all, so you'll have to read some code. Note that the .tcl file names reflect the names of the procedures defined in them so you can locate definitions. In addition, many modules use a single global array to hold their state variables, and this array variable has the same name as the module.

If you are really interested in the internals of exmh (i.e., something about it really bugs you!) you can look into the implementation in order to see what is wrong and how you might do things better. The following is a list of the files in the implementation along with a short explanation of what the Tcl procedures in it are for.

exmh.MASTER
This is the main script. It gets patched with site-dependent information and the results are written to exmh, which gets installed. It doesn't define much because it loads just about everything from the script library.
exmh-bg.MASTER
This is the main script for the background process. It redefines a few procedures, and loads in the rest of its implementation from the library. The initial rendezvous between the background process is implemented in this script and in some supporting routines in background.tcl
install.tcl
These are supporting routines for the installation process. This should be generic enough for use with your own Tcl application. Feel free to borrow it.
exmh.install
This is the installation script for exmh.
exmh-async
This is the wrapper for external editors.

The remainder of the files are kept in the script library.

addr.tcl
A mail address book that can automatically memorize addresses of received mail.
aliases.tcl
A browser for the MH aliases file.
audit.tcl
Maintain an audit log of mail handling operations.
autorefile.tcl
Automatically refiles messages into folders.
background.tcl
The background processing module. This can run in a separate process or as part of the main process. The BgRPC routine is used to invoke a background operation, and it works in either case.
base64.tcl
Base64 encoding utility routines.
bindings.tcl
This has the default bindings and the implementation of the binding user interface.
bogo.tcl
Interface to various Bayesian spam filtering packages.
busy.tcl
Three different ways to indicate that exmh is busy doing something.
buttons.tcl
The resource-based button and menu implementation.
cutbuffer.tcl
A stub for the C cutbuffer extension.
crypt.tcl
Generalized support for multipart/signed and multipart/encrypted messages in exmh.
dragNdrop.tcl
Drag-and-drop for exmh.
editor.tcl
The interface to editors for message composition.
env.tcl
Environment variable initialization.
error.tcl
The error handler.
exec.tcl
A wrapper around the Tcl exec command that caches the locations of executables in the user's search path.
extrasInit.tcl
This has Init routines for optional modules. The idea is to avoid loading their complete implementation until they are actually used.
exwin.tcl
The main window display is set up here. The code that remembers where toplevel windows go is here.
faces.tcl
The interface to the faces database.
fcache.tcl
The folder cache display.
fdisp.tcl
The main folder display.
fdispColor.tcl
The color definitions for the folder display.
fdispPopup.tcl
The nested folder popup implementation.
fileselect.tcl
The file selection dialog.
find.tcl
The find dialog.
flag.tcl
The appearance of the icon is managed here.
flist.tcl
The set of unseen folders is managed by this module.
folder.tcl
Folder operations like Folder_Change and Folder_Commit.
folderNew.tcl
The folder create and delete dialogs.
fontsel.tcl
The font selection dialog.
ftoc.tcl
The scan listing (folder table-of-contents).
ftp_get.tcl
Procedures to retrieve files via FTP.
getnews.tcl
Code to retrieve news via NNTP.
glimpse.tcl
Support code for use with the Glimpse indexing and searching utility.
help.tcl
Some very simple help text and a color key.
html.tcl
Exmh HTML browser. The other html_*.tcl files implement various portions of the functionality of the HTML browser.
import.tcl
Routines to import folders from UCB mail.
inc.tcl
Several ways to incorporate mail.
ispell.tcl
Tcl interactive spell checker, using the ispell utility.
labels.tcl
There are three labels in the display - can you see them?
mailcap.tcl
Routines to parse the mailcap files.
main.tcl
The main Exmh procedure, plus Exmh_Status and Exmh_Debug.
mh.tcl
A basic layer on top of the MH commands.
mime.tcl
The mime display code.
mimeSun.tcl
Support to turn X-sun-attachments into MIME format.
mosaic.tcl
Code to request Mosaic to display an HTML page.
msg.tcl
Message operations - although these tend to be distributed partly among ftoc.tcl and mh.tcl as well.
msgShow.tcl
This used to be the main message display code, but it has become dwarfed by the mime display.
partial.tcl
Code to concatenate the parts of a message/partial MIME message.
pgpBase.tcl
Initialization for PGP support.
pgpEWN.tcl
This implements the PGP function in the external editor What Now dialog.
pgpExec.tcl
This executes the PGP program to get things done.
pgpGpg.tcl
Support code for the Gnu Privacy Guard.
pgpMain.tcl
An interface to the Pretty Good Privacy system.
pgpMatch.tcl
This looks for keys in your keyring.
pgpMisc.tcl
This has the main post-processing hook for messages.
pgpOld.tcl
Somewhat-obsolescent PGP support routines.
pgpPgp2.tcl
Support code for Pretty Good Privacy 2.6.
pgpPgp5.tcl
Support code for Pretty Good Privacy 5.0.
pgpPgp65.tcl
Support code for Pretty Good Privacy 6.5.
pgpShared.tcl
Initialization for PGP support.
pgpWWW.tcl
Support for querying keyservers for public keys via HTTP and HKP.
pick.tcl
An interface to the MH pick program.
pop.tcl
POP3 support for exmh.
post.tcl
News posting client for exmh.
preferences.tcl
The preferences user interface.
print.tcl
Routines to print messages.
ps.tcl
Code to rummage through the process table. OS-specific.
quote.tcl
Quoting support for exmh.
receipt.tcl
Handling of message dispotion notifications (MDNs).
report.tcl
This implements the Bug Report and Register New User forms.
rich2tk.tcl
This parses text/enriched MIME content-types.
scan.tcl
This manages the scan caches.
sedit.tcl
The main routines for the built-in editor.
seditBind.tcl
The keybindings for the built-in editor.
seditCompose.tcl
The mapping for the Compose key sequences that allow input of 8-bit characters.
seditEnriched.tcl
The composition of text/enriched is implemented here.
seditExtras.tcl
More editor stuff, like Whom, Spell, Sign, Find, and the dialogs associated with Insert Part.
seditMime.tcl
The MIME multipart structuring is implemented here.
seditQP.tcl
This is code to handle 8-bit characters via the MIME quoted-printable encoding.
select.tcl
The keyboard selection of folders and messages is implemented here.
sequences.tcl
Routines for handling sequences.
send.tcl
A version of Tk 'send' command that auto-clears the xhost list.
seqwin.tcl
Support for a small window listing sequences by folders.
sound.tcl
Sound effects.
source.tcl
A patching facility for exmh.
text.tcl
Some text tagging routines.
textButton.tcl
An implementation of a pseudo-button in a text widget.
textSelect.tcl
The main guts of text bindings.
thread.tcl
This displays the messages related to the current subject.
tioga.tcl
Support for viewing multipart/x-tioga messages.
uri.tcl
The code that scans messages for URLs.
urlFace.tcl
Retrieve an image from a URL and use it as a face.
user.tcl
Stubs for User_Init and User_Layout.
utils.tcl
Miscellaneous support routines.
widgetMenu.tcl
Support for the popup menus used in MIME messages.
widgetText.tcl
Constrained text scrolling and dragging a selection off the window is handled by the routines here.
widgets.tcl
A basic layer on top of the Tk widgets. These routines integrate the pack geometry manager. Even more important, they guard against errors that occur because of missing fonts. You should try and use these instead of the straight Tk widget commands.
xns.tcl
An interface to xnsgetmail for those folks with mail on an XNS mail server.

AUTHOR

welch@acm.org "Brent Welch"

THANKS

To Xerox PARC/CSL, for supporting this work initially, to Sun Microsystems Laboratories for continuing the support, and to all the exmh users that contributed ideas and code.
exmh | software | intro | faq | guide | reference ]