head 1.4; access; symbols; locks; strict; comment @# @; 1.4 date 2006.05.29.14.31.25; author jpeek; state Exp; branches; next 1.3; 1.3 date 2006.05.28.04.27.15; author jpeek; state Exp; branches; next 1.2; 1.2 date 2006.05.26.23.59.01; author jpeek; state Exp; branches; next 1.1; 1.1 date 2006.05.26.22.12.08; author jpeek; state Exp; branches; next ; desc @mh-e_47.html page from mh-e section of "MH & nmh: Email for Users & Programmers" @ 1.4 log @Removed 'html/' from end of http://mh-e.sourceforge.net/manual/html/ URLs @ text @ BOOK MOVED: mh-e - Customizing Reading

BOOK MOVED: mh-e - Customizing Reading

This section of MH & nmh: Email for Users & Programmers is now the MH-E Manual. It's moved to http://mh-e.sourceforge.net/manual/.

If you aren't taken to the new site in 15 seconds, please click on the link above.

You may also want to visit:


Last change $Date: 2006/05/28 04:27:15 $
Suggestions are welcome: Bill Wohler <wohler@@newt.com>
@ 1.3 log @removed 'Tour-Through-MH_002dE.html' from end of http://mh-e.sourceforge.net/manual/html/ @ text @d4 1 a4 1 content="15;URL=http://mh-e.sourceforge.net/manual/html/"> d15 2 a16 2 href="http://mh-e.sourceforge.net/manual/html/"> http://mh-e.sourceforge.net/manual/html/. d39 1 a39 1 Last change $Date: 2006/05/26 23:59:01 $ @ 1.2 log @Replaced with page pointing people to new MH-E Manual @ text @d4 1 a4 1 content="15;URL=http://mh-e.sourceforge.net/manual/html/Tour-Through-MH_002dE.html"> d15 2 a16 2 href="http://mh-e.sourceforge.net/manual/html/Tour-Through-MH_002dE.html"> http://mh-e.sourceforge.net/manual/html/Tour-Through-MH_002dE.html. d39 1 a39 1 Last change $Date: 2006/05/26 22:12:05 $ @ 1.1 log @Original version from Feb 19 2001 @ text @d3 2 d7 39 a45 257 mh-e - Customizing Reading Go to the first, previous, next, last section, table of contents.


Reading Your Mail

I'll start out by including a function that I use as a front end to mh-e. (15) It toggles between your working window configuration, which may be quite involved--windows filled with source, compilation output, man pages, and other documentation--and your mh-e window configuration. Like the rest of the customization described in this chapter, simply add the following code to `~/.emacs'. Don't be intimidated by the size of this example; most customizations are only one line.

Starting mh-e

(defvar my-mh-screen-saved nil
  "Set to non-nil when mh-e window configuration shown.")
(defvar my-normal-screen nil "Normal window configuration.")
(defvar my-mh-screen nil "mh-e window configuration.")

(defun my-mh-rmail (&optional arg)
  "Toggle between mh-e and normal screen configurations.
With non-nil or prefix argument, inc mailbox as well
when going into mail."
  (interactive "P")                 ; user callable function, P=prefix arg
  (setq my-mh-screen-saved          ; save state
        (cond
         ;; Bring up mh-e screen if arg or normal window configuration.
         ;; If arg or +inbox buffer doesn't exist, run mh-rmail.
         ((or arg (null my-mh-screen-saved))
          (setq my-normal-screen (current-window-configuration))
          (if (or arg (null (get-buffer "+inbox")))
              (mh-rmail)
            (set-window-configuration my-mh-screen))
          t)                        ; set my-mh-screen-saved to t
         ;; Otherwise, save mh-e screen and restore normal screen.
         (t
          (setq my-mh-screen (current-window-configuration))
          (set-window-configuration my-normal-screen)
          nil))))                   ; set my-mh-screen-saved to nil

