Fix event race
[bpt/emacs.git] / doc / emacs / rmail.texi
index ad22ae9..2f823a7 100644 (file)
@@ -1,8 +1,8 @@
 @c This is part of the Emacs manual.
-@c Copyright (C) 1985-1987, 1993-1995, 1997, 2001-2011
-@c   Free Software Foundation, Inc.
+@c Copyright (C) 1985-1987, 1993-1995, 1997, 2001-2014 Free Software
+@c Foundation, Inc.
 @c See file emacs.texi for copying conditions.
-@node Rmail, Dired, Sending Mail, Top
+@node Rmail
 @chapter Reading Mail with Rmail
 @cindex Rmail
 @cindex reading mail
@@ -87,8 +87,7 @@ other buffers, and never switch back, you have exited.  Just make sure
 to save the Rmail file eventually (like any other file you have
 changed).  @kbd{C-x s} is a suitable way to do this (@pxref{Save
 Commands}).  The Rmail command @kbd{b}, @code{rmail-bury}, buries the
-Rmail buffer and its summary buffer without expunging and saving the
-Rmail file.
+Rmail buffer and its summary without expunging and saving the Rmail file.
 
 @node Rmail Scrolling
 @section Scrolling Within a Message
@@ -100,9 +99,10 @@ frequent that it deserves to be easier.
 
 @table @kbd
 @item @key{SPC}
-Scroll forward (@code{scroll-up}).
+Scroll forward (@code{scroll-up-command}).
 @item @key{DEL}
-Scroll backward (@code{scroll-down}).
+@itemx @key{S-SPC}
+Scroll backward (@code{scroll-down-command}).
 @item .
 Scroll to start of message (@code{rmail-beginning-of-message}).
 @item /
@@ -111,9 +111,11 @@ Scroll to end of message (@code{rmail-end-of-message}).
 
 @kindex SPC @r{(Rmail)}
 @kindex DEL @r{(Rmail)}
-  Since the most common thing to do while reading a message is to scroll
-through it by screenfuls, Rmail makes @key{SPC} and @key{DEL} synonyms of
-@kbd{C-v} (@code{scroll-up}) and @kbd{M-v} (@code{scroll-down})
+@kindex S-SPC @r{(Rmail)}
+  Since the most common thing to do while reading a message is to
+scroll through it by screenfuls, Rmail makes @key{SPC} and @key{DEL}
+(or @key{S-SPC}) do the same as @kbd{C-v} (@code{scroll-up-command})
+and @kbd{M-v} (@code{scroll-down-command}) respectively.
 
 @kindex . @r{(Rmail)}
 @kindex / @r{(Rmail)}
@@ -275,7 +277,7 @@ Expunge the Rmail file (@code{rmail-expunge}).
 @findex rmail-delete-forward
 @findex rmail-delete-backward
   There are two Rmail commands for deleting messages.  Both delete the
-current message and select another message.  @kbd{d}
+current message and select another.  @kbd{d}
 (@code{rmail-delete-forward}) moves to the following message, skipping
 messages already deleted, while @kbd{C-d} (@code{rmail-delete-backward})
 moves to the previous nondeleted message.  If there is no nondeleted
@@ -284,7 +286,7 @@ deleted remains current.  @kbd{d} with a prefix argument is equivalent
 to @kbd{C-d}.  Note that the Rmail summary versions of these commands
 behave slightly differently (@pxref{Rmail Summary Edit}).
 
-@c mention other hooks, eg show message hook?
+@c mention other hooks, e.g., show message hook?
 @vindex rmail-delete-message-hook
   Whenever Rmail deletes a message, it runs the hook
 @code{rmail-delete-message-hook}.  When the hook functions are invoked,
@@ -336,7 +338,7 @@ any time in Rmail by typing @kbd{g}.
 @vindex rmail-primary-inbox-list
 @cindex @env{MAIL} environment variable
   The variable @code{rmail-primary-inbox-list} contains a list of the
-files which are inboxes for your primary Rmail file.  If you don't set
+files that are inboxes for your primary Rmail file.  If you don't set
 this variable explicitly, Rmail uses the @env{MAIL} environment
 variable, or, as a last resort, a default inbox based on
 @code{rmail-spool-directory}.  The default inbox file depends on your
