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