1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156
|
<html lang="en">
<head>
<title>Composing - The MH-E Manual</title>
<meta http-equiv="Content-Type" content="text/html">
<meta name="description" content="The MH-E Manual">
<meta name="generator" content="makeinfo 4.8">
<link title="Top" rel="start" href="index.html#Top">
<link rel="up" href="Sending-Mail.html#Sending-Mail" title="Sending Mail">
<link rel="prev" href="Sending-Mail.html#Sending-Mail" title="Sending Mail">
<link rel="next" href="Replying.html#Replying" title="Replying">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<!--
This is version 8.0.3 of `The MH-E
Manual', last updated 2006-11-12.
Copyright (C) 1995, 2001, 2002, 2003, 2005, 2006 Free
Software Foundation, Inc.
The MH-E manual is free documentation; you can redistribute it
and/or modify it under the terms of either:
a. the GNU Free Documentation License, Version 1.2 or any later
version published by the Free Software Foundation; with no
Invariant Sections, no Front-Cover Texts, and no Back-Cover
Texts.
b. the GNU General Public License as published by the Free
Software Foundation; either version 2, or (at your option)
any later version.
The MH-E manual is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License or GNU Free Documentation License for more
details.
The GNU General Public License and the GNU Free Documentation
License appear as appendices to this document. You may also
request copies by writing to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-->
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
pre.display { font-family:inherit }
pre.format { font-family:inherit }
pre.smalldisplay { font-family:inherit; font-size:smaller }
pre.smallformat { font-family:inherit; font-size:smaller }
pre.smallexample { font-size:smaller }
pre.smalllisp { font-size:smaller }
span.sc { font-variant:small-caps }
span.roman { font-family:serif; font-weight:normal; }
span.sansserif { font-family:sans-serif; font-weight:normal; }
--></style>
</head>
<body>
<div class="node">
<p>
<a name="Composing"></a>
Next: <a rel="next" accesskey="n" href="Replying.html#Replying">Replying</a>,
Previous: <a rel="previous" accesskey="p" href="Sending-Mail.html#Sending-Mail">Sending Mail</a>,
Up: <a rel="up" accesskey="u" href="Sending-Mail.html#Sending-Mail">Sending Mail</a>
<hr>
</div>
<h3 class="section">8.1 Composing</h3>
<p><a name="index-g_t_0040file_007b_002eemacs_007d-1017"></a><a name="index-MH_002dFolder-mode-1018"></a><a name="index-composing-mail-1019"></a><a name="index-draft-1020"></a><a name="index-files_002c-_0040file_007b_002eemacs_007d-1021"></a><a name="index-modes_002c-MH_002dFolder-1022"></a><a name="index-sending-mail-1023"></a><a name="index-mh_002dsmail-1024"></a><a name="index-mh_002dsmail_002dother_002dwindow-1025"></a><a name="index-M_002dx-mh_002dsmail-1026"></a><a name="index-M_002dx-mh_002dsmail_002dother_002dwindow-1027"></a>
Outside of an MH-Folder buffer, you must call either <kbd>M-x
mh-smail</kbd> or <kbd>M-x mh-smail-other-window</kbd> to compose a new message.
The former command always creates a two-window layout with the current
buffer on top and the draft on the bottom. Use the latter command if
you would rather preserve the window layout. You may find adding the
following key bindings to <samp><span class="file">~/.emacs</span></samp> useful:
<pre class="smalllisp"> (global-set-key "\C-xm" 'mh-smail)
(global-set-key "\C-x4m" 'mh-smail-other-window)
</pre>
<p><a name="index-draft-folder-1028"></a><a name="index-MH_002dLetter-mode-1029"></a><a name="index-modes_002c-MH_002dLetter-1030"></a><a name="index-mh_002dsend-1031"></a><a name="index-m-1032"></a>
From within a MH-Folder buffer, you can simply use the command <kbd>m</kbd>
(<code>mh-send</code>). However you invoke <code>mh-send</code>, your letter
appears in an Emacs buffer whose mode is MH-Letter (to see what the
buffer looks like, see <a href="Sending-Mail-Tour.html#Sending-Mail-Tour">Sending Mail Tour</a>). MH-Letter mode allows
you to edit your message, to check the validity of the recipients, to
insert attachments and other messages into your message, and to send
the message. We'll go more into depth about editing a
<dfn>draft</dfn><a rel="footnote" href="#fn-1" name="fnd-1"><sup>1</sup></a> (a
message you're composing) in just a moment (see <a href="Editing-Drafts.html#Editing-Drafts">Editing Drafts</a>).
<p><a name="index-mh_002dcompose_002dprompt_002dflag-1033"></a>
If you prefer to be prompted for the recipient and subject fields
before the MH-Letter buffer appears, turn on the option
<code>mh-compose-prompt-flag</code>.
<p><a name="index-header-field_002c-_0040samp_007bX_002dMailer_003a_007d-1034"></a><a name="index-g_t_0040samp_007bX_002dMailer_003a_007d-header-field-1035"></a><a name="index-mh_002dinsert_002dx_002dmailer_002dflag-1036"></a>
MH-E adds an `<samp><span class="samp">X-Mailer:</span></samp>' header field to the header that includes
the version of MH-E and Emacs that you are using. If you don't want to
participate in our marketing, you can turn off the option
<code>mh-insert-x-mailer-flag</code>.
<p><a name="index-g_t_0040command_007brepl_007d-1037"></a><a name="index-g_t_0040file_007bcomponents_007d-1038"></a><a name="index-MH-commands_002c-_0040command_007brepl_007d-1039"></a><a name="index-MH_002dLetter-mode-1040"></a><a name="index-Mail-mode-1041"></a><a name="index-files_002c-_0040file_007bcomponents_007d-1042"></a><a name="index-modes_002c-MH_002dLetter-1043"></a><a name="index-modes_002c-Mail-1044"></a><a name="index-mail_002dmode_002dhook-1045"></a><a name="index-mh_002dletter_002dmode_002dhook-1046"></a><a name="index-text_002dmode_002dhook-1047"></a>
Two hooks are provided to run commands on your freshly created draft.
The first hook, <code>mh-letter-mode-hook</code>, allows you to do some
processing before editing a letter<a rel="footnote" href="#fn-2" name="fnd-2"><sup>2</sup></a>. For example, you may wish
to modify the header after <samp><span class="command">repl</span></samp> has done its work, or you
may have a complicated <samp><span class="file">components</span></samp> file and need to tell MH-E
where the cursor should go. Here's an example of how you would use
this hook.
<p><a name="index-mh_002dinsert_002dsignature_002c-example-1048"></a>
<pre class="smalllisp"> (defvar letter-mode-init-done-flag nil
"Non-nil means one-time MH-E settings have been made.")
(defun my-mh-letter-mode-hook ()
"Prepare letter for editing."
(when (not letter-mode-init-done) ; <span class="roman">only need to bind the keys once</span>
(local-set-key "\C-ctb" 'add-enriched-text)
(local-set-key "\C-cti" 'add-enriched-text)
(local-set-key "\C-ctf" 'add-enriched-text)
(local-set-key "\C-cts" 'add-enriched-text)
(local-set-key "\C-ctB" 'add-enriched-text)
(local-set-key "\C-ctu" 'add-enriched-text)
(local-set-key "\C-ctc" 'add-enriched-text)
(setq letter-mode-init-done t))
(save-excursion
(goto-char (point-max)) ; <span class="roman">go to end of message to</span>
(mh-insert-signature))) ; <span class="roman">insert signature</span>
<i>Prepare draft for editing via mh-letter-mode-hook</i>
</pre>
<p>The function, <code>add-enriched-text</code> is defined in the example in
<a href="Adding-Attachments.html#Adding-Attachments">Adding Attachments</a>.
<p><a name="index-mh_002dcompose_002dletter_002dfunction-1049"></a><a name="index-mh_002dletter_002dmode_002dhook-1050"></a>
The second hook, a function really, is
<code>mh-compose-letter-function</code>. Like <code>mh-letter-mode-hook</code>, 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
`<samp><span class="samp">To:</span></samp>', `<samp><span class="samp">Subject:</span></samp>', and `<samp><span class="samp">Cc:</span></samp>' header fields.
<div class="footnote">
<hr>
<h4>Footnotes</h4><p class="footnote"><small>[<a name="fn-1" href="#fnd-1">1</a>]</small> I highly recommend that you use a <dfn>draft
folder</dfn> so that you can edit several drafts in parallel. To do so,
create a folder named `<samp><span class="samp">+drafts</span></samp>' for example, and add the profile
component `<samp><span class="samp">Draft-Folder: drafts</span></samp>' (see <code>mh-profile</code>(5)).</p>
<p class="footnote"><small>[<a name="fn-2" href="#fnd-2">2</a>]</small> Actually, because
MH-Letter mode inherits from Mail mode, the hooks
<code>text-mode-hook</code> and <code>mail-mode-hook</code> are run (in that
order) before <code>mh-letter-mode-hook</code>.</p>
<p><hr></div>
</body></html>
|