@@ -366,12 +368,21 @@ all into a separate Rmail file avoids the need for interlocking in all
 the rest of Rmail, since only Rmail operates on the Rmail file.
 @end enumerate
 
+@c FIXME remove this in Emacs 25; won't be relevant any more.
+@cindex Babyl files
+@cindex mbox files
   Rmail was originally written to use the Babyl format as its internal
 format.  Since then, we have recognized that the usual inbox format
 (@samp{mbox}) on Unix and GNU systems is adequate for the job, and so
 since Emacs 23 Rmail uses that as its internal format.  The Rmail file
 is still separate from the inbox file, even though their format is the
 same.
+@c But this bit should stay in some form.
+@vindex rmail-mbox-format
+(In fact, there are a few slightly different mbox formats.
+The differences are not very important, but you can set the variable
+@code{rmail-mbox-format} to tell Rmail which form your system uses.
+See that variable's documentation for more details.)
 
 @vindex rmail-preserve-inbox
   When getting new mail, Rmail first copies the new mail from the
@@ -453,6 +464,7 @@ second says which files in that directory to offer (all those that match
 the regular expression).  If no files match, you cannot select this menu
 item.  These variables also apply to choosing a file for output
 (@pxref{Rmail Output}).
+@c FIXME matches only checked when Rmail file first visited?
 
 @ignore
 @findex set-rmail-inbox-list
@@ -515,6 +527,7 @@ currently displayed and no more.  @xref{Rmail Display}.  In addition,
 @kbd{o} converts the message to Babyl format (used by Rmail in Emacs
 version 22 and before) if the file is in Babyl format; @kbd{C-o}
 cannot output to Babyl files at all.
+@c FIXME remove BABYL mention in Emacs 25?
 
   If the output file is currently visited in an Emacs buffer, the
 output commands append the message to that buffer.  It is up to you to
@@ -570,6 +583,22 @@ the file name to use, or more generally it may be any Lisp expression
 that returns a file name as a string.  @code{rmail-output-file-alist}
 applies to both @kbd{o} and @kbd{C-o}.
 
+@vindex rmail-automatic-folder-directives
+Rmail can automatically save messages from your primary Rmail file
+(the one that @code{rmail-file-name} specifies) to other files, based
+on the value of the variable @code{rmail-automatic-folder-directives}.
+This variable is a list of elements (@samp{directives}) that say which
+messages to save where.  Each directive is a list consisting of an
+output file, followed by one or more pairs of a header name and a regular
+expression.  If a message has a header matching the specified regular
+expression, that message is saved to the given file.  If the directive
+has more than one header entry, all must match.  Rmail checks directives
+when it shows a message from the file @code{rmail-file-name}, and
+applies the first that matches (if any).  If the output file is
+@code{nil}, the message is deleted, not saved.  For example, you can use
+this feature to save messages from a particular address, or with a
+particular subject, to a dedicated file.
+
 @node Rmail Labels
 @section Labels
 @cindex label (Rmail)
@@ -710,7 +739,7 @@ Try sending a bounced message a second time (@code{rmail-retry-failure}).
 @cindex reply to a message
   The most common reason to send a message while in Rmail is to reply
 to the message you are reading.  To do this, type @kbd{r}
-(@code{rmail-reply}).  This displays the @samp{*mail*} buffer in
+(@code{rmail-reply}).  This displays a mail composition buffer in
 another window, much like @kbd{C-x 4 m}, but preinitializes the
 @samp{Subject}, @samp{To}, @samp{CC}, @samp{In-reply-to} and
 @samp{References} header fields based on the message you are replying
@@ -718,23 +747,20 @@ to.  The @samp{To} field starts out as the address of the person who
 sent the message you received, and the @samp{CC} field starts out with
 all the other recipients of that message.
 
-@vindex rmail-dont-reply-to-names
+@vindex mail-dont-reply-to-names
   You can exclude certain recipients from being included automatically
-in replies, using the variable @code{rmail-dont-reply-to-names}.  Its
+in replies, using the variable @code{mail-dont-reply-to-names}.  Its
 value should be a regular expression; any recipients that match are
 excluded from the @samp{CC} field.  They are also excluded from the
 @samp{To} field, unless this would leave the field empty.  If this
 variable is nil, then the first time you compose a reply it is
-initialized to a default value that matches your own address, and any
-name starting with @samp{info-}.  (Those names are excluded because
-there is a convention of using them for large mailing lists to broadcast
-announcements.)
+initialized to a default value that matches your own address.
 
   To omit the @samp{CC} field completely for a particular reply, enter
 the reply command with a numeric argument: @kbd{C-u r} or @kbd{1 r}.
 This means to reply only to the sender of the original message.
 
-  Once the @samp{*mail*} buffer has been initialized, editing and
+  Once the mail composition buffer has been initialized, editing and
 sending the mail goes as usual (@pxref{Sending Mail}).  You can edit
 the presupplied header fields if they are not what you want.  You can
 also use commands such as @kbd{C-c C-y}, which yanks in the message
@@ -750,7 +776,7 @@ and yank the new current message.
 send the failed message back to you, enclosed in a @dfn{failure
 message}.  The Rmail command @kbd{M-m} (@code{rmail-retry-failure})
 prepares to send the same message a second time: it sets up a
-@samp{*mail*} buffer with the same text and header fields as before.  If
+mail composition buffer with the same text and header fields as before.  If
 you type @kbd{C-c C-c} right away, you send the message again exactly
 the same as the first time.  Alternatively, you can edit the text or
 headers and then send it.  The variable
@@ -763,23 +789,31 @@ headers are stripped from the failed message when retrying it.
 @cindex forwarding a message
   Another frequent reason to send mail in Rmail is to @dfn{forward} the
 current message to other users.  @kbd{f} (@code{rmail-forward}) makes
-this easy by preinitializing the @samp{*mail*} buffer with the current
-message as the text, and a subject designating a forwarded message.  All
-you have to do is fill in the recipients and send.  When you forward a
-message, recipients get a message which is ``from'' you, and which has
-the original message in its contents.
-
+this easy by preinitializing the mail composition buffer with the current
+message as the text, and a subject of the form @code{[@var{from}:
+@var{subject}]}, where @var{from} and @var{subject} are the sender and
+subject of the original message.  All you have to do is fill in the
+recipients and send.  When you forward a message, recipients get a
+message which is ``from'' you, and which has the original message in
+its contents.
+
+@vindex rmail-enable-mime-composing
 @findex unforward-rmail-message
-  Forwarding a message encloses it between two delimiter lines.  It also
-modifies every line that starts with a dash, by inserting @w{@samp{- }}
-at the start of the line.  When you receive a forwarded message, if it
+  Rmail offers two formats for forwarded messages.  The default is to
+use MIME (@pxref{Rmail Display}) format.  This includes the original
+message as a separate part.  You can use a simpler format if you
+prefer, by setting the variable @code{rmail-enable-mime-composing} to
+@code{nil}.  In this case, Rmail just includes the original message
+enclosed between two delimiter lines.  It also modifies every line
+that starts with a dash, by inserting @w{@samp{- }} at the start of
+the line.  When you receive a forwarded message in this format, if it
 contains something besides ordinary text---for example, program source
-code---you might find it useful to undo that transformation.  You can do
-this by selecting the forwarded message and typing @kbd{M-x
-unforward-rmail-message}.  This command extracts the original forwarded
-message, deleting the inserted @w{@samp{- }} strings, and inserts it
-into the Rmail file as a separate message immediately following the
-current one.
+code---you might find it useful to undo that transformation.  You can
+do this by selecting the forwarded message and typing @kbd{M-x
+unforward-rmail-message}.  This command extracts the original
+forwarded message, deleting the inserted @w{@samp{- }} strings, and
+inserts it into the Rmail file as a separate message immediately
+following the current one.
 
 @findex rmail-resend
   @dfn{Resending} is an alternative similar to forwarding; the
@@ -795,22 +829,28 @@ numeric argument.)
   Use the @kbd{m} (@code{rmail-mail}) command to start editing an
 outgoing message that is not a reply.  It leaves the header fields empty.
 Its only difference from @kbd{C-x 4 m} is that it makes the Rmail buffer
