www.delorie.com/gnu/docs/emacs/mh-e_48.html   search  
Buy the book!


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.1.1 Viewing Your Mail

Several variables control what displayed messages look like. Normally messages are delivered with a handful of uninteresting header fields. You can make them go away by setting mh-clean-message-header to a non-nil value. The header can then be cleaned up in two ways. By default, the header fields in mh-invisible-headers are removed. On the other hand, you could set mh-visible-headers to the fields that you would like to see. If this variable is set, mh-invisible-headers is ignored. I suggest that you not set mh-visible-headers since if you use this variable, you might miss a lot of header fields that you'd rather not miss. As an example of how to set a string variable, mh-visible-headers can be set to show a minimum set of header fields (see (section `Syntax of Regular Expressions' in The GNU Emacs Manual, for a description of the special characters in this string):

(setq mh-visible-headers "^From: \\|^Subject: \\|^Date: ")

Normally mh-e takes care of displaying messages itself (rather than calling an MH program to do the work). If you'd rather have mhl display the message (within mh-e), set the variable mhl-formfile to a non-nil value. You can set this variable either to t to use the default format file or to a filename if you have your own format file (mhl(1) tells you how to write one). When writing your own format file, use a nonzero value for overflowoffset to ensure the header is RFC 822 compliant and parsable by mh-e. mhl is always used for printing and forwarding; in this case, the value of mhl-formfile is consulted if it is a filename.

Two hooks can be used to control how messages are displayed. The first hook, mh-show-mode-hook, is called early on in the process of displaying of messages. It is used to perform some actions on the contents of messages, such as highlighting the header fields. If you're running Emacs 19 under the X Window System, the following example will highlight the `From:' and `Subject:' header fields. This is a very nice feature indeed.

Emphasize header fields in different fonts via mh-show-mode-hook

(defvar my-mh-keywords
   '(("^From: \\(.*\\)" 1 'bold t)
     ("^Subject: \\(.*\\)" 1 'highlight t))
  "mh-e additions for font-lock-keywords.")

(defun my-mh-show-mode-hook ()
  "Hook to turn on and customize fonts."
  (font-lock-add-keywords nil my-mh-keywords))

(add-hook 'mh-show-mode-hook 'my-mh-show-mode-hook))

The second hook, mh-show-hook, is the last thing called after messages are displayed. It's used to affect the behavior of mh-e in general or when mh-show-mode-hook is too early. For example, if you wanted to keep mh-e in sync with MH, you could use mh-show-hook as follows:

(add-hook 'mh-show-hook 'mh-update-sequences)

The function mh-update-sequences is documented in 2.4.6 Finishing Up. For those who like to modify their mode lines, use mh-show-buffer-mode-line-buffer-id to modify the mode line in the MH-Show buffers. Place the two escape strings `%s' and `%d', which will display the folder name and the message number, respectively, somewhere in the string in that order. The default value of `"{show-%s} %d"' yields a mode line of

-----{show-+inbox} 4      (MH-Show)--Bot--------------------------------

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

  webmaster   donations   bookstore     delorie software   privacy  
  Copyright 2003   by The Free Software Foundation     Updated Jun 2003