]> code.delx.au - gnu-emacs/blob - man/mh-e.texi
Spelling correction.
[gnu-emacs] / man / mh-e.texi
1 \input texinfo @c -*-texinfo-*-
2 @c $Id: mh-e.texi,v 1.11 2001/05/19 09:21:27 eliz Exp $
3 @c %**start of header
4 @setfilename ../info/mh-e
5 @settitle mh-e
6 @c %**end of header
7
8 @setchapternewpage odd
9
10 @dircategory Emacs
11 @direntry
12 * MH-E: (mh-e). Emacs interface to the MH mail system.
13 @end direntry
14
15 @c Version variables.
16 @set EDITION 1.3
17 @set VERSION 5.0.2
18 @set UPDATED 18 February 2001
19 @set UPDATE-MONTH February 2001
20
21 @ifinfo
22 This is Edition @value{EDITION}, last updated @value{UPDATED}, of
23 @cite{mh-e, The Emacs Interface to MH}, for mh-e, Version
24 @value{VERSION}.
25
26 Copyright 1995, 2001 Free Software Foundation, Inc.
27
28 Permission is granted to copy, distribute and/or modify this document
29 under the terms of the GNU Free Documentation License, Version 1.1 or
30 any later version published by the Free Software Foundation; with no
31 Invariant Sections, with the Front-Cover texts being ``A GNU
32 Manual'', and with the Back-Cover Texts as in (a) below. A copy of the
33 license is included in the section entitled ``GNU Free Documentation
34 License'' in the Emacs manual.
35
36 (a) The FSF's Back-Cover Text is: ``You have freedom to copy and modify
37 this GNU Manual, like GNU software. Copies published by the Free
38 Software Foundation raise funds for GNU development.''
39
40 This document is part of a collection distributed under the GNU Free
41 Documentation License. If you want to distribute this document
42 separately from the collection, you can do so by adding a copy of the
43 license to the document, as described in section 6 of the license.
44 @end ifinfo
45
46 @titlepage
47 @sp 10
48 @center @titlefont{mh-e}
49 @sp 2
50 @center The Emacs Interface to MH
51 @sp 2
52 @center by Bill Wohler
53 @sp 2
54 @center Edition @value{EDITION} for mh-e Version @value{VERSION}
55 @sp 2
56 @center @value{UPDATE-MONTH}
57
58 @page
59 @vskip 0pt plus 1filll
60 Copyright @copyright{} 1995, 2001 Free Software Foundation, Inc.
61
62 Permission is granted to copy, distribute and/or modify this document
63 under the terms of the GNU Free Documentation License, Version 1.1 or
64 any later version published by the Free Software Foundation; with no
65 Invariant Sections, with the Front-Cover texts being ``A GNU
66 Manual'', and with the Back-Cover Texts as in (a) below. A copy of the
67 license is included in the section entitled ``GNU Free Documentation
68 License'' in the Emacs manual.
69
70 (a) The FSF's Back-Cover Text is: ``You have freedom to copy and modify
71 this GNU Manual, like GNU software. Copies published by the Free
72 Software Foundation raise funds for GNU development.''
73
74 This document is part of a collection distributed under the GNU Free
75 Documentation License. If you want to distribute this document
76 separately from the collection, you can do so by adding a copy of the
77 license to the document, as described in section 6 of the license.
78 @end titlepage
79
80 @ifinfo
81 @node Top, Preface, (dir), (dir)
82 @top MH and Emacs
83 This is Edition @value{EDITION} of @cite{mh-e, The Emacs Interface to
84 MH}, last updated @value{UPDATED} for mh-e Version @value{VERSION}.
85
86 @menu
87 * Preface:: Introduction to mh-e.
88 * Tour Through mh-e:: Use mh-e quickly!
89 * Using mh-e:: Documentation for all commands.
90 * Customizing mh-e:: Documentation for all variables.
91 * Odds and Ends:: Getting mh-e, reporting bugs, mailing
92 list and FAQ.
93 * History:: The authors speak up!
94 * Copying:: The GNU General Public License
95 * Command Index::
96 * Variable Index::
97 * Concept Index::
98 @end menu
99 @end ifinfo
100
101 @node Preface, Tour Through mh-e, Top, Top
102 @unnumbered Preface
103
104 @cindex Emacs
105 @cindex Unix commands, Emacs
106
107 These chapters introduce another interface to MH that is accessible
108 through the GNU Emacs editor, namely, @emph{mh-e}. mh-e is easy to use.
109 I don't assume that you know GNU Emacs or even MH at this point, since I
110 didn't know either of them when I discovered mh-e. However, mh-e was
111 the tip of the iceberg, and I discovered more and more niceties about
112 GNU Emacs and MH@. Now I'm fully hooked on both of them.
113
114 @cindex history
115
116 The mh-e package is distributed with GNU Emacs, @footnote{Note that
117 mh-e is supported with MH 6 and @w{Emacs 18} through @w{Emacs 21}.
118 Reportedly, large parts of it work with @w{MH 5} and also with
119 Lucid/XEmacs and Epoch, but there are no guarantees. It is also
120 distributed with Lucid/XEmacs, as well as with MH itself.} so you
121 shouldn't have to do anything special to use it. But it's important to
122 note a brief history of mh-e. @w{Version 3} was prevalent through the
123 @w{Emacs 18} and early @w{Emacs 19} years. Then @w{Version 4} came out
124 (@w{Emacs 19.23}), which introduced several new and changed commands.
125 Finally, @w{Version 5.0} was released, which fixed some bugs and
126 incompatibilities, and was incorporated into @w{Emacs 19.29}. This is
127 the version covered by this manual. @ref{Getting Started} will help
128 you decide which version you have.
129
130 If you don't already use GNU Emacs but want to learn more, you can read
131 an online tutorial by starting GNU Emacs and typing @kbd{C-h t}
132 (@code{help-with-tutorial}). (This notation is described in
133 @ref{Conventions}.) If you want to take the plunge, consult the
134 @iftex
135 @cite{GNU Emacs Manual},
136 @end iftex
137 @ifinfo
138 @ref{top, , GNU Emacs Manual, emacs, The GNU Emacs Manual},
139 @end ifinfo
140 from the Free Software Foundation.
141
142 If more information is needed, you can go to the Unix manual pages of
143 the individual MH commands. When the name is not obvious, I'll guide
144 you to a relevant MH manual page that describes the action more fully.
145
146 I hope you enjoy these chapters! If you have any comments, or
147 suggestions for this document, please let me know.
148
149 @noindent
150 Bill Wohler <@i{wohler@@newt.com}>@*
151 8 February 1995
152
153 @node Tour Through mh-e, Using mh-e, Preface, Top
154 @chapter Tour Through mh-e
155
156 This chapter introduces some of the terms you'll need to know and then
157 takes you on a tour of mh-e. @footnote{The keys mentioned in these
158 chapters refer to the default key bindings. If you've changed the
159 bindings, refer to the command summaries at the beginning of each major
160 section in @ref{Using mh-e}, for a mapping between default key bindings
161 and function names.} When you're done, you'll be able to send, read,
162 and file mail, which is all that a lot of people ever do. But if you're
163 the curious type, you'll read @ref{Using mh-e} to be able to use all
164 the features of mh-e. If you're the adventurous type, you'll read
165 @ref{Customizing mh-e} to make mh-e do what you want. I suggest you
166 read this chapter first to get the big picture, and then you can read
167 the other two as you wish.
168
169 @menu
170 * Conventions:: GNU Emacs Terms and Conventions
171 * Getting Started::
172 * Sending Mail Tour::
173 * Reading Mail Tour::
174 * Processing Mail Tour::
175 * Leaving mh-e::
176 * More About mh-e::
177 @end menu
178
179 @node Conventions, Getting Started, Tour Through mh-e, Tour Through mh-e
180 @section GNU Emacs Terms and Conventions
181
182 @cindex Emacs, terms and conventions
183
184 @cindex Emacs
185 @cindex Unix commands, Emacs
186
187 If you're an experienced Emacs user, you can skip the following
188 conventions and definition of terms and go directly to @ref{Getting
189 Started} below. The conventions are as follows:
190
191 @table @kbd
192 @item C-x
193 Hold down the @key{CTRL} (Control) key and press the @kbd{x} key.
194 @item M-x
195 Hold down the @key{META} or @key{ALT} key and press the @kbd{x} key.
196
197 Since some keyboards don't have a @key{META} key, you can generate
198 @kbd{M-x}, for example, by pressing @key{ESC} (Escape), @emph{releasing
199 it}, @footnote{This is emphasized because pressing ESC twice or holding
200 it down a second too long so that it repeats gives you an error message.}
201 and then pressing the @kbd{x} key.
202 @item RET
203 Press the @key{RETURN} or @key{ENTER} key. This is normally used to
204 complete a command.
205 @item SPC
206 Press the space bar.
207 @item TAB
208 Press the @key{TAB} key.
209 @item DEL
210 Press the @key{DELETE} key.
211 @item BS
212 Press the @key{BACKSPACE} key. @footnote{If you are using Version 20
213 or earlier of Emacs, you will need to use the @key{DEL} key.}
214 @end table
215
216 @cindex Emacs, prefix argument
217 @cindex prefix argument
218
219 A @dfn{prefix argument} allows you to pass an argument to any Emacs
220 function. To pass an argument, type @kbd{C-u} before the Emacs command
221 or keystroke. Numeric arguments can be passed as well. For example, to
222 insert five f's, use @kbd{C-u 5 f}. There is a default of four when
223 using @kbd{C-u}, and you can use multiple prefix arguments to provide
224 arguments of powers of four. To continue our example, you could insert
225 four f's with @kbd{C-u f}, 16 f's with @kbd{C-u C-u f}, 64 f's with
226 @kbd{C-u C-u C-u f}, and so on. Numeric and valueless negative
227 arguments can also be inserted with the @key{META} key. Examples
228 include @kbd{M-5} to specify an argument of 5, or @kbd{M--} which
229 specifies a negative argument with no particular value.
230
231 @sp 2
232 @need 1000
233 @center @strong{NOTE}
234
235 @quotation
236 The prefix @kbd{C-u} or @kbd{M-} is not necessary in mh-e's MH-Folder
237 modes (@pxref{Reading Mail Tour}). In these modes, simply enter the
238 numerical argument before entering the command.
239 @end quotation
240
241 @cindex point
242 @cindex Emacs, point
243 @cindex mark
244 @cindex Emacs, mark
245 @cindex region
246 @cindex Emacs, region
247
248 There are several other terms that are used in Emacs that you should
249 know. The @dfn{point} is where the cursor currently is. You can save
250 your current place in the file by setting a @dfn{mark}. This operation
251 is useful in several ways. The mark can be later used when defining a
252 @dfn{region}, which is the text between the point and mark. Many
253 commands operate on regions, such as those for deleting text or filling
254 paragraphs. A mark can be set with @kbd{C-@@} (or @kbd{C-SPC}).
255
256 @cindex minibuffer
257 @cindex Emacs, minibuffer
258 @cindex file completion
259 @cindex Emacs, file completion
260
261 The @dfn{minibuffer} is the bottom line of the Emacs window, where all
262 prompting and multiple-character input is directed. If you are prompted
263 for information in the minibuffer, such as a filename, Emacs can help
264 you complete your answer if you type @key{SPC} or @key{TAB}. A second
265 @key{SPC} or @key{TAB} will list all possibilities at that point. The
266 minibuffer is also where you enter Emacs function names after typing
267 @kbd{M-x}. For example, in the first paragraph, I mentioned that you
268 could obtain help with @kbd{C-h t} (@code{help-with-tutorial}). What
269 this means is that you can get a tutorial by typing either @kbd{C-h t}
270 or @kbd{M-x help-with-tutorial}. In the latter case, you are prompted
271 for @samp{help-with-tutorial} in the minibuffer after typing @kbd{M-x}.
272
273 @cindex interrupting
274 @cindex Emacs, interrupting
275 @cindex quitting
276 @cindex Emacs, quitting
277
278 @i{In case of trouble:} Emacs can be interrupted at any time with
279 @kbd{C-g}. For example, if you've started a command that requests that
280 you enter something in the minibuffer, but then you change your mind,
281 type @kbd{C-g} and you'll be back where you started. If you want to
282 exit Emacs entirely, use @kbd{C-x C-c}.
283
284 @node Getting Started, Sending Mail Tour, Conventions, Tour Through mh-e
285 @section Getting Started
286
287 Because there are many old versions of mh-e out there, it is important to
288 know which version you have. I'll be talking about @w{Version 5} which
289 is similar to @w{Version 4} and vastly different from @w{Version 3}.
290
291 First, enter @kbd{M-x load-library @key{RET} mh-e
292 @key{RET}}. @footnote{You wouldn't ordinarily do this.} The message,
293 @samp{Loading mh-e...done}, should be displayed in the minibuffer. If
294 you get @samp{Cannot open load file: mh-e}, then your Emacs is very
295 badly configured, or mh-e is missing. You may wish to have your system
296 administrator install a new Emacs or at least the latest mh-e files.
297
298 Having loaded mh-e successfully, enter @kbd{M-x mh-version @key{RET}}.
299 The version of mh-e should be displayed. Hopefully it says that you're
300 running @w{Version @value{VERSION}} which is the latest version as of
301 this printing. If instead Emacs beeps and says @samp{[No match]}, then
302 you're running an old version of mh-e.
303
304 If these tests reveal a non-existent or old version of mh-e, please
305 consider obtaining a new version. You can have your system
306 administrator upgrade the system-wide version, or you can install your
307 own personal version. It's really quite easy; instructions for getting
308 and installing mh-e are in @ref{Getting mh-e}.
309
310 @cindex @code{install-mh}
311 @cindex MH commands, @code{install-mh}
312
313 Also, older versions of mh-e assumed that you had already set up your MH
314 environment. Newer versions set up a new MH environment for you by
315 running @code{install-mh} and notifying you of this fact with the
316 message in a temporary buffer:
317
318 @example
319 I'm going to create the standard MH path for you.
320 @end example
321
322 Therefore, if you've never run MH before and you're using an old version
323 of mh-e, you need to run @code{install-mh} from the shell before you
324 continue the tour. If you don't, you'll be greeted with the error
325 message: @samp{Can't find MH profile}.
326
327 @cindex @file{.emacs}
328 @cindex files, @file{.emacs}
329
330 If, during the tour described in this chapter, you see a message like:
331 @samp{Searching for program: no such file or directory,
332 /usr/local/bin/mhpath}, it means that the MH programs and files are kept
333 in a nonstandard directory. In this case, simply add the following to
334 @file{~/.emacs} and restart @code{emacs}.
335
336 @vindex @code{mh-progs}, example
337 @vindex @code{mh-lib}, example
338
339 @c XXX Real example for really naive user?
340 @example
341 @group
342 (setq mh-progs "@var{/path/to/MH/binary/directory/}")
343 (setq mh-lib "@var{/path/to/MH/library/directory/}")
344 @end group
345 @end example
346
347 @cindex ~
348
349 The @samp{~} notation used by @file{~/.emacs} above represents your home
350 directory. This is used by the @code{bash} and @code{csh} shells. If
351 your shell does not support this feature, you could use the environment
352 variable @samp{$HOME} (such as @file{$HOME/.emacs}) or the absolute path
353 (as in @file{/home/wohler/.emacs}) instead.
354
355 At this point, you should see something like the screen in the
356 figure in @ref{Reading Mail Tour}. We're now ready to move on.
357
358 @node Sending Mail Tour, Reading Mail Tour, Getting Started, Tour Through mh-e
359 @section Sending Mail
360
361 @cindex sending mail
362 @findex @code{mh-smail}
363
364 Let's start our tour by sending ourselves a message which we can later
365 read and process. Enter @kbd{M-x mh-smail} to invoke the mh-e program
366 to send messages. You will be prompted in the minibuffer by @samp{To:}.
367 Enter your login name. The next prompt is @samp{cc:}. Hit @key{RET} to
368 indicate that no carbon copies are to be sent. At the @samp{Subject:}
369 prompt, enter @kbd{Test} or anything else that comes to mind.
370
371 @cindex MH-Letter mode
372 @cindex modes, MH-Letter
373 @cindex mode
374
375 Once you've specified the recipients and subject, your message appears
376 in an Emacs buffer whose mode @footnote{A @dfn{mode} changes Emacs to
377 make it easier to edit a particular type of text.} is MH-Letter.
378 Enter some text in the body of the message, using normal Emacs commands.
379 You should now have something like this: @footnote{If you're running Emacs
380 under the X Window System, then you would also see a menubar. I've left
381 out the menubar in all of the example screens.}
382
383 @example
384 @group
385 @cartouche
386
387
388
389
390
391
392 -----Emacs: *scratch* (Lisp Interaction)--All-------------------
393 To: wohler
394 cc:
395 Subject: Test
396 --------
397 This is a test message to get the wheels churning...#
398
399
400 --**-@{draft@} (MH-Letter)--All-------------------------------------
401
402 @end cartouche
403 @i{mh-e message composition window}
404 @end group
405 @end example
406
407 @cindex MH-Letter mode
408 @cindex modes, MH-Letter
409
410 Note the line of dashes that separates the header and the body of the
411 message. It is essential that these dashes (or a blank line) are
412 present or the body of your message will be considered to be part of
413 the header.
414
415 There are several commands specific to MH-Letter mode, but at
416 this time we'll only use @kbd{C-c C-c} to send your message. Type
417 @kbd{C-c C-c} now. That's all there is to it!
418
419 @node Reading Mail Tour, Processing Mail Tour, Sending Mail Tour, Tour Through mh-e
420 @section Receiving Mail
421
422 @cindex reading mail
423 @findex @code{mh-rmail}
424 @cindex @code{inc}
425 @cindex MH commands, @code{inc}
426 @cindex @code{scan}
427 @cindex MH commands, @code{scan}
428 @cindex MH-Folder mode
429 @cindex modes, MH-Folder
430
431 To read the mail you've just sent yourself, enter @kbd{M-x mh-rmail}.
432 This incorporates the new mail and put the output from @code{inc}
433 (called @dfn{scan lines} after the MH program @code{scan} which prints a
434 one-line summary of each message) into a buffer called @samp{+inbox}
435 whose major mode is MH-Folder.
436
437 @sp 2
438 @need 1000
439 @center @strong{NOTE}
440
441 @quotation
442 The @kbd{M-x mh-rmail} command will show you only new mail, not old
443 mail. If you were to run this tour again, you would use @kbd{M-r} to
444 pull all your messages into mh-e.
445 @end quotation
446
447 You should see the scan line for your message, and perhaps others. Use
448 @kbd{n} or @kbd{p} to move the cursor to your test message and type
449 @key{RET} to read your message. You should see something like:
450
451 @example
452 @group
453 @cartouche
454 3 24Aug root received fax files on Wed Aug 24 11:00:13 PDT 1994
455 # 4+ 24Aug To:wohler Test<<This is a test message to get the wheels chu
456
457 --%%-@{+inbox@} 4 msgs (1-4) (MH-Folder Show)--Bot------------------
458 To: wohler
459 Subject: Test
460 Date: Wed, 24 Aug 1994 13:01:13 -0700
461 From: Bill Wohler <wohler@@newt.com>
462
463 This is a test message to get the wheels churning...
464
465
466
467
468
469 -----@{show-+inbox@} 4 (MH-Show)--Bot-------------------------------
470
471 @end cartouche
472 @i{After incorporating new messages}
473 @end group
474 @end example
475
476 If you typed a long message, you can view subsequent pages with @key{SPC}
477 and previous pages with @key{DEL}.
478
479 @node Processing Mail Tour, Leaving mh-e, Reading Mail Tour, Tour Through mh-e
480 @section Processing Mail
481
482 @cindex processing mail
483
484 The first thing we want to do is reply to the message that we sent
485 ourselves. Ensure that the cursor is still on the same line as your
486 test message and type @kbd{r}. You are prompted in the minibuffer with
487 @samp{Reply to whom:}. Here mh-e is asking whether you'd like to reply
488 to the original sender only, to the sender and primary recipients, or to
489 the sender and all recipients. If you simply hit @key{RET}, you'll
490 reply only to the sender. Hit @key{RET} now.
491
492 You'll find yourself in an Emacs buffer similar to that when you were
493 sending the original message, like this:
494
495 @example
496 @group
497 @cartouche
498 To: wohler
499 Subject: Re: Test
500 In-reply-to: Bill Wohler's message of Wed, 24 Aug 1994 13:01:13 -0700
501 <199408242001.NAA00505@@newt.com>
502 --------
503 #
504
505 --**-@{draft@} (MH-Letter)--All-------------------------------------
506 To: wohler
507 Subject: Test
508 Date: Wed, 24 Aug 1994 13:01:13 -0700
509 From: Bill Wohler <wohler@@newt.com>
510
511 This is a test message to get the wheels churning...
512
513 -----@{show-+inbox@} 4 (MH-Show)--Bot-------------------------------
514 Composing a reply...done
515 @end cartouche
516 @i{Composition window during reply}
517 @end group
518 @end example
519
520 By default, MH will not add you to the address list of your replies, so
521 if you find that the @samp{To:} header field is missing, don't worry.
522 In this case, type @kbd{C-c C-f C-t} to create and go to the @samp{To:}
523 field, where you can type your login name again. You can move around
524 with the arrow keys or with @kbd{C-p} (@code{previous-line}), @kbd{C-n}
525 (@code{next-line}), @kbd{C-b} (@code{backward-char}), and @kbd{C-f}
526 (@code{forward-char}) and can delete the previous character with
527 @key{BS}. When you're finished editing your message, send it with
528 @kbd{C-c C-c} as before.
529
530 @cindex folder
531
532 You'll often want to save messages that were sent to you in an organized
533 fashion. This is done with @dfn{folders}. You can use folders to keep
534 messages from your friends, or messages related to a particular topic.
535 With your cursor in the MH-Folder buffer and positioned on the message
536 you sent to yourself, type @kbd{o} to output (@code{refile} in MH
537 parlance) that message to a folder. Enter @kbd{test} at the
538 @samp{Destination:} prompt and type @kbd{y} (or @key{SPC}) when mh-e
539 asks to create the folder @samp{+test}. Note that a @samp{^} (caret)
540 appears next to the message number, which means that the message has
541 been marked for refiling but has not yet been refiled. We'll talk about
542 how the refile is actually carried out in a moment.
543
544 @cindex MH-Folder mode
545 @cindex modes, MH-Folder
546
547 Your previous reply is now waiting in the system mailbox. You
548 incorporate this mail into your MH-Folder buffer named @samp{+inbox}
549 with the @kbd{i} command. Do this now. After the mail is incorporated,
550 use @kbd{n} or @kbd{p} to move the cursor to the new message, and read
551 it with @key{RET}. Let's delete this message by typing @kbd{d}. Note
552 that a @samp{D} appears next to the message number. This means that the
553 message is marked for deletion but is not yet deleted. To perform the
554 deletion (and the refile we did previously), use the @kbd{x} command.
555
556 @findex @code{mh-smail}
557
558 If you want to send another message you can use @kbd{m} instead of
559 @kbd{M-x mh-smail}. So go ahead, send some mail to your friends!
560
561 @node Leaving mh-e, More About mh-e, Processing Mail Tour, Tour Through mh-e
562 @section Leaving mh-e
563
564 @cindex Emacs, quitting
565 @cindex quitting
566
567 You may now wish to exit @code{emacs} entirely. Use @kbd{C-x C-c} to
568 exit @code{emacs}. If you exited without running @kbd{x} in the
569 @samp{+inbox} buffer, Emacs will offer to save it for you. Type @kbd{y}
570 or @key{SPC} to save @samp{+inbox} changes, which means to perform any refiles
571 and deletes that you did there.
572
573 If you don't want to leave Emacs, you can type @kbd{q} to bury (hide)
574 the mh-e folder or delete them entirely with @kbd{C-x k}. You can then
575 later recall them with @kbd{C-x b} or @kbd{M-x mh-rmail}.
576
577 @node More About mh-e, , Leaving mh-e, Tour Through mh-e
578 @section More About mh-e
579
580 These are the basic commands to get you going, but there are plenty
581 more. If you think that mh-e is for you, read @ref{Using mh-e} and
582 @ref{Customizing mh-e} to find out how you can:
583
584 @itemize @bullet
585 @item
586 Print your messages. (@ref{Printing} and @ref{Customizing Printing}.)
587 @item
588 Edit messages and include your signature. (@ref{Draft Editing}
589 and @ref{Customizing Draft Editing}.)
590 @item
591 Forward messages. (@ref{Forwarding} and @ref{Customizing Forwarding}.)
592 @item
593 Read digests. (@ref{Viewing}.)
594 @item
595 Edit bounced messages. (@ref{Old Drafts} and @ref{Customizing Old Drafts}.)
596 @item
597 Send multimedia messages. (@ref{Editing MIME} and @ref{Customizing Editing MIME}.)
598 @item
599 Process mail that was sent with @code{shar} or @code{uuencode}.
600 (@ref{Files and Pipes}.)
601 @item
602 Use sequences conveniently. (@ref{Sequences}.)
603 @item
604 Show header fields in different fonts. (@ref{Customizing Viewing}.)
605 @item
606 Find previously refiled messages. (@ref{Searching}.)
607 @item
608 Place messages in a file. (@ref{Files and Pipes}.)
609 @end itemize
610
611 Remember that you can also use MH commands when you're not running mh-e
612 (and when you are!).
613
614 @node Using mh-e, Customizing mh-e, Tour Through mh-e, Top
615 @chapter Using mh-e
616
617 This chapter leaves the tutorial style and goes into more detail about
618 every mh-e command. The default, or "out of the box," behavior is
619 documented. If this is not to your liking (for instance, you print with
620 something other than @code{lpr)}, see the associated section in
621 @ref{Customizing mh-e} which is organized exactly like this chapter.
622
623 @cindex Emacs, functions; describe-mode
624 @cindex Emacs, online help
625 @cindex online help
626
627 There are many commands, but don't get intimidated. There are command
628 summaries at the beginning of each section. In case you have or would
629 like to rebind the keys, the command summaries also list the associated
630 Emacs Lisp function. Furthermore, even if you're stranded on a desert
631 island with a laptop and are without your manuals, you can get a summary
632 of all these commands with GNU Emacs online help: use @kbd{C-h m}
633 (@code{describe-mode}) for a brief summary of commands or @kbd{C-h i} to
634 read this manual via Info. The online help is quite good; try running
635 @kbd{C-h C-h C-h}. This brings up a list of available help topics, one
636 of which displays the documentation for a given key (like @kbd{C-h k
637 C-n}). In addition, review @ref{Conventions}, if any of the GNU Emacs
638 conventions are strange to you.
639
640 Let's get started!
641
642 @menu
643 * Reading Mail::
644 * Sending Mail::
645 * Draft Editing::
646 * Moving Mail::
647 * Searching::
648 * Sequences::
649 * Miscellaneous::
650 @end menu
651
652 @node Reading Mail, Sending Mail, Using mh-e, Using mh-e
653 @section Reading Your Mail
654
655 @cindex reading mail
656 @findex @code{mh-rmail}
657 @cindex MH-Folder mode
658 @cindex modes, MH-Folder
659
660 The mh-e entry point for reading mail is @kbd{M-x mh-rmail}. This
661 command incorporates your mail and creates a buffer called @samp{+inbox}
662 in MH-Folder mode. The @kbd{M-x mh-rmail} command shows you only new
663 mail, not old mail. @footnote{If you want to see your old mail as well,
664 use @kbd{M-r} to pull all your messages into mh-e. Or, give a prefix
665 argument to @code{mh-rmail} so it will prompt you for folder to visit
666 like @kbd{M-f} (for example, @kbd{C-u M-x mh-rmail @key{RET} bob
667 @key{RET}}). Both @kbd{M-r} and @kbd{M-f} are described in
668 @ref{Organizing}.} The @samp{+inbox} buffer contains @dfn{scan lines},
669 which are one-line summaries of each incorporated message. You can
670 perform most MH commands on these messages via one-letter commands
671 discussed in this chapter. See @code{scan}(1) for a description of the
672 contents of the scan lines, and see the Figure in @ref{Reading Mail
673 Tour}, for an example.
674
675 @table @kbd
676 @item RET
677 Display a message (@code{mh-show}).
678
679 @item SPC
680 Go to next page in message (@code{mh-page-msg}).
681
682 @item BS
683 Go to previous page in message (@code{mh-previous-page}).
684
685 @item , (comma)
686 Display a message with all header fields (@code{mh-header-display}).
687
688 @item M-SPC
689 Go to next message in digest (@code{mh-page-digest}).
690
691 @item M-BS
692 Go to previous message in digest (@code{mh-page-digest-backwards}).
693
694 @item M-b
695 Break up digest into separate messages (@code{mh-burst-digest}).
696
697 @item n
698 Display next message (@code{mh-next-undeleted-msg}).
699
700 @item p
701 Display previous message (@code{mh-previous-undeleted-msg}).
702
703 @item g
704 Go to a message (@code{mh-goto-msg}).
705
706 @item M-<
707 Go to first message (@code{mh-first-msg}).
708
709 @item M->
710 Go to last message (@code{mh-last-msg}).
711
712 @item t
713 Toggle between MH-Folder and MH-Folder Show modes (@code{mh-toggle-showing}).
714 @end table
715
716 @menu
717 * Viewing::
718 * Moving Around::
719 @end menu
720
721 @node Viewing, Moving Around, Reading Mail, Reading Mail
722 @subsection Viewing Your Mail
723
724 @findex @code{mh-show}
725 @findex @code{mh-page-msg}
726 @findex @code{mh-previous-page}
727 @findex @code{mh-header-display}
728
729 The @kbd{RET} (@code{mh-show}) command displays the message that the
730 cursor is on. If the message is already displayed, it scrolls to the
731 beginning of the message. Use @key{SPC} (@code{mh-page-msg}) and
732 @key{BS} (@code{mh-previous-page}) to move forwards and backwards one
733 page at a time through the message. You can give either of these
734 commands a prefix argument that specifies the number of lines to scroll
735 (such as @kbd{10 SPC}). mh-e normally hides a lot of the
736 superfluous header fields that mailers add to a message, but if you wish
737 to see all of them, use the @kbd{,} (comma; @code{mh-header-display})
738 command.
739
740 @menu
741 * Reading Digests::
742 * Reading MIME::
743 @end menu
744
745 @node Reading Digests, Reading MIME, Viewing, Viewing
746 @subsubsection Reading Digests
747
748 @cindex digests
749 @findex @code{mh-page-digest}
750 @findex @code{mh-page-digest-backwards}
751
752 A digest is a message that contains other messages. Special mh-e
753 commands let you read digests conveniently. You can use @key{SPC} and
754 @key{BS} to page through the digest as if it were a normal message, but
755 if you wish to skip to the next message in the digest, use @kbd{M-SPC}
756 (@code{mh-page-digest}). To return to a previous message, use
757 @kbd{M-BS} (@code{mh-page-digest-backwards}).
758
759 @cindex @code{burst}
760 @cindex MH commands, @code{burst}
761 @cindex MH-Folder Show mode
762 @cindex modes, MH-Folder Show
763 @findex @code{mh-burst-digest}
764
765 @c There was a page break at the colon in the following paragraph which
766 @c broke the transition to the example.
767 @need 2000
768
769 Another handy command is @kbd{M-b} (@code{mh-burst-digest}). This
770 command uses the MH command @code{burst} to break out each message in
771 the digest into its own message. Using this command, you can quickly
772 delete unwanted messages, like this: Once the digest is split up, toggle
773 out of MH-Folder Show mode with @kbd{t} (@pxref{Moving Around}) so that
774 the scan lines fill the screen and messages aren't displayed. Then use
775 @kbd{d} (@pxref{Deleting}) to quickly delete messages that you don't
776 want to read (based on the @samp{Subject:} header field). You can also
777 burst the digest to reply directly to the people who posted the messages
778 in the digest. One problem you may encounter is that the @samp{From:}
779 header fields are preceded with a @samp{>} so that your reply can't
780 create the @samp{To:} field correctly. In this case, you must correct
781 the @samp{To:} field yourself. This is described later in @ref{Editing
782 Textual}.
783
784 @node Reading MIME, , Reading Digests, Viewing
785 @subsubsection Reading Multimedia Mail
786
787 @cindex multimedia mail
788 @cindex MIME
789 @cindex @code{show}
790 @cindex MH commands, @code{show}
791 @cindex @code{mhshow}
792 @cindex MH commands, @code{mhshow}
793
794 MH has the ability to read @dfn{@sc{mime}} (Multipurpose Internet Mail
795 Extensions) messages. Unfortunately, mh-e does not yet have this
796 ability, so you have to use the MH commands @code{show} or @code{mhshow}
797 from the shell to read @sc{mime} messages. @footnote{You can call them
798 directly from Emacs if you're running the X Window System: type @kbd{M-!
799 xterm -e mhshow @var{message-number}}. You can leave out the @code{xterm
800 -e} if you use @code{mhlist} or @code{mhstore}.}
801
802 @node Moving Around, , Viewing, Reading Mail
803 @subsection Moving Around
804
805 @cindex moving between messages
806 @findex @code{mh-next-undeleted-msg}
807 @findex @code{mh-previous-undeleted-msg}
808 @findex @code{mh-goto-msg}
809 @findex @code{mh-last-msg}
810 @findex @code{mh-first-msg}
811
812 To move on to the next message, use the @kbd{n}
813 (@code{mh-next-undeleted-msg}) command; use the @kbd{p}
814 (@code{mh-previous-undeleted-msg}) command to read the previous message.
815 Both of these commands can be given a prefix argument to specify how
816 many messages to skip (for example, @kbd{5 n}). You can also move to a
817 specific message with @kbd{g} (@code{mh-goto-msg}). You can enter the
818 message number either before or after typing @kbd{g}. In the latter
819 case, Emacs prompts you. Finally, you can go to the first or last
820 message with @kbd{M-<} (@code{mh-first-msg}) and @kbd{M->}
821 (@code{mh-last-msg}) respectively.
822
823 @cindex MH-Folder mode
824 @cindex modes, MH-Folder
825
826 You can also use the Emacs commands @kbd{C-p} (@code{previous-line}) and
827 @kbd{C-n} (@code{next-line}) to move up and down the scan lines in the
828 MH-Folder window. These commands can be used in conjunction with
829 @kbd{RET} to look at deleted or refiled messages.
830
831 @cindex MH-Folder mode
832 @cindex modes, MH-Folder
833 @cindex MH-Folder Show mode
834 @cindex modes, MH-Folder Show
835 @cindex junk mail
836 @findex @code{mh-toggle-showing}
837
838 The command @kbd{t} (@code{mh-toggle-showing}) switches between
839 MH-Folder mode and MH-Folder Show mode. @footnote{For you Emacs
840 wizards, this is implemented as an Emacs minor mode.} MH-Folder mode
841 turns off the associated show buffer so that you can perform operations
842 on the messages quickly without reading them. This is an excellent way
843 to prune out your junk mail or to refile a group of messages to another
844 folder for later examination.
845
846 @node Sending Mail, Draft Editing, Reading Mail, Using mh-e
847 @section Sending Mail
848
849 @cindex sending mail
850 @findex @code{mh-smail}
851
852 You can send a mail message in several ways. You can call @kbd{M-x
853 mh-smail} directly, or from the command line like this:
854
855 @cindex starting from command line
856
857 @example
858 % @kbd{emacs -f mh-smail}
859 @end example
860
861 From within mh-e's MH-Folder mode, other methods of sending mail
862 are available as well:
863
864 @table @kbd
865 @item m
866 Compose a message (@code{mh-send}).
867
868 @item r
869 Reply to a message (@code{mh-reply}).
870
871 @item f
872 Forward message(s) (@code{mh-forward}).
873
874 @item M-d
875 Redistribute a message (@code{mh-redistribute}).
876
877 @item M-e
878 Edit a message that was bounced by mailer (@code{mh-extract-rejected-mail}).
879
880 @item M-a
881 Edit a message to send it again (@code{mh-edit-again}).
882 @end table
883
884 @cindex MH-Folder mode
885 @cindex modes, MH-Folder
886 @cindex MH-Letter mode
887 @cindex modes, MH-Letter
888 @findex @code{mh-send}
889
890 From within a MH-Folder buffer, you can simply use the command @kbd{m}
891 (@code{mh-send}). However you invoke @code{mh-send}, you are prompted
892 for the @samp{To:}, @samp{cc:}, and @samp{Subject:} header fields. Once
893 you've specified the recipients and subject, your message appears in an
894 Emacs buffer whose mode is MH-Letter (see the Figure in @ref{Sending
895 Mail} to see what the buffer looks like). MH-Letter mode allows you to
896 edit your message, to check the validity of the recipients, to insert
897 other messages into your message, and to send the message. We'll go
898 more into depth about editing a @dfn{draft} @footnote{I highly recommend
899 that you use a @dfn{draft folder} so that you can edit several drafts in
900 parallel. To do so, create a folder (e.g., @file{+drafts}), and add a
901 profile component called @samp{Draft-Folder:} which contains
902 @file{+drafts} (see @code{mh-profile}(5)).} (a message you're composing)
903 in just a moment.
904
905 @findex @code{mh-smail}
906 @findex @code{mh-smail-other-window}
907
908 @code{mh-smail} always creates a two-window layout with the current
909 buffer on top and the draft on the bottom. If you would rather preserve
910 the window layout, use @kbd{M-x mh-smail-other-window}.
911
912 @menu
913 * Replying::
914 * Forwarding::
915 * Redistributing::
916 * Old Drafts::
917 @end menu
918
919 @node Replying, Forwarding, Sending Mail, Sending Mail
920 @subsection Replying to Mail
921
922 @cindex replying
923 @cindex @code{mhl}
924 @cindex MH commands, @code{mhl}
925 @cindex @file{mhl.reply}
926 @cindex files, @file{mhl.reply}
927 @findex @code{mh-reply}
928
929 To compose a reply to a message, use the @kbd{r} (@code{mh-reply})
930 command. If you supply a prefix argument (as in @kbd{C-u r}), the
931 message you are replying to is inserted in your reply after having first
932 been run through @code{mhl} with the format file @file{mhl.reply}. See
933 @code{mhl}(1) to see how you can modify the default @file{mhl.reply}
934 file.
935
936 When you reply to a message, you are first prompted with @samp{Reply to
937 whom?}. You have several choices here.
938
939 @example
940 @group
941 @b{Response} @b{Reply Goes To}
942
943 @kbd{from} @r{The person who sent the message. This is the default,}
944 @r{so @key{RET} is sufficient.}
945
946 @kbd{to} @r{Replies to the sender, plus all recipients in the}
947 @r{@samp{To:} header field.}
948
949 @kbd{all}
950 @kbd{cc} @r{Forms a reply to the sender, plus all recipients.}
951 @end group
952 @end example
953
954 @cindex @code{repl}
955 @cindex MH commands, @code{repl}
956
957 Depending on your answer, @code{repl} is given a different argument to
958 form your reply. Specifically, a choice of @kbd{from} or none at all
959 runs @code{repl -nocc all}, and a choice of @kbd{to} runs @code{repl -cc
960 to}. Finally, either @kbd{cc} or @kbd{all} runs @code{repl -cc all
961 -nocc me}.
962
963 @cindex MH-Letter mode
964 @cindex modes, MH-Letter
965
966 Two windows are then created. One window contains the message to which
967 you are replying. Your draft, in MH-Letter mode (described in
968 @ref{Draft Editing}), is in the other window.
969
970 If you wish to customize the header or other parts of the reply draft,
971 please see @code{repl}(1) and @code{mh-format}(5).
972
973 @node Forwarding, Redistributing, Replying, Sending Mail
974 @subsection Forwarding Mail
975
976 @cindex forwarding
977 @cindex @code{forw}
978 @cindex MH commands, @code{forw}
979 @findex @code{mh-forward}
980
981 To forward a message, use the @kbd{f} (@code{mh-forward}) command. You
982 are given a draft to edit that looks like it would if you had run the MH
983 command @code{forw}. You are given a chance to add some text (see
984 @ref{Draft Editing}).
985
986 You can forward several messages by using a prefix argument; in this
987 case, you are prompted for the name of a @dfn{sequence}, a symbolic name
988 that represents a list or range of message numbers (for example,
989 @kbd{C-u f forbob @key{RET}}). All of the messages in the sequence are
990 inserted into your draft. By the way, although sequences are often
991 mentioned in this chapter, you don't have to worry about them for now;
992 the full description of sequences in mh-e is at the end in
993 @ref{Sequences}. To learn more about sequences in general, please see
994 @code{mh-sequence}(5).
995
996 @node Redistributing, Old Drafts, Forwarding, Sending Mail
997 @subsection Redistributing Your Mail
998
999 @cindex redistributing
1000 @findex @code{mh-redistribute}
1001
1002 The command @kbd{M-d} (@code{mh-redistribute}) is similar in function to
1003 forwarding mail, but it does not allow you to edit the message, nor does
1004 it add your name to the @samp{From:} header field. It appears to the
1005 recipient as if the message had come from the original sender. For more
1006 information on redistributing messages, see @code{dist}(1). Also
1007 investigate the @kbd{M-a} (@code{mh-edit-again}) command in @ref{Old
1008 Drafts}, for another way to redistribute messages.
1009
1010 @node Old Drafts, , Redistributing, Sending Mail
1011 @subsection Editing Old Drafts and Bounced Messages
1012
1013 @cindex re-editing drafts
1014 @cindex @file{draft}
1015 @cindex files, @file{draft}
1016 @findex @code{mh-edit-again}
1017
1018 If you don't complete a draft for one reason or another, and if the
1019 draft buffer is no longer available, you can pick your draft up again
1020 with @kbd{M-a} (@code{mh-edit-again}). If you don't use a draft folder,
1021 your last @file{draft} file will be used. If you use draft folders,
1022 you'll need to visit the draft folder with @kbd{M-f drafts @key{RET}},
1023 use @kbd{n} to move to the appropriate message, and then use @kbd{M-a}
1024 to prepare the message for editing.
1025
1026 The @kbd{M-a} command can also be used to take messages that were sent
1027 to you and to send them to more people.
1028
1029 @cindex Mailer-Daemon
1030 @findex @code{mh-extract-rejected-mail}
1031
1032 Don't use @kbd{M-a} to re-edit a message from a @i{Mailer-Daemon} who
1033 complained that your mail wasn't posted for some reason or another. In
1034 this case, use @kbd{M-e} (@code{mh-extract-rejected-mail}) to prepare
1035 the message for editing by removing the @i{Mailer-Daemon} envelope and
1036 unneeded header fields. Fix whatever addressing problem you had, and
1037 send the message again with @kbd{C-c C-c}.
1038
1039 @node Draft Editing, Moving Mail, Sending Mail, Using mh-e
1040 @section Editing a Draft
1041
1042 @cindex editing draft
1043 @cindex MH-Letter mode
1044 @cindex modes, MH-Letter
1045
1046 When you edit a message that you want to send (called a @dfn{draft} in
1047 this case), the mode used is MH-Letter. This mode provides
1048 several commands in addition to the normal Emacs editing commands to
1049 help you edit your draft.
1050
1051 @table @kbd
1052 @item C-c C-y
1053 Insert contents of message to which you're replying (@code{mh-yank-cur-msg}).
1054
1055 @item C-c C-i
1056 Insert a message from a folder (@code{mh-insert-letter}).
1057
1058 @item C-c C-f C-t
1059 Move to @samp{To:} header field (@code{mh-to-field}).
1060
1061 @item C-c C-f C-c
1062 Move to @samp{cc:} header field (@code{mh-to-field}).
1063
1064 @item C-c C-f C-s
1065 Move to @samp{Subject:} header field (@code{mh-to-field}).
1066
1067 @item C-c C-f C-f
1068 Move to @samp{From:} header field (@code{mh-to-field}).
1069
1070 @item C-c C-f C-b
1071 Move to @samp{Bcc:} header field (@code{mh-to-field}).
1072
1073 @item C-c C-f C-f
1074 Move to @samp{Fcc:} header field (@code{mh-to-fcc}).
1075
1076 @item C-c C-f C-d
1077 Move to @samp{Dcc:} header field (@code{mh-to-field}).
1078
1079 @item C-c C-w
1080 Display expanded recipient list (@code{mh-check-whom}).
1081
1082 @item C-c C-s
1083 Insert signature in message (@code{mh-insert-signature}).
1084
1085 @item C-c C-m C-f
1086 Include forwarded message (@sc{mime}) (@code{mh-mhn-compose-forw}).
1087
1088 @item C-c C-m C-e
1089 Include anonymous ftp reference (@sc{mime}) (@code{mh-mhn-compose-anon-ftp}).
1090
1091 @item C-c C-m C-t
1092 Include anonymous ftp reference to compressed tar file (@sc{mime})
1093 (@code{mh-mhn-compose-external-compressed-tar}).
1094
1095 @item C-c C-m C-i
1096 Include binary, image, sound, etc. (@sc{mime})
1097 (@code{mh-mhn-compose-insertion}).
1098
1099 @item C-c C-e
1100 Run through @code{mhn} before sending (@code{mh-edit-mhn}).
1101
1102 @item C-c C-m C-u
1103 Undo effects of @code{mhn} (@code{mh-revert-mhn-edit}).
1104
1105 @item C-c C-c
1106 Save draft and send message (@code{mh-send-letter}).
1107
1108 @item C-c C-q
1109 Quit editing and delete draft message (@code{mh-fully-kill-draft}).
1110 @end table
1111
1112 @menu
1113 * Editing Textual::
1114 * Editing MIME::
1115 * Sending Message::
1116 * Killing Draft::
1117 @end menu
1118
1119 @node Editing Textual, Editing MIME, Draft Editing, Draft Editing
1120 @subsection Editing Textual Messages
1121
1122 The following sections show you how to edit a draft.
1123 The commands described here are also applicable to messages that have
1124 multimedia components.
1125
1126 @menu
1127 * Inserting Letter::
1128 * Inserting Messages::
1129 * Header::
1130 * Recipients::
1131 * Signature::
1132 @end menu
1133
1134 @node Inserting Letter, Inserting Messages, Editing Textual, Editing Textual
1135 @subsubsection Inserting letter to which you're replying
1136
1137 @cindex inserting messages
1138 @findex @code{mh-yank-cur-msg}
1139
1140 It is often useful to insert a snippet of text from a letter that
1141 someone mailed to provide some context for your reply. The command
1142 @kbd{C-c C-y} (@code{mh-yank-cur-msg}) does this by yanking a portion of
1143 text from the message to which you're replying and inserting @samp{> }
1144 before each line.
1145
1146 @cindex mark
1147 @cindex Emacs, mark
1148 @cindex point
1149 @cindex Emacs, point
1150 @cindex region
1151 @cindex Emacs, region
1152
1153 You can control how much text is included when you run this command. If
1154 you run this command right away, without entering the buffer containing
1155 the message to you, this command will yank the entire message, as is,
1156 into your reply. @footnote{If you'd rather have the header cleaned up,
1157 use @kbd{C-u r} instead of @kbd{r} when replying (see @ref{Replying}).}
1158 If you enter the buffer containing the message sent to you and move the
1159 cursor to a certain point and return to your reply and run @kbd{C-c
1160 C-y}, then the text yanked will range from that point to the end of the
1161 message. Finally, the most common action you'll perform is to enter the
1162 message sent to you, move the cursor to the beginning of a paragraph or
1163 phrase, set the @dfn{mark} with @kbd{C-SPC} or @kbd{C-@@}, and move the
1164 cursor to the end of the paragraph or phrase. The cursor position is
1165 called the @dfn{point}, and the space between the mark and point is
1166 called the @dfn{region}. Having done that, @kbd{C-c C-y} will insert
1167 the region you selected.
1168
1169 @node Inserting Messages, Header, Inserting Letter, Editing Textual
1170 @subsubsection Inserting messages
1171
1172 @cindex inserting messages
1173 @findex @code{mh-insert-letter}
1174
1175 Messages can be inserted with @kbd{C-c C-i} (@code{mh-insert-letter}).
1176 This command prompts you for the folder and message number and inserts
1177 the message, indented by @samp{> }. Certain undesirable header fields
1178 are removed before insertion. If given a prefix argument (like @kbd{C-u
1179 C-c C-i}), the header is left intact, the message is not indented, and
1180 @samp{> } is not inserted before each line.
1181
1182 @node Header, Recipients, Inserting Messages, Editing Textual
1183 @subsubsection Editing the header
1184
1185 @cindex editing header
1186 @findex @code{mh-to-field}
1187
1188 Because the header is part of the message, you can edit the header
1189 fields as you wish. However, several convenience functions exist to
1190 help you create and edit them. For example, the command @kbd{C-c C-f
1191 C-t} (@code{mh-to-field}; alternatively, @kbd{C-c C-f t}) moves the
1192 cursor to the @samp{To:} header field, creating it if necessary. The
1193 functions to move to the @samp{cc:}, @samp{Subject:}, @samp{From:},
1194 @samp{Bcc:}, and @samp{Dcc:} header fields are similar.
1195
1196 @findex @code{mh-to-fcc}
1197
1198 One function behaves differently from the others, namely, @kbd{C-c C-f
1199 C-f} (@code{mh-to-fcc}; alternatively, @kbd{C-c C-f f}). This function
1200 will prompt you for the folder name in which to file a copy of the draft.
1201
1202 Be sure to leave a row of dashes or a blank line between the header and
1203 the body of the message.
1204
1205 @node Recipients, Signature, Header, Editing Textual
1206 @subsubsection Checking recipients
1207
1208 @cindex checking recipients
1209 @cindex @code{whom}
1210 @cindex MH commands, @code{whom}
1211 @findex @code{mh-check-whom}
1212
1213 The @kbd{C-c C-w} (@code{mh-check-whom}) command expands aliases so you
1214 can check the actual address(es) in the alias. A new buffer is created
1215 with the output of @code{whom}.
1216
1217 @node Signature, , Recipients, Editing Textual
1218 @subsubsection Inserting your signature
1219
1220 @cindex inserting signature
1221 @cindex signature
1222 @cindex @file{.signature}
1223 @cindex files, @file{.signature}
1224 @findex @code{mh-insert-signature}
1225
1226 You can insert your signature at the current cursor location with the
1227 @kbd{C-c C-s} (@code{mh-insert-signature}) command. The text of your
1228 signature is taken from the file @file{~/.signature}.
1229
1230 @node Editing MIME, Sending Message, Editing Textual, Draft Editing
1231 @subsection Editing Multimedia Messages
1232
1233 @cindex MIME
1234 @cindex multimedia mail
1235 @cindex @code{mhn}
1236 @cindex MH commands, @code{mhn}
1237
1238 mh-e has the capability to create multimedia messages. It uses the
1239 @sc{mime} (Multipurpose Internet Mail Extensions) protocol. The
1240 @sc{mime} protocol allows you to incorporate images, sound, video,
1241 binary files, and even commands that fetch a file with @samp{ftp} when
1242 your recipient reads the message! If you were to create a multimedia
1243 message with plain MH commands, you would use @code{mhn}. Indeed, the
1244 mh-e @sc{mime} commands merely insert @code{mhn} directives which are
1245 later expanded by @code{mhn}.
1246
1247 Each of the mh-e commands for editing multimedia messages or for
1248 incorporating multimedia objects is prefixed with @kbd{C-c C-m} .
1249
1250 @cindex content types
1251 @cindex MIME, content types
1252
1253 Several @sc{mime} objects are defined. They are called @dfn{content
1254 types}. The table in @ref{Customizing Draft Editing} contains a list of
1255 the content types that mh-e currently knows about. Several of the mh-e
1256 commands fill in the content type for you, whereas others require you to
1257 enter one. Most of the time, it should be obvious which one to use
1258 (e.g., use @kbd{image/jpeg} to include a @sc{jpeg} image). If not, you
1259 can refer to @sc{rfc} 1521,
1260 @c Footnotes are very fragile. Hence the duplication.
1261 @c The line break in the footnote was necessary since TeX wasn't creating one.
1262 @ifclear html
1263 @footnote{This @sc{rfc} (Request For Comments) is
1264 available via the @sc{url} @*
1265 @file{ftp://ds.internic.net/rfc/rfc1521.txt}.}
1266 @end ifclear
1267 @ifset html
1268 @footnote{This @sc{rfc} (Request For Comments) is
1269 available via the @sc{url} @*
1270 @file{<A HREF="ftp://ds.internic.net/rfc/rfc1521.txt">ftp://ds.internic.net/rfc/rfc1521.txt</A>}.}
1271 @end ifset
1272 which defines the @sc{mime} protocol, for a list of valid content types.
1273
1274 @cindex content description
1275 @cindex MIME, content description
1276
1277 You are also sometimes asked for a @dfn{content description}. This is
1278 simply an optional brief phrase, in your own words, that describes the
1279 object. If you don't care to enter a content description, just press
1280 return and none will be included; however, a reader may skip over
1281 multimedia fields unless the content description is compelling.
1282
1283 Remember: you can always add @code{mhn} directives by hand.
1284
1285 @menu
1286 * Forwarding MIME::
1287 * FTP::
1288 * Tar::
1289 * Other MIME Objects::
1290 * Sending MIME::
1291 @end menu
1292
1293 @node Forwarding MIME, FTP, Editing MIME, Editing MIME
1294 @subsubsection Forwarding multimedia messages
1295
1296 @findex @code{mh-mhn-compose-forw}
1297
1298 Mail may be forwarded with @sc{mime} using the command @kbd{C-c C-m C-f}
1299 (@code{mh-mhn-compose-forw}). You are prompted for a content
1300 description, the name of the folder in which the messages to forward are
1301 located, and the messages' numbers.
1302
1303 @node FTP, Tar, Forwarding MIME, Editing MIME
1304 @subsubsection Including an ftp reference
1305
1306 @cindex @code{ftp}
1307 @cindex Unix commands, @code{ftp}
1308 @cindex MIME, @code{ftp}
1309 @findex @code{mh-mhn-compose-anon-ftp}
1310
1311 You can even have your message initiate an @code{ftp} transfer when the
1312 recipient reads the message. To do this, use the @kbd{C-c C-m C-e}
1313 (@code{mh-mhn-compose-anon-ftp}) command. You are prompted for the
1314 remote host and pathname, the content type, and the content description.
1315
1316 @node Tar, Other MIME Objects, FTP, Editing MIME
1317 @subsubsection Including tar files
1318
1319 @cindex @code{tar}
1320 @cindex Unix commands, @code{tar}
1321 @cindex MIME, @code{tar}
1322 @cindex @code{ftp}
1323 @cindex Unix commands, @code{ftp}
1324 @cindex MIME, @code{ftp}
1325 @findex @code{mh-mhn-compose-external-compressed-tar}
1326
1327 If the remote file (@pxref{FTP}) is a compressed tar file, you can use
1328 @kbd{C-c C-m C-t} (@code{mh-mhn-compose-external-compressed-tar}).
1329 Then, in addition to retrieving the file via anonymous @emph{ftp}, the
1330 file will also be uncompressed and untarred. You are prompted for the
1331 remote host and pathname and the content description. The pathname
1332 should contain at least one @samp{/} (slash), because the pathname is
1333 broken up into directory and name components.
1334
1335 @node Other MIME Objects, Sending MIME, Tar, Editing MIME
1336 @subsubsection Including other multimedia objects
1337
1338 @cindex images
1339 @cindex MIME, images
1340 @cindex sound
1341 @cindex MIME, sound
1342 @cindex video
1343 @cindex MIME, video
1344 @findex @code{mh-mhn-compose-insertion}
1345
1346 Images, sound, and video can be inserted in your message with the
1347 @kbd{C-c C-m C-i} (@code{mh-mhn-compose-insertion}) command. You are
1348 prompted for the filename containing the object, the content type, and a
1349 content description of the object.
1350
1351 @node Sending MIME, , Other MIME Objects, Editing MIME
1352 @subsubsection Readying multimedia messages for sending
1353
1354 When you are finished editing a @sc{mime} message, it might look like this:
1355
1356 @example
1357 @group
1358 @cartouche
1359 3 24Aug root received fax files on Wed Aug 24 11:00:13
1360 4+ 24Aug To:wohler Test<<This is a test message to get the wh
1361
1362
1363
1364
1365
1366 --%%-@{+inbox@} 4 msgs (1-4) (MH-Folder Show)--Bot-------------------
1367 To: wohler
1368 cc:
1369 Subject: Test of MIME
1370 --------
1371 #@@application/octet-stream [Nonexistent ftp test file] \
1372 access-type=anon-ftp; site=berzerk.com; name=panacea.tar.gz; \
1373 directory="/pub/"
1374 #audio/basic [Test sound bite] /tmp/noise.au
1375 --**-@{draft@} (MH-Letter)--All--------------------------------------
1376
1377 @end cartouche
1378 @i{mh-e @sc{mime} draft}
1379 @end group
1380 @end example
1381
1382 @cindex @code{mhn}
1383 @cindex MH commands, @code{mhn}
1384 @findex @code{mh-edit-mhn}
1385
1386 The lines added by the previous commands are @code{mhn} directives and
1387 need to be converted to @sc{mime} directives before sending. This is
1388 accomplished by the command @kbd{C-c C-e} (@code{mh-edit-mhn}), which
1389 runs @code{mhn} on the message. The following screen shows what those
1390 commands look like in full @sc{mime} format. You can see why mail user
1391 agents are usually built to hide these details from the user.
1392
1393 @example
1394 @group
1395 @cartouche
1396 To: wohler
1397 cc:
1398 Subject: Test of MIME
1399 MIME-Version: 1.0
1400 Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaaa0"
1401 Content-ID: <1623.777796162.0@@newt.com>
1402
1403 ------- =_aaaaaaaaaa0
1404 Content-Type: message/external-body; access-type="anon-ftp";
1405 site="berzerk.com"; name="panacea.tar.gz"; directory="/pub/"
1406
1407 Content-Type: application/octet-stream
1408 Content-ID: <1623.777796162.1@@newt.com>
1409 Content-Description: Nonexistent ftp test file
1410
1411 ------- =_aaaaaaaaaa0
1412 Content-Type: audio/basic
1413 Content-ID: <1623.777796162.2@@newt.com>
1414 Content-Description: Test sound bite
1415 Content-Transfer-Encoding: base64
1416
1417 Q3JlYXRpdmUgVm9pY2UgRmlsZRoaAAoBKREBQh8AgwCAgH9/f35+fn59fX5+fn5+f39/f39/f3
1418 f4B/f39/f39/f39/f39/f39+f39+f39/f39/f4B/f39/fn5/f39/f3+Af39/f39/gH9/f39/fn
1419 -----@{draft@} (MH-Letter)--Top--------------------------------------
1420
1421 @end cartouche
1422 @i{mh-e @sc{mime} draft ready to send}
1423 @end group
1424 @end example
1425
1426 @findex @code{mh-revert-mhn-edit}
1427
1428 This action can be undone by running @kbd{C-c C-m C-u}
1429 (@code{mh-revert-mhn-edit}). It does this by reverting to a backup
1430 file. You are prompted to confirm this action, but you can avoid the
1431 confirmation by adding an argument (for example, @kbd{C-u C-c C-m C-u}).
1432
1433 @node Sending Message, Killing Draft, Editing MIME, Draft Editing
1434 @subsection Sending a Message
1435
1436 @cindex sending mail
1437 @findex @code{mh-send-letter}
1438
1439 When you are all through editing a message, you send it with the
1440 @kbd{C-c C-c} (@code{mh-send-letter}) command. You can give an argument
1441 (as in @kbd{C-u C-c C-c}) to monitor the first stage of the delivery.
1442
1443 @node Killing Draft, , Sending Message, Draft Editing
1444 @subsection Killing the Draft
1445
1446 @cindex killing draft
1447 @findex @code{mh-fully-kill-draft}
1448
1449 If for some reason you are not happy with the draft, you can kill it
1450 instead with @kbd{C-c C-q} (@code{mh-fully-kill-draft}). Emacs then
1451 kills the draft buffer and deletes the draft message.
1452
1453 @node Moving Mail, Searching, Draft Editing, Using mh-e
1454 @section Moving Your Mail Around
1455
1456 @cindex processing mail
1457
1458 This section covers how messages and folders can be moved about or
1459 manipulated. Messages may be incorporated into your @file{+inbox},
1460 deleted, and refiled. Messages containing @code{shar} or
1461 @code{uuencode} output can be stored. Folders can be visited, sorted,
1462 packed, or deleted. Here's a list of the available commands to do these
1463 things:
1464
1465 @c Stephen thinks that ? should be documented here, since it also shows
1466 @c which folders a message will be refiled to. XXX
1467
1468 @table @kbd
1469 @item i
1470 Incorporate new mail into folder (@code{mh-inc-folder}).
1471
1472 @item d
1473 Delete message (@code{mh-delete-msg}).
1474
1475 @item C-d
1476 Delete message, don't move to next message (@code{mh-delete-msg-no-motion}).
1477
1478 @item M-s
1479 Find messages that meet search criteria (@code{mh-search-folder}).
1480
1481 @item o
1482 Output (refile) message to folder (@code{mh-refile-msg}).
1483
1484 @item c
1485 Copy message to folder (@code{mh-copy-msg}).
1486
1487 @item C-o
1488 Output (write) message to file (@code{mh-write-msg-to-file}).
1489
1490 @item !
1491 Repeat last output command (@code{mh-refile-or-write-again}).
1492
1493 @item l
1494 Print message with @code{lpr} (@code{mh-print-msg}).
1495
1496 @item |
1497 Pipe message through shell command (@code{mh-pipe-msg}).
1498
1499 @item M-n
1500 Unpack message created with @code{uudecode} or @code{shar}
1501 (@code{mh-store-msg}).
1502
1503 @item M-l
1504 List all folders (@code{mh-list-folders}).
1505
1506 @item M-f
1507 Visit folder (@code{mh-visit-folder}).
1508
1509 @item M-r
1510 Regenerate scan lines (@code{mh-rescan-folder}).
1511
1512 @item M-x mh-sort-folder
1513 Sort folder.
1514
1515 @item M-p
1516 Pack folder (@code{mh-pack-folder}).
1517
1518 @item M-k
1519 Remove folder (@code{mh-kill-folder}).
1520
1521 @item x
1522 Execute pending refiles and deletes (@code{mh-execute-commands}).
1523
1524 @item u
1525 Undo pending refile or delete (@code{mh-undo}).
1526
1527 @item M-u
1528 Undo all pending refiles and deletes (@code{mh-undo-folder}).
1529
1530 @item q
1531 Quit (@code{mh-quit}).
1532 @end table
1533
1534 @menu
1535 * Incorporating::
1536 * Deleting::
1537 * Organizing::
1538 * Printing::
1539 * Files and Pipes::
1540 * Finishing Up::
1541 @end menu
1542
1543 @node Incorporating, Deleting, Moving Mail, Moving Mail
1544 @subsection Incorporating Your Mail
1545
1546 @cindex incorporating
1547 @findex @code{mh-inc-folder}
1548
1549 If at any time you receive new mail, incorporate the new mail into your
1550 @samp{+inbox} buffer with @kbd{i} (@code{mh-inc-folder}). Note that
1551 @kbd{i} will display the @samp{+inbox} buffer, even if there isn't any
1552 new mail. You can incorporate mail from any file into the current
1553 folder by specifying a prefix argument; you'll be prompted for the name
1554 of the file to use (for example, @kbd{C-u i ~/mbox @key{RET}}).
1555
1556 @cindex Emacs, notification of new mail
1557 @cindex notification of new mail
1558 @cindex new mail
1559 @cindex @file{.emacs}
1560 @cindex files, @file{.emacs}
1561
1562 Emacs can notify you when you have new mail by displaying @samp{Mail} in
1563 the mode line. To enable this behavior, and to have a clock in the mode
1564 line besides, add the following to @file{~/.emacs}:
1565
1566 @findex @code{display-time}
1567
1568 @lisp
1569 (display-time)
1570 @end lisp
1571
1572 @node Deleting, Organizing, Incorporating, Moving Mail
1573 @subsection Deleting Your Mail
1574
1575 @cindex deleting
1576 @findex @code{mh-delete-msg}
1577 @findex @code{mh-delete-msg-no-motion}
1578
1579 To mark a message for deletion, use the @kbd{d} (@code{mh-delete-msg})
1580 command. A @samp{D} is placed by the message in the scan window, and
1581 the next message is displayed. If the previous command had been
1582 @kbd{p}, then the next message displayed is the message previous to the
1583 message just deleted. If you specify a prefix argument, you will be
1584 prompted for a sequence (@pxref{Sequences}) to delete (for example,
1585 @kbd{C-u d frombob RET}). The @kbd{x} command actually carries out the
1586 deletion (@pxref{Finishing Up}). @kbd{C-d}
1587 (@code{mh-delete-msg-no-motion}) marks the message for deletion but
1588 leaves the cursor at the current message in case you wish to perform
1589 other operations on the message.
1590
1591 @node Organizing, Printing, Deleting, Moving Mail
1592 @subsection Organizing Your Mail with Folders
1593
1594 @cindex using folders
1595 @cindex @code{folder}
1596 @cindex MH commands, @code{folder}
1597 @cindex @code{refile}
1598 @cindex MH commands, @code{refile}
1599 @findex @code{mh-refile-msg}
1600
1601 mh-e has analogies for each of the MH @code{folder} and @code{refile}
1602 commands. To refile a message in another folder, use the @kbd{o}
1603 (@code{mh-refile-msg}) (mnemonic: ``output'') command. You are prompted
1604 for the folder name.
1605
1606 @findex @code{mh-refile-or-write-again}
1607
1608 If you are refiling several messages into the same folder, you can use
1609 the @kbd{!} (@code{mh-refile-or-write-again}) command to repeat the last
1610 refile or write (see the description of @kbd{C-o} in @ref{Files and
1611 Pipes}). Or, place the messages into a sequence (@ref{Sequences}) and
1612 specify a prefix argument to @kbd{o}, in which case you'll be prompted
1613 for the name of the sequence (for example, @kbd{C-u o search RET}).
1614
1615 @findex @code{mh-copy-msg}
1616
1617 If you wish to copy a message to another folder, you can use the @kbd{c}
1618 (@code{mh-copy-msg}) command (see the @code{-link} argument to
1619 @code{refile}(1)). You are prompted for a folder, and you can specify a
1620 prefix argument if you want to copy a sequence into another folder. In
1621 this case, you are then prompted for the sequence. Note that unlike the
1622 @kbd{o} command, the copy takes place immediately. The original copy
1623 remains in the current folder.
1624
1625 @findex @code{mh-visit-folder}
1626
1627 When you want to read the messages that you have refiled into folders,
1628 use the @kbd{M-f} (@code{mh-visit-folder}) command to visit the folder.
1629 You are prompted for the folder name.
1630
1631 @findex @code{mh-list-folders}
1632 @findex @code{mh-kill-folder}
1633 @findex @code{mh-visit-folder}
1634 @findex @code{mh-sort-folder}
1635 @findex @code{mh-pack-folder}
1636 @findex @code{mh-rescan-folder}
1637
1638 Other commands you can perform on folders include: @kbd{M-l}
1639 (@code{mh-list-folders}), to list all the folders in your mail
1640 directory; @kbd{M-k} (@code{mh-kill-folder}), to remove a folder;
1641 @kbd{M-x mh-sort-folder}, to sort the messages by date (see
1642 @code{sortm}(1) to see how to sort by other criteria); @kbd{M-p}
1643 (@code{mh-pack-folder}), to pack a folder, removing gaps from the
1644 numbering sequence; and @kbd{M-r} (@code{mh-rescan-folder}), to rescan
1645 the folder, which is useful to grab all messages in your @file{+inbox}
1646 after processing your new mail for the first time. If you don't want to
1647 rescan the entire folder, give @kbd{M-r} or @kbd{M-p} a prefix argument
1648 and you'll be prompted for a range of messages to display (for instance,
1649 @kbd{C-u M-r last:50 RET}).
1650
1651 @node Printing, Files and Pipes, Organizing, Moving Mail
1652 @subsection Printing Your Mail
1653
1654 @cindex printing
1655 @cindex @code{mhl}
1656 @cindex MH commands, @code{mhl}
1657 @cindex @code{lpr}
1658 @cindex Unix commands, @code{lpr}
1659 @findex @code{mh-print-msg}
1660
1661 Printing mail is simple. Enter @kbd{l} (@code{mh-print-msg}) (for
1662 @i{l}ine printer or @i{l}pr). The message is formatted with @code{mhl}
1663 and printed with the @code{lpr} command. You can print all the messages
1664 in a sequence by specifying a prefix argument, in which case you are
1665 prompted for the name of the sequence (as in @kbd{C-u l frombob RET}).
1666
1667 @node Files and Pipes, Finishing Up, Printing, Moving Mail
1668 @subsection Files and Pipes
1669
1670 @cindex using files
1671 @cindex using pipes
1672 @findex @code{mh-write-msg-to-file}
1673
1674 mh-e does offer a couple of commands that are not a part of MH@. The
1675 first one, @kbd{C-o} (@code{mh-write-msg-to-file}), writes a message to
1676 a file (think of the @kbd{o} as in "output"). You are prompted for the
1677 filename. If the file already exists, the message is appended to it.
1678 You can also write the message to the file without the header by
1679 specifying a prefix argument (such as @kbd{C-u C-o /tmp/foobar RET}).
1680 Subsequent writes to the same file can be made with the @kbd{!}
1681 command.
1682
1683 @findex @code{mh-pipe-msg}
1684
1685 You can also pipe the message through a Unix shell command with the
1686 @kbd{|} (@code{mh-pipe-msg}) command. You are prompted for the
1687 Unix command through which you wish to run your message. If you
1688 give an argument to this command, the message header is included in the
1689 text passed to the command (the contrived example @kbd{C-u | lpr}
1690 would be done with the @kbd{l} command instead).
1691
1692 @cindex @code{shar}
1693 @cindex Unix commands, @code{shar}
1694 @cindex @code{uuencode}
1695 @cindex Unix commands, @code{uuencode}
1696 @findex @code{mh-store-msg}
1697
1698 If the message is a shell archive @code{shar} or has been run through
1699 @code{uuencode} use @kbd{M-n} (@code{mh-store-msg}) to extract the body
1700 of the message. The default directory for extraction is the current
1701 directory, and you have a chance to specify a different extraction
1702 directory. The next time you use this command, the default directory is
1703 the last directory you used.
1704
1705 @node Finishing Up, , Files and Pipes, Moving Mail
1706 @subsection Finishing Up
1707
1708 @cindex expunging refiles and deletes
1709 @findex @code{mh-undo}
1710 @findex @code{mh-undo-folder}
1711
1712 If you've deleted a message or refiled it, but changed your mind, you
1713 can cancel the action before you've executed it. Use @kbd{u}
1714 (@code{mh-undo}) to undo a refile on or deletion of a single message.
1715 You can also undo refiles and deletes for messages that belong to a
1716 given sequence by specifying a prefix argument. You'll be prompted for
1717 the name of the sequence (as in @kbd{C-u u frombob RET}).
1718 Alternatively, you can use @kbd{M-u} (@code{mh-undo-folder}) to undo all
1719 refiles or deletes in the current folder.
1720
1721 @findex @code{mh-execute-commands}
1722
1723 If you've marked messages to be deleted or refiled and you want to go
1724 ahead and delete or refile the messages, use @kbd{x}
1725 (@code{mh-execute-commands}). Many mh-e commands that may affect the
1726 numbering of the messages (such as @kbd{M-r} or @kbd{M-p}) will ask if you
1727 want to process refiles or deletes first and then either run @kbd{x} for
1728 you or undo the pending refiles and deletes, which are lost.
1729
1730 @findex @code{mh-rmail}
1731 @findex @code{mh-quit}
1732
1733 When you want to quit using mh-e and go back to editing, you can use the
1734 @kbd{q} (@code{mh-quit}) command. This buries the buffers of the
1735 current mh-e folder and restores the buffers that were present when you
1736 first ran @kbd{M-x mh-rmail}. You can later restore your mh-e session
1737 by selecting the @samp{+inbox} buffer or by running @kbd{M-x mh-rmail}
1738 again.
1739
1740 @node Searching, Sequences, Moving Mail, Using mh-e
1741 @section Searching Through Messages
1742
1743 @cindex searching
1744 @findex @code{mh-search-folder}
1745
1746 You can search a folder for messages to or from a particular person or
1747 about a particular subject. In fact, you can also search for messages
1748 containing selected strings in any arbitrary header field or any string
1749 found within the messages. Use the @kbd{M-s} (@code{mh-search-folder})
1750 command. You are first prompted for the name of the folder to search
1751 and then placed in the following buffer in MH-Pick mode:
1752
1753 @example
1754 @group
1755 @cartouche
1756 From: #
1757 To:
1758 Cc:
1759 Date:
1760 Subject:
1761 --------
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771 --**-Emacs: pick-pattern (MH-Pick)------All--------------------------
1772
1773 @end cartouche
1774 @i{Pick window}
1775 @end group
1776 @end example
1777
1778 @cindex @code{pick}
1779 @cindex MH commands, @code{pick}
1780
1781 Edit this template by entering your search criteria in an appropriate
1782 header field that is already there, or create a new field yourself. If
1783 the string you're looking for could be anywhere in a message, then place
1784 the string underneath the row of dashes. The @kbd{M-s} command uses the
1785 MH command @code{pick} to do the real work, so read @code{pick}(1) to
1786 find out more about how to enter the criteria.
1787
1788 There are no semantics associated with the search criteria---they are
1789 simply treated as strings. Case is ignored when all lowercase is used,
1790 and regular expressions (a la @code{ed}) are available. It is all right
1791 to specify several search criteria. What happens then is that a logical
1792 @emph{and} of the various fields is performed. If you prefer a logical
1793 @emph{or} operation, run @kbd{M-s} multiple times.
1794
1795 As an example, let's say that we want to find messages from Ginnean
1796 about horseback riding in the Kosciusko National Park (Australia) during
1797 January, 1994. Normally we would start with a broad search and narrow
1798 it down if necessary to produce a manageable amount of data, but we'll
1799 cut to the chase and create a fairly restrictive set of criteria as
1800 follows:
1801
1802 @example
1803 @group
1804 From: ginnean
1805 To:
1806 Cc:
1807 Date: Jan 1994
1808 Subject: horse.*kosciusko
1809 --------
1810 @end group
1811 @end example
1812
1813 @findex @code{mh-to-field}
1814
1815 As with MH-Letter mode, MH-Pick provides commands like
1816 @kbd{C-c C-f C-t} to help you fill in the blanks.
1817
1818 @table @kbd
1819 @item C-c C-f C-t
1820 Move to @samp{To:} header field (@code{mh-to-field}).
1821
1822 @item C-c C-f C-c
1823 Move to @samp{cc:} header field (@code{mh-to-field}).
1824
1825 @item C-c C-f C-s
1826 Move to @samp{Subject:} header field (@code{mh-to-field}).
1827
1828 @item C-c C-f C-f
1829 Move to @samp{From:} header field (@code{mh-to-field}).
1830
1831 @item C-c C-f C-b
1832 Move to @samp{Bcc:} header field (@code{mh-to-field}).
1833
1834 @item C-c C-f C-f
1835 Move to @samp{Fcc:} header field (@code{mh-to-field}).
1836
1837 @item C-c C-f C-d
1838 Move to @samp{Dcc:} header field (@code{mh-to-field}).
1839
1840 @item C-c C-c
1841 Execute the search (@code{mh-do-pick-search}).
1842 @end table
1843
1844 @findex @code{mh-do-pick-search}
1845
1846 To perform the search, type @kbd{C-c C-c} (@code{mh-do-pick-search}).
1847 The selected messages are placed in the @i{search} sequence, which you
1848 can use later in forwarding (@pxref{Forwarding}), printing
1849 (@pxref{Printing}), or narrowing your field of view (@pxref{Sequences}).
1850 Subsequent searches are appended to the @i{search} sequence. If,
1851 however, you wish to start with a clean slate, first delete the
1852 @i{search} sequence (how to do this is discussed in @ref{Sequences}).
1853
1854 @cindex MH-Folder mode
1855 @cindex modes, MH-Folder
1856
1857 If you're searching in a folder that is already displayed in a
1858 MH-Folder buffer, only those messages contained in the buffer are
1859 used for the search. Therefore, if you want to search in all messages,
1860 first kill the folder's buffer with @kbd{C-x k} or scan the entire
1861 folder with @kbd{M-r}.
1862
1863 @node Sequences, Miscellaneous, Searching, Using mh-e
1864 @section Using Sequences
1865
1866 @cindex sequences
1867
1868 For the whole scoop on MH sequences, refer to @code{mh-sequence}(5). As
1869 you've read, several of the mh-e commands can operate on a sequence,
1870 which is a shorthand for a range or group of messages. For example, you
1871 might want to forward several messages to a friend or colleague. Here's
1872 how to manipulate sequences.
1873
1874 @table @kbd
1875 @item %
1876 Put message in a sequence (@code{mh-put-msg-in-seq}).
1877
1878 @item ?
1879 Display sequences that message belongs to (@code{mh-msg-is-in-seq}).
1880
1881 @item M-q
1882 List all sequences in folder (@code{mh-list-sequences}).
1883
1884 @item M-%
1885 Remove message from sequence (@code{mh-delete-msg-from-seq}).
1886
1887 @item M-#
1888 Delete sequence (@code{mh-delete-seq}).
1889
1890 @item C-x n
1891 Restrict display to messages in sequence (@code{mh-narrow-to-seq}).
1892
1893 @item C-x w
1894 Remove restriction; display all messages (@code{mh-widen}).
1895
1896 @item M-x mh-update-sequences
1897 Push mh-e's state out to MH@.
1898 @end table
1899
1900 @cindex @code{pick}
1901 @cindex MH commands, @code{pick}
1902 @findex @code{mh-put-msg-in-seq}
1903
1904 To place a message in a sequence, use @kbd{%} (@code{mh-put-msg-in-seq})
1905 to do it manually, or use the MH command @code{pick} or the mh-e version
1906 of @code{pick} (@ref{Searching}) which create a sequence automatically.
1907 Give @kbd{%} a prefix argument and you can add all the messages in one
1908 sequence to another sequence (for example, @kbd{C-u % SourceSequence
1909 RET}).
1910
1911 @cindex MH-Folder mode
1912 @cindex modes, MH-Folder
1913 @findex @code{mh-narrow-to-seq}
1914 @findex @code{mh-widen}
1915
1916 Once you've placed some messages in a sequence, you may wish to narrow
1917 the field of view to just those messages in the sequence you've created.
1918 To do this, use @kbd{C-x n} (@code{mh-narrow-to-seq}). You are prompted
1919 for the name of the sequence. What this does is show only those
1920 messages that are in the selected sequence in the MH-Folder buffer. In
1921 addition, it limits further mh-e searches to just those messages. When
1922 you want to widen the view to all your messages again, use @kbd{C-x w}
1923 (@code{mh-widen}).
1924
1925 @findex @code{mh-msg-is-in-seq}
1926 @findex @code{mh-list-sequences}
1927
1928 You can see which sequences a message is in with the @kbd{?}
1929 (@code{mh-msg-is-in-seq}) command.
1930 @c Doesn't work:
1931 @c use a prefix argument to query a
1932 @c message other than the current one (as in @kbd{C-u ? 42 RET}). XXX
1933 Or, you can list all sequences in a selected folder (default is current
1934 folder) with @kbd{M-q} (@code{mh-list-sequences}).
1935
1936 @findex @code{mh-delete-msg-from-seq}
1937 @findex @code{mh-delete-seq}
1938
1939 If you want to remove a message from a sequence, use @kbd{M-%}
1940 (@code{mh-delete-msg-from-seq}), and if you want to delete an entire
1941 sequence, use @kbd{M-#} (@code{mh-delete-seq}). In the latter case you
1942 are prompted for the sequence to delete. Note that this deletes only
1943 the sequence, not the messages in the sequence. If you want to delete
1944 the messages, use @kbd{C-u d} (see @ref{Deleting} above).
1945
1946 @cindex @code{mark}
1947 @cindex MH commands, @code{mark}
1948
1949 @findex @code{mh-update-sequences}
1950
1951 Two sequences are maintained internally by mh-e and pushed out to MH
1952 when you type either the @kbd{x} or @kbd{q} command. They are the
1953 sequence specified by your @samp{Unseen-Sequence:} profile entry and
1954 @i{cur}. However, you can also just update MH's state with the command
1955 @kbd{M-x mh-update-sequences}. See @ref{Customizing Viewing} for an
1956 example of how this command might be used.
1957
1958 With the exceptions of @kbd{C-x n} and @kbd{C-x w}, the underlying MH
1959 command dealing with sequences is @code{mark}.
1960
1961 @node Miscellaneous, , Sequences, Using mh-e
1962 @section Miscellaneous Commands
1963
1964 @findex @code{mh-version}
1965
1966 One other command worth noting is @kbd{M-x mh-version}. You can
1967 compare the version this command prints to the latest release
1968 (@pxref{Getting mh-e}). The output of @kbd{M-x mh-version} should
1969 always be included with any bug report you submit (@pxref{Bug Reports}).
1970
1971 @node Customizing mh-e, Odds and Ends, Using mh-e, Top
1972 @chapter Customizing mh-e
1973
1974 Until now, we've talked about the mh-e commands as they work ``out of the
1975 box.'' Of course, it is also possible to reconfigure mh-e
1976 to fit the needs of even the most demanding user.
1977 The following sections describe all of the
1978 customization variables, show the defaults, and make recommendations for
1979 customization. The outline of this chapter is identical to that of
1980 @ref{Using mh-e}, to make it easier to find the variables you'd need to
1981 modify to affect a particular command.
1982
1983 However, when customizing your mail environment, first try to change
1984 what you want in MH, and only change mh-e if changing MH is not
1985 possible. That way you will get the same behavior inside and outside
1986 GNU Emacs. Note that mh-e does not provide hooks for customizations
1987 that can be done in MH; this omission is intentional.
1988
1989 @cindex @file{.emacs}
1990 @cindex files, @file{.emacs}
1991
1992 Many string or integer variables are easy enough to modify using Emacs
1993 Lisp. Any such modifications should be placed in a file called
1994 @file{.emacs} in your home directory (that is, @file{~/.emacs}). For
1995 example, to modify the variable that controls printing, you could add:
1996
1997 @vindex @code{mh-lpr-command-format}, example
1998
1999 @lisp
2000 (setq mh-lpr-command-format "nenscript -G -r -2 -i'%s'")
2001 @end lisp
2002
2003 @ref{Customizing Printing} talks more about this variable.
2004
2005 @cindex setting variables
2006 @cindex Emacs, setting variables
2007
2008 Variables can also hold Boolean values. In Emacs Lisp, the Boolean
2009 values are @code{nil}, which means false, and @code{t}, which means true.
2010 Usually, variables are turned off by setting their value to @code{nil}, as
2011 in
2012
2013 @vindex @code{mh-bury-show-buffer}, example
2014
2015 @lisp
2016 (setq mh-bury-show-buffer nil)
2017 @end lisp
2018
2019 which keeps the MH-Show buffer at the top of the buffer stack.
2020 To turn a variable on, you use
2021
2022 @lisp
2023 (setq mh-bury-show-buffer t)
2024 @end lisp
2025
2026 which places the MH-Show buffer at the bottom of the buffer
2027 stack. However, the text says to turn on a variable by setting it to a
2028 @emph{non-@code{nil}} value, because sometimes values other than @code{t} are
2029 meaningful (for example, see @code{mhl-formfile}, described in
2030 @ref{Customizing Viewing}). Other variables, such as hooks, involve a
2031 little more Emacs Lisp programming expertise.
2032
2033 You can also ``preview'' the effects of changing variables before
2034 committing the changes to @file{~/.emacs}. Variables can be changed in
2035 the current Emacs session by using @kbd{M-x set-variable}.
2036
2037 @c XXX Stephen says: would be easier to just call them functions, which
2038 @c you mostly do.
2039 In general, @dfn{commands} in this text refer to Emacs Lisp functions.
2040 Programs outside of Emacs are specifically called MH commands, shell
2041 commands, or Unix commands.
2042
2043 @cindex Emacs, Emacs Lisp manual
2044 @cindex Emacs, online help
2045 @cindex online help
2046 @cindex Emacs, info
2047 @cindex info
2048
2049 I hope I've included enough examples here to get you well on your way.
2050 If you want to explore Emacs Lisp further, a programming manual does
2051 exist,
2052 @c Yes, some of the stuff in the following sections is redundant, but
2053 @c TeX barfs if the @ifs are inside the @footnote.
2054 @iftex
2055 @footnote{The @cite{GNU Emacs Lisp Reference Manual} may be available
2056 online in the Info system by typing @kbd{C-h i m Emacs Lisp RET}. If
2057 not, you can order a printed manual, which has the desirable side-effect
2058 of helping to support the Free Software Foundation which made all this
2059 great software available. You can find an order form by running
2060 @kbd{C-h C-d}, or you can request an order form from
2061 @i{gnu@@gnu.org}.}
2062 @end iftex
2063 @ifinfo
2064 @footnote{Perhaps you can find the online version of @ref{Top, The GNU
2065 Emacs Lisp Reference Manual, , elisp, GNU Emacs Lisp Reference Manual}.
2066 If not, you can order a printed manual, which has the desirable
2067 side-effect of helping to support the Free Software Foundation which
2068 made all this great software available. You can find an order form by
2069 running @kbd{C-h C-d}, or you can request an order form from
2070 @i{gnu@@gnu.org}.}
2071 @end ifinfo
2072 and you can look at the code itself for examples. Look in the Emacs
2073 Lisp directory on your system (such as @file{/usr/local/lib/emacs/lisp})
2074 and find all the @file{mh-*.el} files there. When calling mh-e and
2075 other Emacs Lisp functions directly from Emacs Lisp code, you'll need to
2076 know the correct arguments. Use the online help for this. For example,
2077 try @kbd{C-h f mh-execute-commands RET}. If you write your own
2078 functions, please do not prefix your symbols (variables and functions)
2079 with @code{mh-}. This prefix is reserved for the mh-e package. To
2080 avoid conflicts with existing mh-e symbols, use a prefix like @code{my-}
2081 or your initials.
2082
2083 @menu
2084 * Customizing Reading::
2085 * Customizing Sending::
2086 * Customizing Draft Editing::
2087 * Customizing Moving Mail::
2088 * Customizing Searching::
2089 @end menu
2090
2091 @node Customizing Reading, Customizing Sending, Customizing mh-e, Customizing mh-e
2092 @section Reading Your Mail
2093
2094 @cindex reading mail
2095 @cindex @file{.emacs}
2096 @cindex files, @file{.emacs}
2097
2098 I'll start out by including a function that I use as a front end to
2099 mh-e. @footnote{Stephen Gildea's favorite binding is
2100 @kbd{(global-set-key "\C-cr" 'mh-rmail)}.} It toggles between your
2101 working window configuration, which may be quite involved---windows
2102 filled with source, compilation output, man pages, and other
2103 documentation---and your mh-e window configuration. Like the rest of
2104 the customization described in this chapter, simply add the following
2105 code to @file{~/.emacs}. Don't be intimidated by the size of this
2106 example; most customizations are only one line.
2107
2108 @iftex
2109 @filbreak
2110 @end iftex
2111
2112 @findex @code{mh-rmail}, example
2113
2114 @lisp
2115 @group
2116 @i{Starting mh-e}
2117
2118 (defvar my-mh-screen-saved nil
2119 "Set to non-@code{nil} when mh-e window configuration shown.")
2120 (defvar my-normal-screen nil "Normal window configuration.")
2121 (defvar my-mh-screen nil "mh-e window configuration.")
2122
2123 (defun my-mh-rmail (&optional arg)
2124 "Toggle between mh-e and normal screen configurations.
2125 With non-@code{nil} or prefix argument, @i{inc} mailbox as well
2126 when going into mail."
2127 (interactive "P") ; @r{user callable function, P=prefix arg}
2128 (setq my-mh-screen-saved ; @r{save state}
2129 (cond
2130 ;; @r{Bring up mh-e screen if arg or normal window configuration.}
2131 ;; @r{If arg or +inbox buffer doesn't exist, run mh-rmail.}
2132 ((or arg (null my-mh-screen-saved))
2133 (setq my-normal-screen (current-window-configuration))
2134 (if (or arg (null (get-buffer "+inbox")))
2135 (mh-rmail)
2136 (set-window-configuration my-mh-screen))
2137 t) ; @r{set my-mh-screen-saved to @code{t}}
2138 ;; @r{Otherwise, save mh-e screen and restore normal screen.}
2139 (t
2140 (setq my-mh-screen (current-window-configuration))
2141 (set-window-configuration my-normal-screen)
2142 nil)))) ; @r{set my-mh-screen-saved to nil}
2143
2144 (global-set-key "\C-x\r" 'my-mh-rmail) ;@r{ call with C-x RET}
2145 @end group
2146 @end lisp
2147
2148 If you type an argument (@kbd{C-u}) or if @code{my-mh-screen-saved}
2149 is @code{nil} (meaning a non-mh-e window configuration), the current window
2150 configuration is saved, either +inbox is displayed or @code{mh-rmail} is
2151 run, and the mh-e window configuration is shown. Otherwise, the mh-e
2152 window configuration is saved and the original configuration is
2153 displayed.
2154
2155 Now to configure mh-e. The following table lists general mh-e variables
2156 and variables that are used while reading mail.
2157 @c XXX Seth wishes the descriptions to be more parallel. That is,
2158 @c some are actions, and some are objects. Hmmm.
2159
2160 @table @code
2161 @item mh-progs
2162 Directory containing MH programs (default: dynamic).
2163
2164 @item mh-lib
2165 Directory containing MH support files and programs (default: dynamic).
2166
2167 @item mh-do-not-confirm
2168 Don't confirm on non-reversible commands (default: @code{nil}).
2169
2170 @item mh-summary-height
2171 Number of scan lines to show (includes mode line) (default: 4).
2172
2173 @item mh-folder-mode-hook
2174 Functions to run in MH-Folder mode (default: @code{nil}).
2175
2176 @item mh-clean-message-header
2177 Remove extraneous headers (default: @code{nil}).
2178
2179 @item mh-invisible-headers
2180 Headers to hide (default: @samp{"^Received: \\| ^Message-Id: \\|
2181 ^Remailed-\\| ^Via: \\| ^Mail-from: \\| ^Return-Path: \\| ^In-Reply-To:
2182 \\| ^Resent-"}).
2183
2184 @item mh-visible-headers
2185 Headers to display (default: @code{nil}).
2186
2187 @item mhl-formfile
2188 Format file for @code{mhl} (default: @code{nil}).
2189
2190 @item mh-show-hook
2191 Functions to run when showing message (default: @code{nil}).
2192
2193 @item mh-show-mode-hook
2194 Functions to run when showing message (default: @code{nil}).
2195
2196 @item mh-bury-show-buffer
2197 Leave show buffer at bottom of stack (default: @code{t}).
2198
2199 @item mh-show-buffer-mode-line-buffer-id
2200 Name of show buffer in mode line (default: @samp{"@{show-%s@} %d"}).
2201 @end table
2202
2203 @vindex @code{mh-progs}
2204 @vindex @code{mh-lib}
2205
2206 The two variables @code{mh-progs} and @code{mh-lib} are used to tell
2207 mh-e where the MH programs and supporting files are kept, respectively.
2208 mh-e does try to figure out where they are kept for itself by looking in
2209 common places and in the user's @samp{PATH} environment variable, but if
2210 it cannot find the directories, or finds the wrong ones, you should set
2211 these variables. The name of the directory should be placed in double
2212 quotes, and there should be a
2213 trailing slash (@samp{/}). See the example in @ref{Getting Started}.
2214
2215 @vindex @code{mh-do-not-confirm}
2216 @findex @code{mh-kill-folder}
2217
2218 If you never make mistakes, and you do not like confirmations for your
2219 actions, you can set @code{mh-do-not-confirm} to a non-@code{nil} value to
2220 disable confirmation for unrecoverable commands such as @kbd{M-k}
2221 (@code{mh-kill-folder}) and @kbd{M-u} (@code{mh-undo-folder}). Here's
2222 how you set boolean values:
2223
2224 @lisp
2225 (setq mh-do-not-confirm t)
2226 @end lisp
2227
2228 @vindex @code{mh-summary-height}
2229 @cindex MH-Folder mode
2230 @cindex modes, MH-Folder
2231
2232 @c Prevent page break between paragraph and example.
2233 @need 2000
2234 The variable @code{mh-summary-height} controls the number of scan lines
2235 displayed in the MH-Folder window, including the mode line. The
2236 default value of 4 means that 3 scan lines are displayed. Here's how
2237 you set numerical values:
2238
2239 @lisp
2240 (setq mh-summary-height 2) ; @r{only show the current scan line}
2241 @end lisp
2242
2243 @vindex @code{mh-bury-show-buffer}
2244 @cindex MH-Folder mode
2245 @cindex modes, MH-Folder
2246
2247 Normally the buffer for displaying messages is buried at the bottom at
2248 the buffer stack. You may wish to disable this feature by setting
2249 @code{mh-bury-show-buffer} to @code{nil}. One advantage of not burying the
2250 show buffer is that one can delete the show buffer more easily in an
2251 electric buffer list because of its proximity to its associated
2252 MH-Folder buffer. Try running @kbd{M-x electric-buffer-list} to
2253 see what I mean.
2254
2255 @vindex @code{mh-folder-mode-hook}
2256 @cindex MH-Folder mode
2257 @cindex modes, MH-Folder
2258
2259 The hook @code{mh-folder-mode-hook} is called when a new folder is
2260 created with MH-Folder mode. This could be used to set your own
2261 key bindings, for example:
2262
2263 @vindex @code{mh-folder-mode-hook}, example
2264
2265 @lisp
2266 @group
2267 @i{Create additional key bindings via mh-folder-mode-hook}
2268
2269 (defvar my-mh-init-done nil "Non-@code{nil} when one-time mh-e settings made.")
2270
2271 (defun my-mh-folder-mode-hook ()
2272 "Hook to set key bindings in MH-Folder mode."
2273 (if (not my-mh-init-done) ; @r{only need to bind the keys once }
2274 (progn
2275 (local-set-key "/" 'search-msg)
2276 (local-set-key "b" 'mh-burst-digest) ; @r{better use of @kbd{b}}
2277 (setq my-mh-init-done t))))
2278
2279 ;;; @r{Emacs 19}
2280 (add-hook 'mh-folder-mode-hook 'my-mh-folder-mode-hook)
2281 ;;; @r{Emacs 18}
2282 ;;; @r{(setq mh-folder-mode-hook (cons 'my-mh-folder-mode-hook}
2283 ;;; @r{mh-folder-mode-hook))}
2284
2285 (defun search-msg ()
2286 "Search for a regexp in the current message."
2287 (interactive) ; @r{user function}
2288 (save-window-excursion
2289 (other-window 1) ; @r{go to next window}
2290 (isearch-forward-regexp))) ; @r{string search; hit return (ESC}
2291 ; @r{in Emacs 18) when done}
2292 @end group
2293 @end lisp
2294
2295 @menu
2296 * Customizing Viewing::
2297 * Customizing Moving Around::
2298 @end menu
2299
2300 @node Customizing Viewing, Customizing Moving Around, Customizing Reading, Customizing Reading
2301 @subsection Viewing Your Mail
2302
2303 @vindex @code{mh-clean-message-header}
2304 @vindex @code{mh-invisible-headers}
2305 @vindex @code{mh-visible-headers}
2306
2307 Several variables control what displayed messages look like. Normally
2308 messages are delivered with a handful of uninteresting header fields.
2309 You can make them go away by setting @code{mh-clean-message-header} to a
2310 non-@code{nil} value. The header can then be cleaned up in two ways. By
2311 default, the header fields in @code{mh-invisible-headers} are removed.
2312 On the other hand, you could set @code{mh-visible-headers} to the fields
2313 that you would like to see. If this variable is set,
2314 @code{mh-invisible-headers} is ignored. I suggest that you not set
2315 @code{mh-visible-headers} since if you use this variable, you might miss
2316 a lot of header fields that you'd rather not miss. As an example of how
2317 to set a string variable, @code{mh-visible-headers} can be set to show a
2318 minimum set of header fields (see (@ref{Regexps, , Syntax of Regular
2319 Expressions, emacs, The GNU Emacs Manual}, for a description of the
2320 special characters in this string):
2321
2322 @lisp
2323 (setq mh-visible-headers "^From: \\|^Subject: \\|^Date: ")
2324 @end lisp
2325
2326 @cindex @code{mhl}
2327 @cindex MH commands, @code{mhl}
2328 @vindex @code{mhl-formfile}
2329
2330 Normally mh-e takes care of displaying messages itself (rather than
2331 calling an MH program to do the work). If you'd rather have @code{mhl}
2332 display the message (within mh-e), set the variable @code{mhl-formfile}
2333 to a non-@code{nil} value. You can set this variable either to @code{t}
2334 to use the default format file or to a filename if you have your own
2335 format file (@code{mhl}(1) tells you how to write one). When writing
2336 your own format file, use a nonzero value for @code{overflowoffset} to
2337 ensure the header is RFC 822 compliant and parsable by mh-e.
2338 @code{mhl} is always used for printing and forwarding; in this case, the
2339 value of @code{mhl-formfile} is consulted if it is a filename.
2340
2341 @vindex @code{mh-show-mode-hook}
2342
2343 Two hooks can be used to control how messages are displayed. The first
2344 hook, @code{mh-show-mode-hook}, is called early on in the process of
2345 displaying of messages. It is used to perform some actions on the
2346 contents of messages, such as highlighting the header fields. If you're
2347 running Emacs 19 under the X Window System, the following example will
2348 highlight the @samp{From:} and @samp{Subject:} header fields. This is a
2349 very nice feature indeed.
2350
2351 @vindex @code{mh-show-mode-hook}, example
2352
2353 @lisp
2354 @group
2355 @i{Emphasize header fields in different fonts via mh-show-mode-hook}
2356
2357 (defvar my-mh-keywords
2358 '(("^From: \\(.*\\)" 1 'bold t)
2359 ("^Subject: \\(.*\\)" 1 'highlight t))
2360 "mh-e additions for font-lock-keywords.")
2361
2362 (defun my-mh-show-mode-hook ()
2363 "Hook to turn on and customize fonts."
2364 (font-lock-add-keywords nil my-mh-keywords))
2365
2366 (add-hook 'mh-show-mode-hook 'my-mh-show-mode-hook))
2367 @end group
2368 @end lisp
2369
2370 @vindex @code{mh-show-hook}
2371
2372 The second hook, @code{mh-show-hook}, is the last thing called after
2373 messages are displayed. It's used to affect the behavior of mh-e in
2374 general or when @code{mh-show-mode-hook} is too early. For example, if
2375 you wanted to keep mh-e in sync with MH, you could use
2376 @code{mh-show-hook} as follows:
2377
2378 @vindex @code{mh-show-hook}, example
2379
2380 @lisp
2381 (add-hook 'mh-show-hook 'mh-update-sequences)
2382 @end lisp
2383
2384 @vindex @code{mh-show-buffer-mode-line-buffer-id}
2385 @cindex MH-Show mode
2386 @cindex modes, MH-Show
2387
2388 The function @code{mh-update-sequences} is documented in @ref{Finishing
2389 Up}. For those who like to modify their mode lines, use
2390 @code{mh-show-buffer-mode-line-buffer-id} to modify the mode line in the
2391 MH-Show buffers. Place the two escape strings @samp{%s} and @samp{%d},
2392 which will display the folder name and the message number, respectively,
2393 somewhere in the string in that order. The default value of
2394 @samp{"@{show-%s@} %d"} yields a mode line of
2395
2396 @example
2397 -----@{show-+inbox@} 4 (MH-Show)--Bot--------------------------------
2398 @end example
2399
2400 @node Customizing Moving Around, , Customizing Viewing, Customizing Reading
2401 @subsection Moving Around
2402
2403 @cindex moving between messages
2404 @cindex MH-Show mode
2405 @cindex modes, MH-Show
2406 @cindex MH-Folder mode
2407 @cindex modes, MH-Folder
2408 @vindex @code{mh-recenter-summary-p}
2409
2410 When you use @kbd{t} (@code{mh-toggle-showing}) to toggle between show
2411 mode and scan mode, the MH-Show buffer is hidden and the
2412 MH-Folder buffer is left alone. Setting
2413 @code{mh-recenter-summary-p} to a non-@code{nil} value causes the toggle to
2414 display as many scan lines as possible, with the cursor at the middle.
2415 The effect of @code{mh-recenter-summary-p} is rather useful, but it can
2416 be annoying on a slow network connection.
2417
2418 @node Customizing Sending, Customizing Draft Editing, Customizing Reading, Customizing mh-e
2419 @section Sending Mail
2420
2421 @cindex sending mail
2422
2423 You may wish to start off by adding the following useful key bindings to
2424 your @file{.emacs} file:
2425
2426 @lisp
2427 (global-set-key "\C-xm" 'mh-smail)
2428 (global-set-key "\C-x4m" 'mh-smail-other-window)
2429 @end lisp
2430
2431 In addition, several variables are useful when sending mail or replying
2432 to mail. They are summarized in the following table.
2433
2434 @table @code
2435 @item mh-comp-formfile
2436 Format file for drafts (default: @samp{"components"}).
2437
2438 @item mh-repl-formfile
2439 Format file for replies (default: @samp{"replcomps"}).
2440
2441 @item mh-letter-mode-hook
2442 Functions to run in MH-Letter mode (default: @code{nil}).
2443
2444 @item mh-compose-letter-function
2445 Functions to run when starting a new draft (default: @code{nil}).
2446
2447 @item mh-reply-default-reply-to
2448 Whom reply goes to (default: @code{nil}).
2449
2450 @item mh-forward-subject-format
2451 Format string for forwarded message subject (default: @samp{"%s: %s"}).
2452
2453 @item mh-redist-full-contents
2454 @code{send} requires entire message (default: @code{nil}).
2455
2456 @item mh-new-draft-cleaned-headers
2457 Remove these header fields from re-edited draft. The default is:
2458 @example
2459 "^Date:\\| ^Received:\\| ^Message-Id:\\| ^From:\\|
2460 ^Sender:\\| ^Delivery-Date:\\| ^Return-Path:".
2461 @end example
2462 @end table
2463
2464 @cindex @code{comp}
2465 @cindex MH commands, @code{comp}
2466 @vindex @code{mh-comp-formfile}
2467 @cindex @file{components}
2468 @cindex files, @file{components}
2469 @cindex @code{repl}
2470 @cindex MH commands, @code{repl}
2471 @cindex @file{replcomps}
2472 @cindex files, @file{replcomps}
2473 @vindex @code{mh-repl-formfile}
2474
2475 Since mh-e does not use @code{comp} to create the initial draft, you
2476 need to set @code{mh-comp-formfile} to the name of your components file
2477 if it isn't @file{components}. This is the name of the file that
2478 contains the form for composing messages. If it does not contain an
2479 absolute pathname, mh-e searches for the file first in your MH directory
2480 and then in the system MH library directory (such as
2481 @file{/usr/local/lib/mh}). Replies, on the other hand, are built using
2482 @code{repl}. You can change the location of the field file from the
2483 default of @file{replcomps} by modifying @code{mh-repl-formfile}.
2484
2485 @vindex @code{mh-letter-mode-hook}
2486 @cindex @code{repl}
2487 @cindex MH commands, @code{repl}
2488 @cindex @file{components}
2489 @cindex files, @file{components}
2490
2491 Two hooks are provided to run commands on your freshly created draft.
2492 The first hook, @code{mh-letter-mode-hook}, allows you to do some
2493 processing before editing a letter. For example, you may wish to modify
2494 the header after @code{repl} has done its work, or you may have a
2495 complicated @file{components} file and need to tell mh-e where the
2496 cursor should go. Here's an example of how you would use this hook---all
2497 of the other hooks are set in this fashion as well.
2498
2499 @findex @code{mh-insert-signature}, example
2500
2501 @lisp
2502 @group
2503 @i{Prepare draft for editing via mh-letter-mode-hook}
2504
2505 (defvar letter-mode-init-done nil
2506 "Non-@code{nil} when one-time mh-e settings have made.")
2507
2508 (defun my-mh-letter-mode-hook ()
2509 "Hook to prepare letter for editing."
2510 (if (not letter-mode-init-done) ; @r{only need to bind the keys once}
2511 (progn
2512 (local-set-key "\C-ctb" 'add-enriched-text)
2513 (local-set-key "\C-cti" 'add-enriched-text)
2514 (local-set-key "\C-ctf" 'add-enriched-text)
2515 (local-set-key "\C-cts" 'add-enriched-text)
2516 (local-set-key "\C-ctB" 'add-enriched-text)
2517 (local-set-key "\C-ctu" 'add-enriched-text)
2518 (local-set-key "\C-ctc" 'add-enriched-text)
2519 (setq letter-mode-init-done t)))
2520 (setq fill-prefix " ") ; @r{I find indented text easier to read}
2521 (save-excursion
2522 (goto-char (point-max)) ; @r{go to end of message to}
2523 (mh-insert-signature))) ; @r{insert signature}
2524
2525 (add-hook 'mh-letter-mode-hook 'my-mh-letter-mode-hook)
2526 @end group
2527 @end lisp
2528
2529 The function, @code{add-enriched-text} is defined in the example in
2530 @ref{Customizing Editing MIME}.
2531
2532 @vindex @code{mh-compose-letter-function}
2533
2534 The second hook, a function really, is
2535 @code{mh-compose-letter-function}. Like @code{mh-letter-mode-hook}, it
2536 is called just before editing a new message; however, it is the last
2537 function called before you edit your message. The consequence of this
2538 is that you can write a function to write and send the message for you.
2539 This function is passed three arguments: the contents of the @samp{To:},
2540 @samp{Subject:}, and @samp{cc:} header fields.
2541
2542 @menu
2543 * Customizing Replying::
2544 * Customizing Forwarding::
2545 * Customizing Redistributing::
2546 * Customizing Old Drafts::
2547 @end menu
2548
2549 @node Customizing Replying, Customizing Forwarding, Customizing Sending, Customizing Sending
2550 @subsection Replying to Mail
2551
2552 @cindex replying
2553 @vindex @code{mh-reply-default-reply-to}
2554
2555 If you find that most of the time that you specify @kbd{cc} when you
2556 reply to a message, set @code{mh-reply-default-reply-to} to @samp{cc}.
2557 This variable is normally set to @code{nil} so that you are prompted for
2558 the recipient of a reply. It can be set to one of @samp{from},
2559 @samp{to}, or @samp{cc}; you are then no longer prompted for the
2560 recipient(s) of your reply.
2561
2562 @node Customizing Forwarding, Customizing Redistributing, Customizing Replying, Customizing Sending
2563 @subsection Forwarding Mail
2564
2565 @cindex forwarding
2566 @vindex @code{mh-forward-subject-format}
2567
2568 When forwarding a message, the format of the @samp{Subject:} header
2569 field can be modified by the variable @code{mh-forward-subject-format}.
2570 This variable is a string which includes two escapes (@samp{%s}). The
2571 first @samp{%s} is replaced with the sender of the original message, and
2572 the second one is replaced with the original @samp{Subject:}. The
2573 default value of @samp{"%s: %s"} takes a message with the header:
2574
2575 @example
2576 @group
2577 To: Bill Wohler <wohler@@newt.com>
2578 Subject: Re: 49er football
2579 From: Greg DesBrisay <gd@@cellnet.com>
2580 @end group
2581 @end example
2582
2583 and creates a subject header field of:
2584
2585 @example
2586 Subject: Greg DesBrisay: Re: 49er football
2587 @end example
2588
2589 @node Customizing Redistributing, Customizing Old Drafts, Customizing Forwarding, Customizing Sending
2590 @subsection Redistributing Your Mail
2591
2592 @cindex redistributing
2593 @vindex @code{mh-redist-full-contents}
2594 @cindex @code{dist}
2595 @cindex MH commands, @code{dist}
2596 @cindex @code{send}
2597 @cindex MH commands, @code{send}
2598
2599 The variable @code{mh-redist-full-contents} must be set to non-@code{nil} if
2600 @code{dist} requires the whole letter for redistribution, which is the
2601 case if @code{send} is compiled with the @sc{berk} @footnote{To see which
2602 options your copy of MH was compiled with, use @kbd{M-x mh-version}
2603 (@ref{Miscellaneous}).} option (which many people abhor). If you find
2604 that MH will not allow you to redistribute a message that has been
2605 redistributed before, this variable should be set to @code{nil}.
2606
2607 @node Customizing Old Drafts, , Customizing Redistributing, Customizing Sending
2608 @subsection Editing Old Drafts and Bounced Messages
2609
2610 @cindex re-editing drafts
2611 @vindex @code{mh-new-draft-cleaned-headers}
2612
2613 The header fields specified by @code{mh-new-draft-cleaned-headers} are
2614 removed from an old draft that has been recreated with @kbd{M-e}
2615 (@code{mh-extract-rejected-mail}) or @kbd{M-a} (@code{mh-edit-again}).
2616 If when you edit an old draft with these commands you find that there
2617 are header fields that you don't want included, you can append them to
2618 this variable. For example,
2619
2620 @vindex @code{mh-new-draft-cleaned-headers}, example
2621
2622 @lisp
2623 (setq mh-new-draft-cleaned-headers
2624 (concat mh-new-draft-cleaned-headers "\\|^Some-Field:"))
2625 @end lisp
2626
2627 @cindex regular expressions
2628
2629 This appends the regular expression @samp{\\|^Some-Field:} to the
2630 variable (@pxref{Regexps, , Syntax of Regular Expressions, emacs, The
2631 GNU Emacs Manual}). The @samp{\\|} means @emph{or}, and the @samp{^}
2632 (caret) matches the beginning of the line. This is done to be very
2633 specific about which fields match. The literal @samp{:} is appended for
2634 the same reason.
2635
2636 @node Customizing Draft Editing, Customizing Moving Mail, Customizing Sending, Customizing mh-e
2637 @section Editing a Draft
2638
2639 @cindex editing draft
2640
2641 There are several variables used during the draft editing phase.
2642 Examples include changing the name of the file that holds your signature
2643 or telling mh-e about new multimedia types. They are:
2644
2645 @table @code
2646 @item mh-yank-from-start-of-msg
2647 How to yank when region not set (default: @code{t}).
2648
2649 @item mh-ins-buf-prefix
2650 Indent for yanked messages (default: @samp{"> "}).
2651
2652 @item mail-citation-hook
2653 Functions to run on yanked messages (default: @code{nil}).
2654
2655 @item mh-delete-yanked-msg-window
2656 Delete message window on yank (default: @code{nil}).
2657
2658 @c Need the @* because otherwise TeX fills it wrong and complains
2659 @c about overfull hbox.
2660 @item mh-mime-content-types
2661 List of valid content types (default: @samp{'(("text/plain")@*
2662 ("text/richtext") ("multipart/mixed") ("multipart/alternative")@*
2663 ("multipart/digest") ("multipart/parallel") ("message/rfc822")@*
2664 ("message/partial") ("message/external-body")@*
2665 ("application/octet-stream") ("application/postscript")@*
2666 ("image/jpeg") ("image/gif") ("audio/basic") ("video/mpeg"))}).
2667
2668 @item mh-mhn-args
2669 Additional arguments for @code{mhn} (default: @code{nil}).
2670
2671 @item mh-signature-file-name
2672 File containing signature (default: @samp{"~/.signature"}).
2673
2674 @item mh-before-send-letter-hook
2675 Functions to run before sending draft (default: @code{nil}).
2676
2677 @item mh-send-prog
2678 MH program used to send messages (default: @samp{"send"}).
2679 @end table
2680
2681 @menu
2682 * Customizing Editing Textual::
2683 * Customizing Editing MIME::
2684 * Customizing Sending Message::
2685 @end menu
2686
2687 @node Customizing Editing Textual, Customizing Editing MIME, Customizing Draft Editing, Customizing Draft Editing
2688 @subsection Editing Textual Messages
2689
2690 The following two sections include variables that customize the way you
2691 edit a draft. The discussion here applies to editing multimedia
2692 messages as well.
2693
2694 @menu
2695 * Customizing Inserting Letter::
2696 * Customizing Signature::
2697 @end menu
2698
2699 @node Customizing Inserting Letter, Customizing Signature, Customizing Editing Textual, Customizing Editing Textual
2700 @subsubsection Inserting letter to which you're replying
2701
2702 @cindex inserting messages
2703 @vindex @code{mh-yank-from-start-of-msg}
2704 @vindex @code{mh-ins-buf-prefix}
2705 @vindex @code{mail-citation-hook}
2706 @vindex @code{mh-ins-buf-prefix}
2707 @vindex @code{mh-delete-yanked-msg-window}
2708
2709 To control how much of the message to which you are replying is yanked
2710 by @kbd{C-c C-y} (@code{mh-yank-cur-msg}) into your reply, modify
2711 @code{mh-yank-from-start-of-msg}. The default value of @code{t} means
2712 that the entire message is copied. If it is set to @code{'body} (don't
2713 forget the apostrophe), then only the message body is copied. If it is
2714 set to @code{nil}, only the part of the message following point (the
2715 current cursor position in the message's buffer) is copied. In any
2716 case, this variable is ignored if a region is set in the message you are
2717 replying to. The string contained in @code{mh-ins-buf-prefix} is
2718 inserted before each line of a message that is inserted into a draft
2719 with @kbd{C-c C-y} (@code{mh-yank-cur-msg}). I suggest that you not
2720 modify this variable. The default value of @samp{"> "} is the default
2721 string for many mailers and news readers: messages are far easier to
2722 read if several included messages have all been indented by the same
2723 string. The variable @code{mail-citation-hook} is @code{nil} by
2724 default, which means that when a message is inserted into the letter,
2725 each line is prefixed by @code{mh-ins-buf-prefix}. Otherwise, it can be
2726 set to a function that modifies an included
2727 @cindex Emacs, packages, supercite
2728 citation.
2729 @c Footnotes are fragile; hence the redundancy.
2730 @c TeX not inserting a line break; hence the @*
2731 @ifclear html
2732 @footnote{@emph{Supercite} is an example of a full-bodied, full-featured
2733 citation package. It is in Emacs versions 19.15 and later, and can be
2734 found via anonymous @code{ftp} on @samp{archive.cis.ohio-state.edu} in
2735 @* @file{/pub/gnu/emacs/elisp-archive/packages/sc3.1.tar.Z}}
2736 @end ifclear
2737 @ifset html
2738 @footnote{@emph{Supercite} is an example of a full-bodied,
2739 full-featured citation package. It is in Emacs versions 19.15 and
2740 later, and its @sc{url} is @*
2741 @file{<A HREF="ftp://archive.cis.ohio-state.edu/pub/gnu/emacs/elisp-archive/packages/sc3.1.tar.Z">ftp://archive.cis.ohio-state.edu/pub/gnu/emacs/elisp-archive/packages/sc3.1.tar.Z</A>}}
2742 @end ifset
2743 If you like to yank all the text from the message you're replying to in
2744 one go, set @code{mh-delete-yanked-msg-window} to non-@code{nil} to delete
2745 the window containing the original message after yanking it to make more
2746 room on your screen for your reply.
2747
2748 @node Customizing Signature, , Customizing Inserting Letter, Customizing Editing Textual
2749 @subsubsection Inserting your signature
2750
2751 @cindex inserting signature
2752 @cindex signature
2753 @vindex @code{mh-signature-file-name}
2754 @cindex @file{.signature}
2755 @cindex files, @file{.signature}
2756
2757 You can change the name of the file inserted with @kbd{C-c C-s}
2758 (@code{mh-insert-signature}) by changing @code{mh-signature-file-name}
2759 (default: @file{"~/.signature"}).
2760
2761 @node Customizing Editing MIME, Customizing Sending Message, Customizing Editing Textual, Customizing Draft Editing
2762 @subsection Editing Multimedia Messages
2763
2764 @cindex MIME
2765 @cindex multimedia mail
2766 @vindex @code{mh-mime-content-types}
2767
2768 The variable @code{mh-mime-content-types} contains a list of the
2769 currently valid content types. They are listed in the table in
2770 @ref{Customizing Draft Editing}. If you encounter a new content type,
2771 you can add it like this:
2772
2773 @vindex @code{mh-mime-content-types}, example
2774
2775 @lisp
2776 (setq mh-mime-content-types (append mh-mime-content-types
2777 '(("@var{new/type}"))))
2778 @end lisp
2779
2780 Emacs macros can be used to insert enriched text directives like
2781 @samp{<bold>}. The following code will make, for example, @kbd{C-c t
2782 b} insert the @samp{<bold>} directive.
2783
2784 @smallexample
2785 @group
2786 @i{Emacs macros for entering enriched text}
2787
2788 (defvar enriched-text-types '(("b" . "bold") ("i" . "italic")
2789 ("f" . "fixed") ("s" . "smaller")
2790 ("B" . "bigger") ("u" . "underline")
2791 ("c" . "center"))
2792 "Alist of (final-character . directive) choices for add-enriched-text.
2793 Additional types can be found in RFC 1563.")
2794
2795 (defun add-enriched-text (begin end)
2796 "Add enriched text directives around region.
2797 The directive used comes from the list enriched-text-types and is
2798 specified by the last keystroke of the command. When called from Lisp,
2799 arguments are BEGIN and END@."
2800 (interactive "r")
2801 ;; @r{Set type to the directive indicated by the last keystroke.}
2802 (let ((type (cdr (assoc (char-to-string (logior last-input-char ?@w{`}))
2803 enriched-text-types))))
2804 (save-restriction ; @r{restores state from narrow-to-region}
2805 (narrow-to-region begin end) ; @r{narrow view to region}
2806 (goto-char (point-min)) ; @r{move to beginning of text}
2807 (insert "<" type ">") ; @r{insert beginning directive}
2808 (goto-char (point-max)) ; @r{move to end of text}
2809 (insert "</" type ">")))) ; @r{insert terminating directive}
2810 @end group
2811 @end smallexample
2812
2813 To use the function @code{add-enriched-text}, first create key bindings
2814 for it (@pxref{Customizing Sending}). Then, set the mark with
2815 @kbd{C-@@} or @kbd{C-SPC}, type in the text to be highlighted, and type
2816 @kbd{C-c t b}. This adds @samp{<bold>} where you set the mark and
2817 adds @samp{</bold>} at the location of your cursor, giving you something
2818 like: @samp{You should be <bold>very</bold>}. You may also be
2819 interested in investigating @code{sgml-mode}.
2820
2821 @menu
2822 * Customizing Sending MIME::
2823 @end menu
2824
2825 @node Customizing Sending MIME, , Customizing Editing MIME, Customizing Editing MIME
2826 @subsubsection Readying multimedia messages for sending
2827
2828 @vindex @code{mh-mhn-args}
2829
2830 If you wish to pass additional arguments to @code{mhn} to affect how it
2831 builds your message, use the variable @code{mh-mhn-args}. For example,
2832 you can build a consistency check into the message by setting
2833 @code{mh-mhn-args} to @code{-check}. The recipient of your message can
2834 then run @code{mhn -check} on the message---@code{mhn} will complain if
2835 the message has been corrupted on the way. The @kbd{C-c C-e}
2836 (@code{mh-mhn-edit}) command only consults this variable when given a
2837 prefix argument.
2838
2839 @node Customizing Sending Message, , Customizing Editing MIME, Customizing Draft Editing
2840 @subsection Sending a Message
2841
2842 @cindex sending mail
2843 @cindex spell check
2844 @vindex @code{mh-before-send-letter-hook}
2845
2846 If you want to check your spelling in your message before sending, use
2847 @code{mh-before-send-letter-hook} like this:
2848
2849 @i{Spell-check message via mh-before-send-letter-hook}
2850
2851 @vindex @code{mh-before-send-letter-hook}, example
2852
2853 @lisp
2854 (add-hook 'mh-before-send-letter-hook 'ispell-message)
2855 @end lisp
2856
2857 @cindex @code{send}
2858 @cindex MH commands, @code{send}
2859 @vindex @code{mh-send-prog}
2860
2861 In case the MH @code{send} program is installed under a different name,
2862 use @code{mh-send-prog} to tell mh-e the name.
2863
2864 @node Customizing Moving Mail, Customizing Searching, Customizing Draft Editing, Customizing mh-e
2865 @section Moving Your Mail Around
2866
2867 @cindex processing mail
2868
2869 If you change the name of some of the MH programs or have your own
2870 printing programs, the following variables can help you.
2871 They are described in detail in the subsequent sections.
2872
2873 @table @code
2874 @item mh-inc-prog
2875 Program to incorporate mail (default: @samp{"inc"}).
2876
2877 @item mh-inc-folder-hook
2878 Functions to run when incorporating mail (default: @code{nil}).
2879
2880 @item mh-delete-msg-hook
2881 Functions to run when deleting messages (default: @code{nil}).
2882
2883 @item mh-print-background
2884 Print in foreground or background (default: @code{nil}).
2885
2886 @item mh-lpr-command-format
2887 Command used to print (default: @samp{"lpr -J '%s'"}).
2888
2889 @item mh-default-folder-for-message-function
2890 Function to generate a default folder (default: @code{nil}).
2891
2892 @item mh-auto-folder-collect
2893 Collect folder names in background at startup (default: @code{t}).
2894
2895 @item mh-recursive-folders
2896 Collect nested folders (default: @code{nil}).
2897
2898 @item mh-refile-msg-hook
2899 Functions to run when refiling message (default: @code{nil}).
2900
2901 @item mh-store-default-directory
2902 Default directory for storing files created by @code{uuencode} or @code{shar}
2903 (default: @code{nil}).
2904
2905 @item mh-sortm-args
2906 Additional arguments for @code{sortm} (default: @code{nil}).
2907
2908 @item mh-scan-prog
2909 Program to scan messages (default: @samp{"scan"}).
2910
2911 @item mh-before-quit-hook
2912 Functions to run before quitting (default: @code{nil}). See also
2913 @code{mh-quit-hook}.
2914
2915 @item mh-quit-hook
2916 Functions to run after quitting (default: @code{nil}). See also
2917 @code{mh-before-quit-hook}.
2918 @end table
2919
2920 @menu
2921 * Customizing Incorporating::
2922 * Customizing Deleting::
2923 * Customizing Organizing::
2924 * Customizing Printing::
2925 * Customizing Files and Pipes::
2926 * Customizing Finishing Up::
2927 @end menu
2928
2929 @node Customizing Incorporating, Customizing Deleting, Customizing Moving Mail, Customizing Moving Mail
2930 @subsection Incorporating Your Mail
2931
2932 @cindex incorporating
2933 @vindex @code{mh-inc-prog}
2934 @cindex @code{inc}
2935 @cindex MH commands, @code{inc}
2936 @vindex @code{mh-progs}
2937 @vindex @code{mh-scan-prog}
2938 @vindex @code{mh-inc-folder-hook}
2939
2940 The name of the program that incorporates new mail is stored in
2941 @code{mh-inc-prog}; it is @samp{"inc"} by default. This program
2942 generates a one-line summary for each of the new messages. Unless it is
2943 an absolute pathname, the file is assumed to be in the @code{mh-progs}
2944 directory. You may also link a file to @code{inc} that uses a different
2945 format (see @code{mh-profile}(5)). You'll then need to modify several
2946 variables appropriately; see @code{mh-scan-prog} below. You can set the
2947 hook @code{mh-inc-folder-hook}, which is called after new mail is
2948 incorporated by the @kbd{i} (@code{mh-inc-folder}) command. A good use
2949 of this hook is to rescan the whole folder either after running @kbd{M-x
2950 mh-rmail} the first time or when you've changed the message numbers from
2951 outside of mh-e.
2952
2953 @findex @code{mh-execute-commands}
2954 @findex @code{mh-rescan-folder}, example
2955 @findex @code{mh-show}, example
2956 @vindex @code{mh-inc-folder-hook}, example
2957
2958 @lisp
2959 @group
2960 @i{Rescan folder after incorporating new mail via mh-inc-folder-hook}
2961
2962 (defun my-mh-inc-folder-hook ()
2963 "Hook to rescan folder after incorporating mail."
2964 (if (buffer-modified-p) ; @r{if outstanding refiles and deletes,}
2965 (mh-execute-commands)) ; @r{carry them out}
2966 (mh-rescan-folder) ; @r{synchronize with +inbox}
2967 (mh-show)) ; @r{show the current message}
2968
2969 (add-hook 'mh-inc-folder-hook 'my-mh-inc-folder-hook)
2970 @end group
2971 @end lisp
2972
2973 @node Customizing Deleting, Customizing Organizing, Customizing Incorporating, Customizing Moving Mail
2974 @subsection Deleting Your Mail
2975
2976 @cindex deleting
2977 @vindex @code{mh-delete-msg-hook}
2978
2979 The hook @code{mh-delete-msg-hook} is called after you mark a message
2980 for deletion. For example, the current maintainer of mh-e used this
2981 once when he kept statistics on his mail usage.
2982
2983 @node Customizing Organizing, Customizing Printing, Customizing Deleting, Customizing Moving Mail
2984 @subsection Organizing Your Mail with Folders
2985
2986 @cindex using folders
2987 @vindex @code{mh-recursive-folders}
2988 @vindex @code{mh-auto-folder-collect}
2989
2990 By default, operations on folders work only one level at a time. Set
2991 @code{mh-recursive-folders} to non-@code{nil} to operate on all folders.
2992 This mostly means that you'll be able to see all your folders when you
2993 press @key{TAB} when prompted for a folder name. The variable
2994 @code{mh-auto-folder-collect} is normally turned on to generate a list
2995 of folder names in the background as soon as mh-e is loaded. Otherwise,
2996 the list is generated when you need a folder name the first time (as
2997 with @kbd{o} (@code{mh-refile-msg})). If you have a lot of folders and
2998 you have @code{mh-recursive-folders} set, this could take a while, which
2999 is why it's nice to do the folder collection in the background.
3000
3001 @vindex @code{mh-default-folder-for-message-function}
3002 @findex @code{mh-refile-msg}
3003 @findex @code{mh-to-fcc}
3004 @cindex @file{.emacs}
3005 @cindex files, @file{.emacs}
3006
3007 The function @code{mh-default-folder-for-message-function} is used by
3008 @kbd{o} (@code{mh-refile-msg}) and @kbd{C-c C-f C-f} (@code{mh-to-fcc})
3009 to generate a default folder. The generated folder name should be a
3010 string with a @samp{+} before it. For each of my correspondents, I use the
3011 same name for both an alias and a folder. So, I wrote a function that
3012 takes the address in the @samp{From:} header field, finds it in my alias
3013 file, and returns the alias, which is used as a default folder name.
3014 This is the most complicated example given here, and it demonstrates
3015 several features of Emacs Lisp programming. You should be able to drop
3016 this into @file{~/.emacs}, however. If you use this to store messages
3017 in a subfolder of your Mail directory, you can modify the line that
3018 starts @samp{(format +%s...} and insert your subfolder after the folder
3019 symbol @samp{+}.
3020 @c Note for me: if I insert a new version, don't forget to remove the
3021 @c "a/" from the folder name.
3022
3023 @iftex
3024 @filbreak
3025 @end iftex
3026
3027 @vindex @code{mh-default-folder-for-message-function}, example
3028 @vindex @code{mh-user-path}, example
3029
3030 @smallexample
3031 @group
3032 @i{Creating useful default folder for refiling via mh-default-folder-for-message-function}
3033
3034 (defun my-mh-folder-from-address ()
3035 "Determine folder name from address.
3036 Takes the address in the From: header field, and returns its
3037 corresponding alias from the user's personal aliases file. Returns
3038 @code{nil} if the address was not found."
3039 (require 'rfc822) ; @r{for the rfc822 functions}
3040 (search-forward-regexp "^From: \\(.*\\)") ; @r{grab header field contents}
3041 (save-excursion ; @r{save state}
3042 (let ((addr (car (rfc822-addresses ; @r{get address}
3043 (buffer-substring (match-beginning 1)
3044 (match-end 1)))))
3045 (buffer (get-buffer-create " *temp*")) ; @r{set local variables}
3046 folder)
3047 (set-buffer buffer) ; @r{jump to temporary buffer}
3048 (unwind-protect ; @r{run kill-buffer when done}
3049 (progn ; @r{function grouping construct}
3050 (insert-file-contents (expand-file-name "aliases"
3051 mh-user-path))
3052 (goto-char (point-min)) ; @r{grab aliases file and go to start}
3053 (setq folder
3054 ;; @r{Search for the given address, even commented-out}
3055 ;; @r{addresses are found!}
3056 ;; @r{The function search-forward-regexp sets values that}
3057 ;; @r{are later used by match-beginning and match-end.}
3058 (if (search-forward-regexp (format "^;*\\(.*\\):.*%s"
3059 addr) nil t)
3060 ;; @r{NOTE WELL: this is what the return value looks}
3061 ;; @r{like. You can modify the format string to match}
3062 ;; @r{your own Mail hierarchy.}
3063 (format "+%s" (buffer-substring
3064 (match-beginning 1)
3065 (match-end 1))))))
3066 (kill-buffer buffer)) ; @r{get rid of our temporary buffer}
3067 folder))) ; @r{function's return value}
3068
3069 (setq mh-default-folder-for-message-function 'my-mh-folder-from-address)
3070 @end group
3071 @end smallexample
3072
3073 @vindex @code{mh-refile-msg-hook}
3074
3075 The hook @code{mh-refile-msg-hook} is called after a message is marked
3076 to be refiled.
3077
3078 @vindex @code{mh-sortm-args}
3079 @cindex @code{sortm}
3080 @cindex MH commands, @code{sortm}
3081 @findex @code{mh-sort-folder}
3082 @cindex MH profile components, @code{sortm}
3083 @cindex @file{.mh_profile}
3084 @cindex files, @file{.mh_profile}
3085
3086 The variable @code{mh-sortm-args} holds extra arguments to pass on to
3087 the @code{sortm} command. Note: this variable is only consulted when a
3088 prefix argument is given to @kbd{M-x mh-sort-folder}. It is used to
3089 override any arguments given in a @code{sortm:} entry in your MH profile
3090 (@file{~/.mh_profile}).
3091
3092 @menu
3093 * Customizing Scan Line Formats::
3094 @end menu
3095
3096 @node Customizing Scan Line Formats, , Customizing Organizing, Customizing Organizing
3097 @subsubsection Scan line formatting
3098
3099 @vindex @code{mh-scan-prog}
3100 @cindex @code{scan}
3101 @cindex MH commands, @code{scan}
3102 @vindex @code{mh-progs}
3103
3104 The name of the program that generates a listing of one line per message
3105 is held in @code{mh-scan-prog} (default: @samp{"scan"}). Unless this
3106 variable contains an absolute pathname, it is assumed to be in the
3107 @code{mh-progs} directory. You may link another program to @code{scan}
3108 (see @code{mh-profile}(5)) to produce a different type of listing.
3109
3110 If you change the format of the scan lines you'll need to tell mh-e how
3111 to parse the new format. As you see, quite a lot of variables are
3112 involved to do that. The first variable has to do with pruning out
3113 garbage.
3114
3115 @table @code
3116 @item mh-valid-scan-line
3117 @vindex @code{mh-valid-scan-line}
3118 @cindex @code{inc}
3119 @cindex MH commands, @code{inc}
3120 @cindex @code{scan}
3121 @cindex MH commands, @code{scan}
3122 This regular expression describes a valid scan line. This is used to
3123 eliminate error messages that are occasionally produced by @code{inc} or
3124 @code{scan} (default: @samp{"^ *[0-9]"}).
3125 @end table
3126
3127 Next, two variables control how the message numbers are parsed.
3128
3129 @table @code
3130
3131 @item mh-msg-number-regexp
3132 @vindex @code{mh-msg-number-regexp}
3133 This regular expression is used to extract the message number from a
3134 scan line. Note that the message number must be placed in quoted
3135 parentheses, (\\(...\\)), as in the default of @w{@samp{"^
3136 *\\([0-9]+\\)"}}.
3137
3138 @item mh-msg-search-regexp
3139 @vindex @code{mh-msg-search-regexp}
3140 Given a message number (which is inserted in @samp{%d}), this regular
3141 expression will match the scan line that it represents (default:
3142 @samp{"^[^0-9]*%d[^0-9]"}).
3143 @end table
3144
3145 Finally, there are a slew of variables that control how mh-e marks up
3146 the scan lines.
3147
3148 @table @code
3149 @item mh-cmd-note
3150 @vindex @code{mh-cmd-note}
3151 Number of characters to skip over before inserting notation (default:
3152 4). Note how it relates to the following regular expressions.
3153
3154 @item mh-deleted-msg-regexp
3155 @vindex @code{mh-deleted-msg-regexp}
3156 This regular expression describes deleted messages (default:
3157 @samp{"^....D"}). See also @code{mh-note-deleted}.
3158
3159 @item mh-refiled-msg-regexp
3160 @vindex @code{mh-refiled-msg-regexp}
3161 This regular expression describes refiled messages (default:
3162 @samp{"^....\\^"}). See also @code{mh-note-refiled}.
3163
3164 @item mh-cur-scan-msg-regexp
3165 @vindex @code{mh-cur-scan-msg-regexp}
3166 This regular expression matches the current message (default:
3167 @samp{"^....\\+"}). See also @code{mh-note-cur}.
3168
3169 @item mh-good-msg-regexp
3170 @vindex @code{mh-good-msg-regexp}
3171 This regular expression describes which messages should be shown when
3172 mh-e goes to the next or previous message. Normally, deleted or refiled
3173 messages are skipped over (default: @samp{"^....[^D^]"}).
3174
3175 @item mh-note-deleted
3176 @vindex @code{mh-note-deleted}
3177 Messages that have been deleted to are marked by this string (default:
3178 @samp{"D"}). See also @code{mh-deleted-msg-regexp}.
3179
3180 @item mh-note-refiled
3181 @vindex @code{mh-note-refiled}
3182 Messages that have been refiled are marked by this string (default:
3183 @samp{"^"}). See also @code{mh-refiled-msg-regexp}.
3184
3185 @item mh-note-copied
3186 @vindex @code{mh-note-copied}
3187 Messages that have been copied are marked by this string (default:
3188 @samp{"C"}).
3189
3190 @item mh-note-cur
3191 @vindex @code{mh-note-cur}
3192 The current message (in MH, not in mh-e) is marked by this string
3193 (default: @samp{"+"}). See also @code{mh-cur-scan-msg-regexp}.
3194
3195 @item mh-note-repl
3196 @vindex @code{mh-note-repl}
3197 Messages that have been replied to are marked by this string (default:
3198 @samp{"-"}).
3199
3200 @item mh-note-forw
3201 @vindex @code{mh-note-forw}
3202 Messages that have been forwarded are marked by this string (default:
3203 @samp{"F"}).
3204
3205 @item mh-note-dist
3206 @vindex @code{mh-note-dist}
3207 Messages that have been redistributed are marked by this string
3208 (default: @samp{"R"}).
3209
3210 @item mh-note-printed
3211 @vindex @code{mh-note-printed}
3212 Messages that have been printed are marked by this string (default:
3213 @samp{"P"}).
3214
3215 @item mh-note-seq
3216 @vindex @code{mh-note-seq}
3217 Messages in a sequence are marked by this string (default: @samp{"%"}).
3218 @end table
3219
3220 @node Customizing Printing, Customizing Files and Pipes, Customizing Organizing, Customizing Moving Mail
3221 @subsection Printing Your Mail
3222
3223 @cindex printing
3224 @vindex @code{mh-print-background}
3225 @vindex @code{mh-lpr-command-format}
3226 @cindex @code{lpr}
3227 @cindex Unix commands, @code{lpr}
3228
3229 Normally messages are printed in the foreground. If this is slow on
3230 your system, you may elect to set @code{mh-print-background} to
3231 non-@code{nil} to print in the background. If you do this, do not delete
3232 the message until it is printed or else the output may be truncated.
3233 The variable @code{mh-lpr-command-format} controls how the printing is
3234 actually done. The string can contain one escape, @samp{%s}, which is
3235 filled with the name of the folder and the message number and is useful
3236 for print job names. As an example, the default is @samp{"lpr -J
3237 '%s'"}.
3238
3239 @node Customizing Files and Pipes, Customizing Finishing Up, Customizing Printing, Customizing Moving Mail
3240 @subsection Files and Pipes
3241
3242 @cindex using files
3243 @cindex using pipes
3244 @findex @code{mh-store-msg}
3245 @vindex @code{mh-store-default-directory}
3246
3247 The initial directory for the @code{mh-store-msg} command is held in
3248 @code{mh-store-default-directory}. Since I almost always run
3249 @code{mh-store-msg} on sources, I set it to my personal source directory
3250 like this:
3251
3252 @vindex @code{mh-store-default-directory}, example
3253
3254 @lisp
3255 (setq mh-store-default-directory (expand-file-name "~/src/"))
3256 @end lisp
3257
3258 @findex @code{mh-store-buffer}
3259 @cindex @code{uuencode}
3260 @cindex Unix commands, @code{uuencode}
3261 @cindex @code{shar}
3262 @cindex Unix commands, @code{shar}
3263
3264 Subsequent incarnations of @code{mh-store-msg} offer the last directory
3265 used as the default. By the way, @code{mh-store-msg} calls the Emacs
3266 Lisp function @code{mh-store-buffer}. I mention this because you can use
3267 it directly if you're editing a buffer that contains a file that has
3268 been run through @code{uuencode} or @code{shar}. For example, you can
3269 extract the contents of the current buffer in your home directory by
3270 typing @kbd{M-x mh-store-buffer @key{RET} ~ @key{RET}}.
3271
3272 @node Customizing Finishing Up, , Customizing Files and Pipes, Customizing Moving Mail
3273 @subsection Finishing Up
3274
3275 @cindex quitting
3276 @vindex @code{mh-before-quit-hook}
3277 @vindex @code{mh-quit-hook}
3278 @findex @code{mh-execute-commands}
3279
3280 The two variables @code{mh-before-quit-hook} and @code{mh-quit-hook} are
3281 called by @kbd{q} (@code{mh-quit}). The former one is called before the
3282 quit occurs, so you might use it to perform any mh-e operations; you
3283 could perform some query and abort the quit or call
3284 @code{mh-execute-commands}, for example. The latter is not run in an
3285 mh-e context, so you might use it to modify the window setup.
3286
3287 @node Customizing Searching, , Customizing Moving Mail, Customizing mh-e
3288 @section Searching Through Messages
3289
3290 @cindex searching
3291 @vindex @code{mh-pick-mode-hook}
3292 @vindex @code{mh-partial-folder-mode-line-annotation}
3293
3294 If you find that you do the same thing over and over when editing the
3295 search template, you may wish to bind some shortcuts to keys. This can
3296 be done with the variable @code{mh-pick-mode-hook}, which is called when
3297 @kbd{M-s} (@code{mh-search-folder}) is run on a new pattern.
3298
3299 The string
3300 @code{mh-partial-folder-mode-line-annotation} is used to annotate the
3301 mode line when only a portion of the folder is shown. For example, this
3302 will be displayed after running @kbd{M-s} (@code{mh-search-folder}) to
3303 list messages based on some search criteria (see @ref{Searching}). The
3304 default annotation of @samp{"select"} yields a mode line that looks
3305 like:
3306
3307 @example
3308 --%%-@{+inbox/select@} 2 msgs (2-3) (MH-Folder)--All-----------------
3309 @end example
3310
3311 @node Odds and Ends, History, Customizing mh-e, Top
3312 @appendix Odds and Ends
3313
3314 This appendix covers a few topics that don't fit elsewhere. Here I tell
3315 you how to report bugs and how to get on the mh-e mailing list. I also
3316 point out some additional sources of information.
3317
3318 @menu
3319 * Bug Reports::
3320 * Mailing List::
3321 * MH FAQ::
3322 * Getting mh-e::
3323 @end menu
3324
3325 @node Bug Reports, Mailing List, Odds and Ends, Odds and Ends
3326 @appendixsec Bug Reports
3327
3328 @cindex bugs
3329 @cindex Wohler, Bill
3330 @cindex SourceForge
3331
3332 The current maintainer of mh-e is Bill Wohler
3333 <@i{wohler@@newt.com}>. Bug reports should be filed at
3334 @uref{https://sourceforge.net/bugs/?group_id=13357, SourceForge}.
3335 Please include the output of
3336 @kbd{M-x mh-version} (@pxref{Miscellaneous}) in any bug report you send.
3337
3338 @node Mailing List, MH FAQ, Bug Reports, Odds and Ends
3339 @appendixsec mh-e Mailing List
3340
3341 @cindex mailing list
3342 @cindex SourceForge
3343
3344 There are actually several mailing lists for mh-e. They are
3345 @i{mh-e-users@@lists.sourceforge.net},
3346 @i{mh-e-announce@@lists.sourceforge.net}, and
3347 @i{mh-e-devel@@lists.sourceforge.net}. You can subscribe or view the
3348 archives at @uref{https://sourceforge.net/mail/?group_id=13357,
3349 SourceForge}. Do not report bugs on these lists; please submit them
3350 via SourceForge (@pxref{Bug Reports}).
3351
3352 @node MH FAQ, Getting mh-e, Mailing List, Odds and Ends
3353 @appendixsec MH FAQ
3354
3355 @cindex MH FAQ
3356 @cindex FAQ
3357
3358 An FAQ appears monthly in the newsgroup @samp{comp.mail.mh}. While very
3359 little is there that deals with mh-e specifically, there is an
3360 incredible wealth of material about MH itself which you will find
3361 useful. The subject of the FAQ is @cite{MH Frequently Asked Questions
3362 (FAQ) with Answers}.
3363
3364 The FAQ is available via the World Wide Web (WWW) at
3365 @uref{http://www.faqs.org/faqs/mail/mh-faq/part1/preamble.html, faqs.org}.
3366
3367 @node Getting mh-e, , MH FAQ, Odds and Ends
3368 @appendixsec Getting mh-e
3369
3370 @cindex obtaining mh-e
3371
3372 The version of mh-e in the current version of Emacs should be up to
3373 date. It is most likely to be more up to date than the copy that comes
3374 with the MH distribution in @file{miscellany/mh-e}.
3375
3376 @c intentionally wordy to avoid overfull hbox
3377 New mh-e releases are always available for downloading at
3378 @uref{https://sourceforge.net/project/showfiles.php?group_id=13357,
3379 SourceForge} before they appear in an Emacs release. You can read the
3380 release notes on that page to determine if the given release of mh-e
3381 is already installed in your version of Emacs.
3382
3383 If you go this route, I suggest that you extract the files from
3384 @file{mh-e-@var{m.n}.tgz} in the following fashion:
3385
3386 @smallexample
3387 @group
3388 % @kbd{cd} # @r{Start in your home directory}
3389 % @kbd{mkdir lib lib/emacs} # @r{Create directory for mh-e}
3390 % @kbd{cd lib/emacs}
3391 % @kbd{zcat @var{path/to/}mh-e-@var{m.n}.tgz | tar xvf -} # @r{Extract files}
3392 @end group
3393 @end smallexample
3394
3395 @cindex @file{.emacs}
3396 @cindex files, @file{.emacs}
3397
3398 To use these new files, add the following to @file{~/.emacs}:
3399
3400 @lisp
3401 (setq load-path (cons (expand-file-name "~/lib/emacs") load-path))
3402 @end lisp
3403
3404 @cindex news
3405 @cindex files, @samp{MH-E-NEWS}
3406
3407 That's it! If you're already running Emacs, please quit that session
3408 and start again to load in the new mh-e. Check that you're running the
3409 new version with the command @kbd{M-x mh-version} after running any mh-e
3410 command. The distribution comes with a file called @file{MH-E-NEWS} so
3411 you can see what's new.
3412
3413 @node History, Copying, Odds and Ends, Top
3414 @appendix History of mh-e
3415
3416 @cindex Gildea, Stephen
3417 @cindex Larus, Jim
3418 @cindex Reid, Brian
3419 @cindex SourceForge
3420 @cindex history of mh-e
3421
3422 mh-e was originally written by Brian Reid in 1983 and has changed
3423 hands several times since then. Jim Larus wanted to do something
3424 similar for GNU Emacs, and ended up completely rewriting it that same
3425 year. In 1989, Stephen Gildea picked it up and added many improvements.
3426 Bill Wohler then took over in 2000 and moved its development to
3427 @uref{http://sourceforge.net/, SourceForge}.
3428
3429 @menu
3430 * From Brian Reid::
3431 * From Jim Larus::
3432 * From Stephen Gildea::
3433 @end menu
3434
3435 @node From Brian Reid, From Jim Larus, History, History
3436 @appendixsec From Brian Reid
3437
3438 @cindex Reid, Brian
3439
3440 One day in 1983 I got the flu and had to stay home from work for three
3441 days with nothing to do. I used that time to write MHE@. The
3442 fundamental idea behind MHE was that it was a ``puppeteer'' driving the MH
3443 programs underneath it. MH had a model that the editor was supposed to
3444 run as a subprocess of the mailer, which seemed to me at the time to be
3445 the tail wagging the dog. So I turned it around and made the editor
3446 drive the MH programs. I made sure that the UCI people (who were
3447 maintaining MH at the time) took in my changes and made them stick.
3448
3449 Today, I still use my own version of MHE because I don't at all like the
3450 way that GNU mh-e works and I've never gotten to be good enough at
3451 hacking Emacs Lisp to make GNU mh-e do what I want. The Gosling-emacs
3452 version of MHE and the GNU Emacs version of mh-e have almost nothing in
3453 common except similar names. They work differently, have different
3454 conceptual models, and have different key bindings. @footnote{After
3455 reading this article, I questioned Brian about his version of MHE, and
3456 received some great ideas for improving mh-e such as a dired-like method
3457 of selecting folders; and removing the prompting when sending mail,
3458 filling in the blanks in the draft buffer instead. I passed them on to
3459 Stephen Gildea, the current maintainer, and he was excited about the
3460 ideas as well. Perhaps one day, mh-e will again resemble MHE, although
3461 none of these ideas are manifest in Version 5.0.}
3462
3463 Brian Reid, June 1994
3464
3465 @node From Jim Larus, From Stephen Gildea, From Brian Reid, History
3466 @appendixsec From Jim Larus
3467
3468 @cindex Larus, Jim
3469
3470 Brian Reid, while at CMU or shortly after going to Stanford wrote a mail
3471 reading program called MHE for Gosling Emacs. It had much the same
3472 structure as mh-e (i.e., invoked MH programs), though it was simpler and
3473 the commands were slightly different. Unfortunately, I no longer have a
3474 copy so the differences are lost in the mists of time.
3475
3476 In '82-83, I was working at BBN and wrote a lot of mlisp code in Gosling
3477 Emacs to make it look more like Tennex Emacs. One of the packages that
3478 I picked up and improved was Reid's mail system. In '83, I went back to
3479 Berkeley. About that time, Stallman's first version of GNU Emacs came
3480 out and people started to move to it from Gosling Emacs (as I recall,
3481 the transition took a year or two). I decided to port Reid's MHE and
3482 used the mlisp to Emacs Lisp translator that came with GNU Emacs. It
3483 did a lousy job and the resulting code didn't work, so I bit the bullet
3484 and rewrote the code by hand (it was a lot smaller and simpler then, so
3485 it took only a day or two).
3486
3487 Soon after that, mh-e became part of the standard Emacs distribution and
3488 suggestions kept dribbling in for improvements. mh-e soon reached
3489 sufficient functionality to keep me happy, but I kept on improving it
3490 because I was a graduate student with plenty of time on my hands and it
3491 was more fun than my dissertation. In retrospect, the one thing that I
3492 regret is not writing any documentation, which seriously limited the use
3493 and appeal of the package.
3494
3495 @cindex @code{xmh}, in mh-e history
3496
3497 In '89, I came to Wisconsin as a professor and decided not to work on
3498 mh-e. It was stable, except for minor bugs, and had enough
3499 functionality, so I let it be for a few years. Stephen Gildea of BBN
3500 began to pester me about the bugs, but I ignored them. In 1990, he went
3501 off to the X Consortium, said good bye, and said that he would now be
3502 using @code{xmh}. A few months later, he came back and said that he
3503 couldn't stand @code{xmh} and could I put a few more bug fixes into
3504 mh-e. At that point, I had no interest in fixing mh-e, so I gave the
3505 responsibility of maintenance to him and he has done a fine job since
3506 then.
3507
3508 Jim Larus, June 1994
3509
3510 @node From Stephen Gildea, , From Jim Larus, History
3511 @appendixsec From Stephen Gildea
3512
3513 @cindex Gildea, Stephen
3514
3515 In 1987 I went to work for Bolt Beranek and Newman, as Jim had before
3516 me. In my previous job, I had been using RMAIL, but as my folders tend
3517 to run large, I was frustrated with the speed of RMAIL@. However, I
3518 stuck with it because I wanted the GNU Emacs interface. I am very
3519 familiar and comfortable with the Emacs interface (with just a few
3520 modifications of my own) and dislike having to use applications with
3521 embedded editors; they never live up to Emacs.
3522
3523 MH is the mail reader of choice at BBN, so I converted to it. Since I
3524 didn't want to give up using an Emacs interface, I started using mh-e.
3525 As is my wont, I started hacking on it almost immediately. I first used
3526 version 3.4m. One of the first features I added was to treat the folder
3527 buffer as a file-visiting buffer: you could lock it, save it, and be
3528 warned of unsaved changes when killing it. I also worked to bring its
3529 functionality a little closer to RMAIL@. Jim Larus was very cooperative
3530 about merging in my changes, and my efforts first appeared in version
3531 3.6, distributed with Emacs 18.52 in 1988. Next I decided mh-e was too
3532 slow and optimized it a lot. Version, 3.7, distributed with Emacs 18.56
3533 in 1990, was noticeably faster.
3534
3535 When I moved to the X Consortium I became the first person there to not
3536 use xmh. (There is now one other engineer there using mh-e.) About
3537 this point I took over maintenance of mh-e from Jim and was finally able
3538 to add some features Jim hadn't accepted, such as the backward searching
3539 undo. My first release was 3.8 (Emacs 18.58) in 1992.
3540
3541 Now, in 1994, we see a flurry of releases, with both 4.0 and 5.0.
3542 Version 4.0 added many new features, including background folder
3543 collection and support for composing @sc{mime} messages. (Reading
3544 @sc{mime} messages remains to be done, alas.) While writing this book,
3545 Bill Wohler gave mh-e its closest examination ever, uncovering bugs and
3546 inconsistencies that required a new major version to fix, and so version
3547 5 was released.
3548
3549 Stephen Gildea, June 1994
3550
3551 @node Copying, Command Index, History, Top
3552 @appendix GNU GENERAL PUBLIC LICENSE
3553
3554 @center Version 2, June 1991
3555
3556 @display
3557 Copyright @copyright{} 1989, 1991 Free Software Foundation, Inc.
3558 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
3559
3560 Everyone is permitted to copy and distribute verbatim copies
3561 of this license document, but changing it is not allowed.
3562 @end display
3563
3564 @appendixsec Preamble
3565
3566 The licenses for most software are designed to take away your
3567 freedom to share and change it. By contrast, the GNU General Public
3568 License is intended to guarantee your freedom to share and change free
3569 software---to make sure the software is free for all its users. This
3570 General Public License applies to most of the Free Software
3571 Foundation's software and to any other program whose authors commit to
3572 using it. (Some other Free Software Foundation software is covered by
3573 the GNU Library General Public License instead.) You can apply it to
3574 your programs, too.
3575
3576 When we speak of free software, we are referring to freedom, not
3577 price. Our General Public Licenses are designed to make sure that you
3578 have the freedom to distribute copies of free software (and charge for
3579 this service if you wish), that you receive source code or can get it
3580 if you want it, that you can change the software or use pieces of it
3581 in new free programs; and that you know you can do these things.
3582
3583 To protect your rights, we need to make restrictions that forbid
3584 anyone to deny you these rights or to ask you to surrender the rights.
3585 These restrictions translate to certain responsibilities for you if you
3586 distribute copies of the software, or if you modify it.
3587
3588 For example, if you distribute copies of such a program, whether
3589 gratis or for a fee, you must give the recipients all the rights that
3590 you have. You must make sure that they, too, receive or can get the
3591 source code. And you must show them these terms so they know their
3592 rights.
3593
3594 We protect your rights with two steps: (1) copyright the software, and
3595 (2) offer you this license which gives you legal permission to copy,
3596 distribute and/or modify the software.
3597
3598 Also, for each author's protection and ours, we want to make certain
3599 that everyone understands that there is no warranty for this free
3600 software. If the software is modified by someone else and passed on, we
3601 want its recipients to know that what they have is not the original, so
3602 that any problems introduced by others will not reflect on the original
3603 authors' reputations.
3604
3605 Finally, any free program is threatened constantly by software
3606 patents. We wish to avoid the danger that redistributors of a free
3607 program will individually obtain patent licenses, in effect making the
3608 program proprietary. To prevent this, we have made it clear that any
3609 patent must be licensed for everyone's free use or not licensed at all.
3610
3611 The precise terms and conditions for copying, distribution and
3612 modification follow.
3613
3614 @iftex
3615 @appendixsec TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
3616 @end iftex
3617 @ifinfo
3618 @center TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
3619 @end ifinfo
3620
3621 @enumerate 0
3622 @item
3623 This License applies to any program or other work which contains
3624 a notice placed by the copyright holder saying it may be distributed
3625 under the terms of this General Public License. The ``Program,'' below,
3626 refers to any such program or work, and a ``work based on the Program''
3627 means either the Program or any derivative work under copyright law:
3628 that is to say, a work containing the Program or a portion of it,
3629 either verbatim or with modifications and/or translated into another
3630 language. (Hereinafter, translation is included without limitation in
3631 the term ``modification.'') Each licensee is addressed as ``you.''
3632
3633 Activities other than copying, distribution and modification are not
3634 covered by this License; they are outside its scope. The act of
3635 running the Program is not restricted, and the output from the Program
3636 is covered only if its contents constitute a work based on the
3637 Program (independent of having been made by running the Program).
3638 Whether that is true depends on what the Program does.
3639
3640 @item
3641 You may copy and distribute verbatim copies of the Program's
3642 source code as you receive it, in any medium, provided that you
3643 conspicuously and appropriately publish on each copy an appropriate
3644 copyright notice and disclaimer of warranty; keep intact all the
3645 notices that refer to this License and to the absence of any warranty;
3646 and give any other recipients of the Program a copy of this License
3647 along with the Program.
3648
3649 You may charge a fee for the physical act of transferring a copy, and
3650 you may at your option offer warranty protection in exchange for a fee.
3651
3652 @item
3653 You may modify your copy or copies of the Program or any portion
3654 of it, thus forming a work based on the Program, and copy and
3655 distribute such modifications or work under the terms of Section 1
3656 above, provided that you also meet all of these conditions:
3657
3658 @enumerate a
3659 @item
3660 You must cause the modified files to carry prominent notices
3661 stating that you changed the files and the date of any change.
3662
3663 @item
3664 You must cause any work that you distribute or publish, that in
3665 whole or in part contains or is derived from the Program or any
3666 part thereof, to be licensed as a whole at no charge to all third
3667 parties under the terms of this License.
3668
3669 @item
3670 If the modified program normally reads commands interactively
3671 when run, you must cause it, when started running for such
3672 interactive use in the most ordinary way, to print or display an
3673 announcement including an appropriate copyright notice and a
3674 notice that there is no warranty (or else, saying that you provide
3675 a warranty) and that users may redistribute the program under
3676 these conditions, and telling the user how to view a copy of this
3677 License. (Exception: if the Program itself is interactive but
3678 does not normally print such an announcement, your work based on
3679 the Program is not required to print an announcement.)
3680 @end enumerate
3681
3682 These requirements apply to the modified work as a whole. If
3683 identifiable sections of that work are not derived from the Program,
3684 and can be reasonably considered independent and separate works in
3685 themselves, then this License, and its terms, do not apply to those
3686 sections when you distribute them as separate works. But when you
3687 distribute the same sections as part of a whole which is a work based
3688 on the Program, the distribution of the whole must be on the terms of
3689 this License, whose permissions for other licensees extend to the
3690 entire whole, and thus to each and every part regardless of who wrote it.
3691
3692 Thus, it is not the intent of this section to claim rights or contest
3693 your rights to work written entirely by you; rather, the intent is to
3694 exercise the right to control the distribution of derivative or
3695 collective works based on the Program.
3696
3697 In addition, mere aggregation of another work not based on the Program
3698 with the Program (or with a work based on the Program) on a volume of
3699 a storage or distribution medium does not bring the other work under
3700 the scope of this License.
3701
3702 @item
3703 You may copy and distribute the Program (or a work based on it,
3704 under Section 2) in object code or executable form under the terms of
3705 Sections 1 and 2 above provided that you also do one of the following:
3706
3707 @enumerate a
3708 @item
3709 Accompany it with the complete corresponding machine-readable
3710 source code, which must be distributed under the terms of Sections
3711 1 and 2 above on a medium customarily used for software interchange; or,
3712
3713 @item
3714 Accompany it with a written offer, valid for at least three
3715 years, to give any third party, for a charge no more than your
3716 cost of physically performing source distribution, a complete
3717 machine-readable copy of the corresponding source code, to be
3718 distributed under the terms of Sections 1 and 2 above on a medium
3719 customarily used for software interchange; or,
3720
3721 @item
3722 Accompany it with the information you received as to the offer
3723 to distribute corresponding source code. (This alternative is
3724 allowed only for noncommercial distribution and only if you
3725 received the program in object code or executable form with such
3726 an offer, in accord with Subsection b above.)
3727 @end enumerate
3728
3729 The source code for a work means the preferred form of the work for
3730 making modifications to it. For an executable work, complete source
3731 code means all the source code for all modules it contains, plus any
3732 associated interface definition files, plus the scripts used to
3733 control compilation and installation of the executable. However, as a
3734 special exception, the source code distributed need not include
3735 anything that is normally distributed (in either source or binary
3736 form) with the major components (compiler, kernel, and so on) of the
3737 operating system on which the executable runs, unless that component
3738 itself accompanies the executable.
3739
3740 If distribution of executable or object code is made by offering
3741 access to copy from a designated place, then offering equivalent
3742 access to copy the source code from the same place counts as
3743 distribution of the source code, even though third parties are not
3744 compelled to copy the source along with the object code.
3745
3746 @item
3747 You may not copy, modify, sublicense, or distribute the Program
3748 except as expressly provided under this License. Any attempt
3749 otherwise to copy, modify, sublicense or distribute the Program is
3750 void, and will automatically terminate your rights under this License.
3751 However, parties who have received copies, or rights, from you under
3752 this License will not have their licenses terminated so long as such
3753 parties remain in full compliance.
3754
3755 @item
3756 You are not required to accept this License, since you have not
3757 signed it. However, nothing else grants you permission to modify or
3758 distribute the Program or its derivative works. These actions are
3759 prohibited by law if you do not accept this License. Therefore, by
3760 modifying or distributing the Program (or any work based on the
3761 Program), you indicate your acceptance of this License to do so, and
3762 all its terms and conditions for copying, distributing or modifying
3763 the Program or works based on it.
3764
3765 @item
3766 Each time you redistribute the Program (or any work based on the
3767 Program), the recipient automatically receives a license from the
3768 original licensor to copy, distribute or modify the Program subject to
3769 these terms and conditions. You may not impose any further
3770 restrictions on the recipients' exercise of the rights granted herein.
3771 You are not responsible for enforcing compliance by third parties to
3772 this License.
3773
3774 @item
3775 If, as a consequence of a court judgment or allegation of patent
3776 infringement or for any other reason (not limited to patent issues),
3777 conditions are imposed on you (whether by court order, agreement or
3778 otherwise) that contradict the conditions of this License, they do not
3779 excuse you from the conditions of this License. If you cannot
3780 distribute so as to satisfy simultaneously your obligations under this
3781 License and any other pertinent obligations, then as a consequence you
3782 may not distribute the Program at all. For example, if a patent
3783 license would not permit royalty-free redistribution of the Program by
3784 all those who receive copies directly or indirectly through you, then
3785 the only way you could satisfy both it and this License would be to
3786 refrain entirely from distribution of the Program.
3787
3788 If any portion of this section is held invalid or unenforceable under
3789 any particular circumstance, the balance of the section is intended to
3790 apply and the section as a whole is intended to apply in other
3791 circumstances.
3792
3793 It is not the purpose of this section to induce you to infringe any
3794 patents or other property right claims or to contest validity of any
3795 such claims; this section has the sole purpose of protecting the
3796 integrity of the free software distribution system, which is
3797 implemented by public license practices. Many people have made
3798 generous contributions to the wide range of software distributed
3799 through that system in reliance on consistent application of that
3800 system; it is up to the author/donor to decide if he or she is willing
3801 to distribute software through any other system and a licensee cannot
3802 impose that choice.
3803
3804 This section is intended to make thoroughly clear what is believed to
3805 be a consequence of the rest of this License.
3806
3807 @item
3808 If the distribution and/or use of the Program is restricted in
3809 certain countries either by patents or by copyrighted interfaces, the
3810 original copyright holder who places the Program under this License
3811 may add an explicit geographical distribution limitation excluding
3812 those countries, so that distribution is permitted only in or among
3813 countries not thus excluded. In such case, this License incorporates
3814 the limitation as if written in the body of this License.
3815
3816 @item
3817 The Free Software Foundation may publish revised and/or new versions
3818 of the General Public License from time to time. Such new versions will
3819 be similar in spirit to the present version, but may differ in detail to
3820 address new problems or concerns.
3821
3822 Each version is given a distinguishing version number. If the Program
3823 specifies a version number of this License which applies to it and ``any
3824 later version,'' you have the option of following the terms and conditions
3825 either of that version or of any later version published by the Free
3826 Software Foundation. If the Program does not specify a version number of
3827 this License, you may choose any version ever published by the Free Software
3828 Foundation.
3829
3830 @item
3831 If you wish to incorporate parts of the Program into other free
3832 programs whose distribution conditions are different, write to the author
3833 to ask for permission. For software which is copyrighted by the Free
3834 Software Foundation, write to the Free Software Foundation; we sometimes
3835 make exceptions for this. Our decision will be guided by the two goals
3836 of preserving the free status of all derivatives of our free software and
3837 of promoting the sharing and reuse of software generally.
3838
3839 @iftex
3840 @heading NO WARRANTY
3841 @end iftex
3842 @ifinfo
3843 @center NO WARRANTY
3844 @end ifinfo
3845
3846 @item
3847 BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
3848 FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW@. EXCEPT WHEN
3849 OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
3850 PROVIDE THE PROGRAM ``AS IS'' WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
3851 OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
3852 MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE@. THE ENTIRE RISK AS
3853 TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU@. SHOULD THE
3854 PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
3855 REPAIR OR CORRECTION.
3856
3857 @item
3858 IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
3859 WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
3860 REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
3861 INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
3862 OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
3863 TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
3864 YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
3865 PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
3866 POSSIBILITY OF SUCH DAMAGES.
3867 @end enumerate
3868
3869 @iftex
3870 @heading END OF TERMS AND CONDITIONS
3871 @end iftex
3872 @ifinfo
3873 @center END OF TERMS AND CONDITIONS
3874 @end ifinfo
3875
3876 @page
3877 @appendixsec How to Apply These Terms to Your New Programs
3878
3879 If you develop a new program, and you want it to be of the greatest
3880 possible use to the public, the best way to achieve this is to make it
3881 free software which everyone can redistribute and change under these terms.
3882
3883 To do so, attach the following notices to the program. It is safest
3884 to attach them to the start of each source file to most effectively
3885 convey the exclusion of warranty; and each file should have at least
3886 the ``copyright'' line and a pointer to where the full notice is found.
3887
3888 @smallexample
3889 @var{one line to give the program's name and an idea of what it does.}
3890 Copyright (C) 20@var{yy} @var{name of author}
3891
3892 This program is free software; you can redistribute it and/or
3893 modify it under the terms of the GNU General Public License
3894 as published by the Free Software Foundation; either version 2
3895 of the License, or (at your option) any later version.
3896
3897 This program is distributed in the hope that it will be useful,
3898 but WITHOUT ANY WARRANTY; without even the implied warranty of
3899 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE@. See the
3900 GNU General Public License for more details.
3901
3902 You should have received a copy of the GNU General Public License along
3903 with this program; if not, write to the Free Software Foundation, Inc.,
3904 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
3905 @end smallexample
3906
3907 Also add information on how to contact you by electronic and paper mail.
3908
3909 If the program is interactive, make it output a short notice like this
3910 when it starts in an interactive mode:
3911
3912 @smallexample
3913 Gnomovision version 69, Copyright (C) 20@var{yy} @var{name of author}
3914 Gnomovision comes with ABSOLUTELY NO WARRANTY; for details
3915 type `show w'. This is free software, and you are welcome
3916 to redistribute it under certain conditions; type `show c'
3917 for details.
3918 @end smallexample
3919
3920 The hypothetical commands @samp{show w} and @samp{show c} should show
3921 the appropriate parts of the General Public License. Of course, the
3922 commands you use may be called something other than @samp{show w} and
3923 @samp{show c}; they could even be mouse-clicks or menu items---whatever
3924 suits your program.
3925
3926 You should also get your employer (if you work as a programmer) or your
3927 school, if any, to sign a ``copyright disclaimer'' for the program, if
3928 necessary. Here is a sample; alter the names:
3929
3930 @smallexample
3931 @group
3932 Yoyodyne, Inc., hereby disclaims all copyright
3933 interest in the program `Gnomovision'
3934 (which makes passes at compilers) written
3935 by James Hacker.
3936
3937 @var{signature of Ty Coon}, 1 April 1989
3938 Ty Coon, President of Vice
3939 @end group
3940 @end smallexample
3941
3942 This General Public License does not permit incorporating your program into
3943 proprietary programs. If your program is a subroutine library, you may
3944 consider it more useful to permit linking proprietary applications with the
3945 library. If this is what you want to do, use the GNU Library General
3946 Public License instead of this License.
3947
3948 @node Command Index, Variable Index, Copying, Top
3949 @unnumbered Command Index
3950
3951 @printindex fn
3952
3953 @node Variable Index, Concept Index, Command Index, Top
3954 @unnumbered Variable Index
3955
3956 @printindex vr
3957
3958 @node Concept Index, , Variable Index, Top
3959 @unnumbered Concept Index
3960
3961 @printindex cp
3962
3963 @contents
3964 @bye
3965
3966 @c XXX In the sections on customizing mh-e, you can add cross-references
3967 @c to the Emacs manual and the Emacs Lisp manual wherever they are
3968 @c useful. @pxref{node, , section, emacs, The GNU Emacs Manual}