-accessible for @kbd{C-c C-y}, just as @kbd{r} does.  Thus, @kbd{m} can be
-used to reply to or forward a message; it can do anything @kbd{r} or @kbd{f}
-can do.
+accessible for @kbd{C-c C-y}, just as @kbd{r} does.
+@ignore
+@c Not a good idea, because it does not include Reply-To etc.
+Thus, @kbd{m} can be used to reply to or forward a message; it can do
+anything @kbd{r} or @kbd{f} can do.
+@end ignore
 
 @kindex c @r{(Rmail)}
 @findex rmail-continue
   The @kbd{c} (@code{rmail-continue}) command resumes editing the
-@samp{*mail*} buffer, to finish editing an outgoing message you were
+mail composition buffer, to finish editing an outgoing message you were
 already composing, or to alter a message you have sent.
 
 @vindex rmail-mail-new-frame
   If you set the variable @code{rmail-mail-new-frame} to a
 non-@code{nil} value, then all the Rmail commands to start sending a
 message create a new frame to edit it in.  This frame is deleted when
-you send the message, or when you use the @samp{Cancel} item in the
-@samp{Mail} menu.
+you send the message.
+@ignore
+@c FIXME does not work with Message -> Kill Message
+, or when you use the @samp{Cancel} item in the @samp{Mail} menu.
+@end ignore
 
   All the Rmail commands to send a message use the mail-composition
 method that you have chosen (@pxref{Mail Methods}).
