Gnus can save articles in a number of ways. Below is the documentation
for saving articles in a fairly straight-forward fashion (i.e., little
processing of the article is done before it is saved). For a different
approach (uudecoding, unsharing) you should use gnus-uu
(see Decoding Articles).
For the commands listed here, the target is a file.
A directory name (ending in ‘/’) causes the target
to be a file under that directory. If you want to
save to a group, see the B c (gnus-summary-copy-article
)
command (see Mail Group Commands).
If gnus-save-all-headers
is non-nil
, Gnus will not delete
unwanted headers before saving the article.
If the preceding variable is nil
, all headers that match the
gnus-saved-headers
regexp will be kept, while the rest will be
deleted before saving.
Save the current article using the default article saver
(gnus-summary-save-article
).
Save the current article in a Unix mail box (mbox) file
(gnus-summary-save-article-mail
).
Save the current article in Rmail format
(gnus-summary-save-article-rmail
). This is mbox since Emacs 23,
Babyl in older versions.
Save the current article in plain file format
(gnus-summary-save-article-file
).
Write the current article in plain file format, overwriting any previous
file contents (gnus-summary-write-article-file
).
Save the current article body in plain file format
(gnus-summary-save-article-body-file
).
Save the current article in mh folder format
(gnus-summary-save-article-folder
).
Save the current article in a VM folder
(gnus-summary-save-article-vm
).
Save the current article in a pipe. Uhm, like, what I mean is—Pipe
the current article to a process (gnus-summary-pipe-output
).
If given a symbolic prefix (see Symbolic Prefixes), include the
complete headers in the piped output. The symbolic prefix r
is
special; it lets this command pipe a raw article including all headers.
The gnus-summary-pipe-output-default-command
variable can be set
to a string containing the default command and options (default
nil
).
Save the current article into muttprint. That is, print it using the
external program Muttprint. The program name and options to use is controlled by the
variable gnus-summary-muttprint-program
.
(gnus-summary-muttprint
).
All these commands use the process/prefix convention
(see Process/Prefix). If you save bunches of articles using these
functions, you might get tired of being prompted for files to save each
and every article in. The prompting action is controlled by
the gnus-prompt-before-saving
variable, which is always
by
default, giving you that excessive prompting action you know and
loathe. If you set this variable to t
instead, you’ll be prompted
just once for each series of articles you save. If you like to really
have Gnus do all your thinking for you, you can even set this variable
to nil
, which means that you will never be prompted for files to
save articles in. Gnus will simply save all the articles in the default
files.
You can customize the gnus-default-article-saver
variable to make
Gnus do what you want it to. You can use any of the eight ready-made
functions below, or you can create your own.
gnus-summary-save-in-rmail
¶This is the default format, that used by the Rmail package. Since Emacs
23, Rmail uses standard mbox format. Before this, it used the
Babyl format. Accordingly, this command writes mbox format since
Emacs 23, unless appending to an existing Babyl file. In older versions
of Emacs, it always uses Babyl format. Uses the function in the
gnus-rmail-save-name
variable to get a file name to save the
article in. The default is gnus-plain-save-name
.
gnus-summary-save-in-mail
¶Save in a Unix mail (mbox) file. Uses the function in the
gnus-mail-save-name
variable to get a file name to save the
article in. The default is gnus-plain-save-name
.
gnus-summary-save-in-file
¶Append the article straight to an ordinary file. Uses the function in
the gnus-file-save-name
variable to get a file name to save the
article in. The default is gnus-numeric-save-name
.
gnus-summary-write-to-file
¶Write the article straight to an ordinary file. The file is
overwritten if it exists. Uses the function in the
gnus-file-save-name
variable to get a file name to save the
article in. The default is gnus-numeric-save-name
.
gnus-summary-save-body-in-file
¶Append the article body to an ordinary file. Uses the function in the
gnus-file-save-name
variable to get a file name to save the
article in. The default is gnus-numeric-save-name
.
gnus-summary-write-body-to-file
¶Write the article body straight to an ordinary file. The file is
overwritten if it exists. Uses the function in the
gnus-file-save-name
variable to get a file name to save the
article in. The default is gnus-numeric-save-name
.
gnus-summary-save-in-folder
¶Save the article to an MH folder using rcvstore
from the MH
library. Uses the function in the gnus-folder-save-name
variable
to get a file name to save the article in. The default is
gnus-folder-save-name
, but you can also use
gnus-Folder-save-name
, which creates capitalized names.
gnus-summary-save-in-vm
¶Save the article in a VM folder. You have to have the VM mail reader to use this setting.
gnus-summary-save-in-pipe
¶Pipe the article to a shell command. This function takes optional two arguments COMMAND and RAW. Valid values for COMMAND include:
nil
default
gnus-summary-pipe-output-default-command
holds or the command
last used for saving.
Non-nil
value for RAW overrides :decode
and
:headers
properties (see below) and the raw article including all
headers will be piped.
The symbol of each function may have the following properties:
:decode
The value non-nil
means save decoded articles. This is
meaningful only with gnus-summary-save-in-file
,
gnus-summary-save-body-in-file
,
gnus-summary-write-to-file
,
gnus-summary-write-body-to-file
, and
gnus-summary-save-in-pipe
.
:function
The value specifies an alternative function which appends, not
overwrites, articles to a file. This implies that when saving many
articles at a time, gnus-prompt-before-saving
is bound to
t
and all articles are saved in a single file. This is
meaningful only with gnus-summary-write-to-file
and
gnus-summary-write-body-to-file
.
:headers
The value specifies the symbol of a variable of which the value
specifies headers to be saved. If it is omitted,
gnus-save-all-headers
and gnus-saved-headers
control what
headers should be saved.
All of these functions, except for the last one, will save the article
in the gnus-article-save-directory
, which is initialized from the
SAVEDIR
environment variable. This is ~/News/ by
default.
As you can see above, the functions use different functions to find a suitable name of a file to save the article in. Below is a list of available functions that generate names:
gnus-Numeric-save-name
¶File names like ~/News/Alt.andrea-dworkin/45.
gnus-numeric-save-name
¶File names like ~/News/alt.andrea-dworkin/45.
gnus-Plain-save-name
¶File names like ~/News/Alt.andrea-dworkin.
gnus-plain-save-name
¶File names like ~/News/alt.andrea-dworkin.
gnus-sender-save-name
¶File names like ~/News/larsi.
You can have Gnus suggest where to save articles by plonking a regexp into
the gnus-split-methods
alist. For instance, if you would like to
save articles related to Gnus in the file gnus-stuff, and articles
related to VM in vm-stuff, you could set this variable to something
like:
(("^Subject:.*gnus\\|^Newsgroups:.*gnus" "gnus-stuff") ("^Subject:.*vm\\|^Xref:.*vm" "vm-stuff") (my-choosing-function "../other-dir/my-stuff") ((equal gnus-newsgroup-name "mail.misc") "mail-stuff"))
We see that this is a list where each element is a list that has two
elements—the match and the file. The match can either be
a string (in which case it is used as a regexp to match on the article
head); it can be a symbol (which will be called as a function with the
group name as a parameter); or it can be a list (which will be
eval
ed). If any of these actions have a non-nil
result,
the file will be used as a default prompt. In addition, the
result of the operation itself will be used if the function or form
called returns a string or a list of strings.
You basically end up with a list of file names that might be used when saving the current article. (All “matches” will be used.) You will then be prompted for what you really want to use as a name, with file name completion over the results from applying this variable.
This variable is ((gnus-article-archive-name))
by default, which
means that Gnus will look at the articles it saves for an
Archive-name
line and use that as a suggestion for the file
name.
Here’s an example function to clean up file names somewhat. If you have lots of mail groups called things like ‘nnml:mail.whatever’, you may want to chop off the beginning of these group names before creating the file name to save to. The following will do just that:
(defun my-save-name (group) (when (string-match "^nnml:mail." group) (substring group (match-end 0)))) (setq gnus-split-methods '((gnus-article-archive-name) (my-save-name)))
Finally, you have the gnus-use-long-file-name
variable. If it is
nil
, all the preceding functions will replace all periods
(‘.’) in the group names with slashes (‘/’)—which means that
the functions will generate hierarchies of directories instead of having
all the files in the top level directory
(~/News/alt/andrea-dworkin instead of
~/News/alt.andrea-dworkin.) This variable is t
by default
on most systems. However, for historical reasons, this is nil
on
Xenix and usg-unix-v machines by default.
This function also affects kill and score file names. If this variable
is a list, and the list contains the element not-score
, long file
names will not be used for score files, if it contains the element
not-save
, long file names will not be used for saving, and if it
contains the element not-kill
, long file names will not be used
for kill files.
If you’d like to save articles in a hierarchy that looks something like a spool, you could
(setq gnus-use-long-file-name '(not-save)) ; to get a hierarchy (setq gnus-default-article-saver 'gnus-summary-save-in-file) ; no encoding
Then just save with o. You’d then read this hierarchy with
ephemeral nneething
groups—G D in the group buffer, and
the top level directory as the argument (~/News/). Then just walk
around to the groups/directories with nneething
.