(global-set-key "\C-x\r" 'my-mh-rmail)  ; call with C-x RET

If you type an argument (C-u) or if my-mh-screen-saved is nil (meaning a non-mh-e window configuration), the current window configuration is saved, either +inbox is displayed or mh-rmail is run, and the mh-e window configuration is shown. Otherwise, the mh-e window configuration is saved and the original configuration is displayed.

Now to configure mh-e. The following table lists general mh-e variables and variables that are used while reading mail.

mh-progs
Directory containing MH programs (default: dynamic).
mh-lib
Directory containing MH support files and programs (default: dynamic).
mh-do-not-confirm
Don't confirm on non-reversible commands (default: nil).
mh-summary-height
Number of scan lines to show (includes mode line) (default: 4).
mh-folder-mode-hook
Functions to run in MH-Folder mode (default: nil).
mh-clean-message-header
Remove extraneous headers (default: nil).
mh-invisible-headers
Headers to hide (default: `"^Received: \\| ^Message-Id: \\| ^Remailed-\\| ^Via: \\| ^Mail-from: \\| ^Return-Path: \\| ^In-Reply-To: \\| ^Resent-"').
mh-visible-headers
Headers to display (default: nil).
mhl-formfile
Format file for mhl (default: nil).
mh-show-hook
Functions to run when showing message (default: nil).
mh-show-mode-hook
Functions to run when showing message (default: nil).
mh-bury-show-buffer
Leave show buffer at bottom of stack (default: t).
mh-show-buffer-mode-line-buffer-id
Name of show buffer in mode line (default: `"{show-%s} %d"').

The two variables mh-progs and mh-lib are used to tell mh-e where the MH programs and supporting files are kept, respectively. mh-e does try to figure out where they are kept for itself by looking in common places and in the user's `PATH' environment variable, but if it cannot find the directories, or finds the wrong ones, you should set these variables. The name of the directory should be placed in double quotes, and there should be a trailing slash (`/'). See the example in section Getting Started.

If you never make mistakes, and you do not like confirmations for your actions, you can set mh-do-not-confirm to a non-nil value to disable confirmation for unrecoverable commands such as M-k (mh-kill-folder) and M-u (mh-undo-folder). Here's how you set boolean values:

(setq mh-do-not-confirm t)

The variable mh-summary-height controls the number of scan lines displayed in the MH-Folder window, including the mode line. The default value of 4 means that 3 scan lines are displayed. Here's how you set numerical values:

(setq mh-summary-height 2)              ; only show the current scan line

Normally the buffer for displaying messages is buried at the bottom at the buffer stack. You may wish to disable this feature by setting mh-bury-show-buffer to nil. One advantage of not burying the show buffer is that one can delete the show buffer more easily in an electric buffer list because of its proximity to its associated MH-Folder buffer. Try running M-x electric-buffer-list to see what I mean.

The hook mh-folder-mode-hook is called when a new folder is created with MH-Folder mode. This could be used to set your own key bindings, for example:

Create additional key bindings via mh-folder-mode-hook

(defvar my-mh-init-done nil "Non-nil when one-time mh-e settings made.")

(defun my-mh-folder-mode-hook ()
  "Hook to set key bindings in MH-Folder mode."
  (if (not my-mh-init-done)             ; only need to bind the keys once 
      (progn
        (local-set-key "/" 'search-msg)
        (local-set-key "b" 'mh-burst-digest)    ; better use of b
        (setq my-mh-init-done t))))

;;; Emacs 19
(add-hook 'mh-folder-mode-hook 'my-mh-folder-mode-hook)
;;; Emacs 18
;;;   (setq mh-folder-mode-hook (cons 'my-mh-folder-mode-hook
;;;                               mh-folder-mode-hook))

(defun search-msg ()
  "Search for a regexp in the current message."
  (interactive)                         ; user function
  (save-window-excursion
    (other-window 1)                    ; go to next window
    (isearch-forward-regexp)))          ; string search; hit return (ESC
                                        ;   in Emacs 18) when done


Go to the first, previous, next, last section, table of contents. @