@@ -888,8 +928,8 @@ commas.
 makes a partial summary mentioning only the messages that have one or
 more recipients matching the regular expression @var{rcpts}.  You can
 use commas to separate multiple regular expressions.  These are matched
-against the @samp{To}, @samp{From}, and @samp{CC} headers (with a prefix
-argument, this header is not included).
+against the @samp{To}, @samp{From}, and @samp{CC} headers (supply a prefix
+argument to exclude this header).
 
 @kindex C-M-t @r{(Rmail)}
 @findex rmail-summary-by-topic
@@ -1101,7 +1141,7 @@ buffer before sorting it.
 @section Display of Messages
 
   This section describes how Rmail displays mail headers,
-@acronym{MIME} sections and attachments, and URLs.
+@acronym{MIME} sections and attachments, URLs, and encrypted messages.
 
 @table @kbd
 @item t
@@ -1161,7 +1201,7 @@ Move point to the next @acronym{MIME} tagline button.
 (@code{rmail-mime-next-item}).
 
 @findex rmail-mime-previous-item
-@item @key{BackTab}
+@item S-@key{TAB}
 Move point to the previous @acronym{MIME} part
 (@code{rmail-mime-previous-item}).
 
@@ -1178,7 +1218,7 @@ immediately after its tagline, as part of the Rmail buffer, while
 taglines, with their actual contents hidden.  In either case, you can
 toggle a @acronym{MIME} part between its ``displayed'' and ``hidden''
 states by typing @key{RET} anywhere in the part---or anywhere in its
-tagline, apart from a tagline button for some other action.  Type
+tagline (except for buttons for other actions, if there are any).  Type
 @key{RET} (or click with the mouse) to activate a tagline button, and
 @key{TAB} to cycle point between tagline buttons.
 
@@ -1192,13 +1232,19 @@ variable @code{rmail-enable-mime} to @code{nil}.  When this is the
 case, the @kbd{v} (@code{rmail-mime}) command instead creates a
 temporary buffer to display the current @acronym{MIME} message.
 
