These commands copy messages from an Rmail file into another file.
The commands o and C-o copy the current message into a specified file, adding it at the end. The two commands differ mainly in how much to copy: o copies the full message headers, even if they are not all visible, while C-o copies exactly the headers currently displayed and no more. See Rmail Display. In addition, o converts the message to Babyl format (used by Rmail in Emacs version 22 and before) if the file is in Babyl format; C-o cannot output to Babyl files at all.
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 save the buffer eventually in its file.
Sometimes you may receive a message whose body holds the contents of a
file. You can save the body to a file (excluding the message header)
with the w command (
these messages contain the intended file name in the ‘Subject’
field, so the w command uses the ‘Subject’ field as the
default for the output file name. However, the file name is read using
the minibuffer, so you can specify a different name if you wish.
You can also output a message to an Rmail file chosen with a menu.
In the Classify menu, choose the Output Rmail File menu item; then
choose the Rmail file you want. This outputs the current message to
that file, like the o command. The variables
rmail-secondary-file-regexp specify which files to offer in the
menu: the first variable says which directory to find them in; the
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.
Copying a message with o or C-o gives the original copy of the message the ‘filed’ attribute, so that ‘filed’ appears in the mode line when such a message is current.
If you like to keep just a single copy of every mail message, set
t; then the
o, C-o and w commands delete the original message
after copying it. (You can undelete it afterward if you wish.)
rmail-output-file-alist lets you specify
intelligent defaults for the output file, based on the contents of the
current message. The value should be a list whose elements have this
(regexp . name-exp)
If there's a match for regexp in the current message, then the
default file name for output is name-exp. If multiple elements
match the message, the first matching element decides the default file
name. The subexpression name-exp may be a string constant giving
the file name to use, or more generally it may be any Lisp expression
that returns a file name as a string.
applies to both o and C-o.
Rmail can automatically save messages from your primary Rmail file
(the one that
rmail-file-name specifies) to other files, based
on the value of the variable
This variable is a list of elements (‘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
applies the first that matches (if any). If the output file is
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.