Note: HTML conversion may not be complete.
You may wish to add the following useful key bindings to your .emacs file:
(global-set-key "\C-xm" 'mh-smail) (global-set-key "\C-x4m" 'mh-smail-other-window)In addition, several variables are useful when sending mail or replying to mail. They are summarized in the following table.
Variable | Default | Description ____________________________|__________________|_________________ mh-comp-formfile | "components" | Format file for | | drafts mh-repl-formfile | "replcomps" | Format file for | | replies mh-letter-mode-hook | nil | Functions to | | run in MH- | | Letter mode mh-compose-letter-function | nil | Functions to | | run when start- | | ing a new draft mh-reply-default-reply-to | nil | Whom reply goes | | to mh-forward-subject-format | "%s: %s" | Format string | | for forwarded | | message subject mh-redist-full-contents | nil | send requires | | entire message mh-new-draft-cleaned-headers| "^Date:\\| | Remove these | ^Received:\\| | header fields | ^Message-Id:\\| | from re-edited | ^From:\\| | draft | ^Sender:\\| | | ^Delivery- | | Date:\\| | | ^Return-Path:" | ____________________________|__________________|_________________Since mh-e does not use comp to create the initial draft, you need to set mh-comp-formfile to the name of your components file if it isn't components. This is the name of the file that contains the form for composing messages. If it does not contain an absolute pathname, mh-e searches for the file first in your MH directory and then in the system MH library directory (such as /usr/local/lib/mh). Replies, on the other hand, are built using repl. You can change the location of the field file from the default of replcomps by modifying mh-repl-formfile.
Two hooks are provided to run commands on your freshly created draft. The first hook, mh-letter-mode-hook, allows you to do some processing before editing a letter. For example, you may wish to modify the header after repl has done its work, or you may have a complicated components file and need to tell mh-e where the cursor should go. Here's an example of how you would use this hook -- all of the other hooks are set in this fashion as well.
Example: Prepare draft for editing via mh-letter-mode-hook
(defvar letter-mode-init-done nil "Non-nil when one-time mh-e settings have made.") (defun my-mh-letter-mode-hook () "Hook to prepare letter for editing." (if (not letter-mode-init-done) ; only need to bind the keys once (progn ;; add-enriched-text defined in the Example Emacs macros for entering enriched text (local-set-key "\C-c\C-tb" 'add-enriched-text) (local-set-key "\C-c\C-ti" 'add-enriched-text) (local-set-key "\C-c\C-tf" 'add-enriched-text) (local-set-key "\C-c\C-ts" 'add-enriched-text) (local-set-key "\C-c\C-tB" 'add-enriched-text) (local-set-key "\C-c\C-tu" 'add-enriched-text) (local-set-key "\C-c\C-tc" 'add-enriched-text) (setq letter-mode-init-done t))) (setq fill-prefix " ") ; I find indented text easier to read (goto-char (point-max)) ; go to end of message to (mh-insert-signature) ; insert signature (beginning-of-buffer) ; go to beginning of message ;;; Emacs 19 (search-forward-regexp "^$")) ; and then past header ;;; Emacs 18 ;;; (re-search-forward "^$")) (add-hook 'mh-letter-mode-hook 'my-mh-letter-mode-hook)If you're using Emacs 18, remove the triple semicolons (;;;) from that line and add them to the start of the line for Emacs 19. The second hook, actually a function, is mh-compose-letter-function. Like mh-letter-mode-hook, it is called just before editing a new message; however, it is the last function called before you edit your message. The consequence of this is that you can write a function to write and send the message for you. This function is passed three arguments: the contents of the To:, Subject:, and cc: header fields.
To: Bill Wohler <wohler@newt.com> Subject: Re: 49er football From: Greg DesBrisay <gd@cellnet.com>and creates a subject header field of:
Subject: Greg DesBrisay: Re: 49er football
If you find that MH will not allow you to redistribute a message that has been redistributed before, this variable should be set to nil.
(setq mh-new-draft-cleaned-headers (concat mh-new-draft-cleaned-headers "\\|^Some-Field:"))This appends the regular expression \\|^Some-Field: to the variable. The \\| means or, and the ^ (caret) matches the beginning of the line. This is done to be very specific about which fields match. The literal ":" is appended for the same reason.
(To find out more about Emacs' regular expressions, use Info from within Emacs. Type C-h i m emacs RET m regexps RET to get to the right page.)
[Table of Contents] [Index] [Previous: Reading Your Mail] [Next: Editing a Draft]
This file is from the third edition of the book MH & xmh: Email for Users & Programmers, ISBN 1-56592-093-7, by Jerry Peek. Copyright © 1991, 1992, 1995 by O'Reilly & Associates, Inc. This file is freely-available; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation. For more information, see the file copying.htm.
Suggestions are welcome: Bill Wohler <wohler@newt.com>