+@findex rmail-epa-decrypt
+@cindex encrypted mails (reading in Rmail)
+  If the current message is an encrypted one, use the command @kbd{M-x
+rmail-epa-decrypt} to decrypt it, using the EasyPG library
+(@pxref{Top,, EasyPG, epa, EasyPG Assistant User's Manual}).
+
   You can highlight and activate URLs in the Rmail buffer using Goto
 Address mode:
 
 @c FIXME goto-addr.el commentary says to use goto-address instead.
-@smallexample
-(add-hook 'rmail-show-message-hook (lambda () (goto-address-mode 1)))
-@end smallexample
+@example
+(add-hook 'rmail-show-message-hook 'goto-address-mode)
+@end example
 
 @noindent
 Then you can browse these URLs by clicking on them with @kbd{Mouse-2}
@@ -1238,14 +1284,26 @@ It reads the name of a coding system, and then redecodes the message
 using the coding system you specified.  If you specified the right
 coding system, the result should be readable.
 
+@vindex rmail-file-coding-system
+  When you get new mail in Rmail, each message is translated
+automatically from the coding system it is written in, as if it were a
+separate file.  This uses the priority list of coding systems that you
+have specified.  If a MIME message specifies a character set, Rmail
+obeys that specification.  For reading and saving Rmail files
+themselves, Emacs uses the coding system specified by the variable
+@code{rmail-file-coding-system}.  The default value is @code{nil},
+which means that Rmail files are not translated (they are read and
+written in the Emacs internal character code).
+
 @node Rmail Editing
 @section Editing Within a Message
 
-  Most of the usual Emacs keybindings are available in Rmail mode, though a
-few, such as @kbd{C-M-n} and @kbd{C-M-h}, are redefined by Rmail for
-other purposes.  However, the Rmail buffer is normally read only, and
-most of the letters are redefined as Rmail commands.  If you want to
-edit the text of a message, you must use the Rmail command @kbd{e}.
+  Most of the usual Emacs key bindings are available in Rmail mode,
+though a few, such as @kbd{C-M-n} and @kbd{C-M-h}, are redefined by
+Rmail for other purposes.  However, the Rmail buffer is normally read
+only, and most of the letters are redefined as Rmail commands.  If you
+want to edit the text of a message, you must use the Rmail command
+@kbd{e}.
 
 @table @kbd
 @item e
@@ -1276,13 +1334,13 @@ the message, if you have made any changes in it.
 @cindex undigestify
 
   A @dfn{digest message} is a message which exists to contain and carry
-several other messages.  Digests are used on some moderated mailing
+several other messages.  Digests are used on some mailing
 lists; all the messages that arrive for the list during a period of time
 such as one day are put inside a single digest which is then sent to the
-subscribers.  Transmitting the single digest uses much less computer
+subscribers.  Transmitting the single digest uses less computer
 time than transmitting the individual messages even though the total
-size is the same, because the per-message overhead in network mail
-transmission is considerable.
+size is the same, because of the per-message overhead in network mail
+transmission.
 
 @findex undigestify-rmail-message
   When you receive a digest message, the most convenient way to read it is
@@ -1297,14 +1355,15 @@ message itself is flagged as deleted.
 @section Reading Rot13 Messages
 @cindex rot13 code
 
-  Mailing list messages that might offend some readers are sometimes
+  Mailing list messages that might offend or annoy some readers are sometimes
 encoded in a simple code called @dfn{rot13}---so named because it
 rotates the alphabet by 13 letters.  This code is not for secrecy, as it
-provides none; rather, it enables those who might be offended to avoid
-seeing the real text of the message.
+provides none; rather, it enables those who wish to to avoid
+seeing the real text of the message.  For example, a review of a film
+might use rot13 to hide important plot points.
 
 @findex rot13-other-window
-  To view a buffer which uses the rot13 code, use the command @kbd{M-x
+  To view a buffer that uses the rot13 code, use the command @kbd{M-x
 rot13-other-window}.  This displays the current buffer in another window
 which applies the code when displaying the text.
 
@@ -1317,22 +1376,24 @@ your Rmail file (@pxref{Rmail Inbox}).  When loaded for the first time,
 Rmail attempts to locate the @code{movemail} program and determine its
 version.  There are two versions of the @code{movemail} program: the
 native one, shipped with GNU Emacs (the ``emacs version'') and the one
-included in GNU mailutils (the ``mailutils version,''
+included in GNU mailutils (the ``mailutils version'',
 @pxref{movemail,,,mailutils,GNU mailutils}).  They support the same
 command line syntax and the same basic subset of options.  However, the
 Mailutils version offers additional features.
 
-  The Emacs version of @code{movemail} is able to retrieve mail from the
-usual UNIX mailbox formats and from remote mailboxes using the POP3
-protocol.
+  The Emacs version of @code{movemail} is able to retrieve mail from
+the usual Unix mailbox formats and from remote mailboxes using the
+POP3 protocol.
 
   The Mailutils version is able to handle a wide set of mailbox
-formats, such as plain UNIX mailboxes, @code{maildir} and @code{MH}
-mailboxes, etc.  It is able to access remote mailboxes using the POP3 or
-IMAP4 protocol, and can retrieve mail from them using a TLS encrypted
-channel.  It also accepts mailbox arguments in @acronym{URL} form.
-The detailed description of mailbox @acronym{URL}s can be found in
-@ref{URL,,,mailutils,Mailbox URL Formats}.  In short, a @acronym{URL} is:
+formats, such as plain Unix mailboxes, @code{maildir} and @code{MH}
+mailboxes, etc.  It is able to access remote mailboxes using the POP3
+or IMAP4 protocol, and can retrieve mail from them using a TLS
+encrypted channel.  It also accepts mailbox arguments in @acronym{URL}
+form.  The detailed description of mailbox @acronym{URL}s can be found
+@c Note this node seems to be missing in some versions of mailutils.info?
+in @ref{URL,,,mailutils,Mailbox URL Formats}.  In short, a
+@acronym{URL} is:
 
 @smallexample
 @var{proto}://[@var{user}[:@var{password}]@@]@var{host-or-file-name}
@@ -1363,9 +1424,9 @@ local mailbox.
 
 @table @code
 @item mbox
-Usual UNIX mailbox format.  In this case, neither @var{user} nor
-@var{pass} are used, and @var{host-or-file-name} denotes the file name of
-the mailbox file, e.g., @code{mbox://var/spool/mail/smith}.
+Usual Unix mailbox format.  In this case, neither @var{user} nor
+@var{pass} are used, and @var{host-or-file-name} denotes the file name
+of the mailbox file, e.g., @code{mbox://var/spool/mail/smith}.
 
 @item mh
 A local mailbox in the @acronym{MH} format.  @var{User} and
@@ -1409,8 +1470,8 @@ This is equivalent to specifying the @samp{file} protocol:
 @code{movemail} to use.  If that is a string, it specifies the
 absolute file name of the @code{movemail} executable.  If it is
 @code{nil}, Rmail searches for @code{movemail} in the directories
-listed in @code{rmail-movemail-search-path} and @code{exec-path}, then
-in @code{exec-directory}.
+listed in @code{rmail-movemail-search-path}, then in @code{exec-path}
+(@pxref{Shell}), then in @code{exec-directory}.
 
 @node Remote Mailboxes
 @section Retrieving Mail from Remote Mailboxes
@@ -1451,7 +1512,7 @@ the machine on which to look for the POP server.
 @c FIXME mention --with-hesiod "support Hesiod to get the POP server host"?
 
 @cindex IMAP mailboxes
-  Another method for accessing remote mailboxes is IMAP.  This method is
+  Another method for accessing remote mailboxes is IMAP@.  This method is
 supported only by the Mailutils @code{movemail}.  To specify an IMAP
 mailbox in the inbox list, use the following mailbox @acronym{URL}:
 @samp{imap://@var{username}[:@var{password}]@@@var{hostname}}.  The
@@ -1506,7 +1567,7 @@ use it, add the @samp{--tls} flag to @code{rmail-movemail-flags}.
 @section Retrieving Mail from Local Mailboxes in Various Formats
 
   If your incoming mail is stored on a local machine in a format other
-than UNIX mailbox, you will need the Mailutils @code{movemail} to
+than Unix mailbox, you will need the Mailutils @code{movemail} to
 retrieve it.  @xref{Movemail}, for the detailed description of
 @code{movemail} versions.  For example, to access mail from a inbox in
 @code{maildir} format located in @file{/var/spool/mail/in}, you would