Expiration means deletion of old messages which have outlasted a certain period of time.
wl-expire
supports not only simple deletion, but also moving to
specified archiving folders.
Configure wl-expire-alist
and press e in the folder mode,
or M-e in the summary mode.
wl-expire-alist
An example configuration of wl-expire-alist
is shown below.
Everything in this wl-expire-alist
makes a great difference in
expiration, so be careful. I advise you to set wl-expire-use-log
to t
, especially in the initial stage.
(setq wl-expire-alist
'(("^\\+trash$" (date 14) remove)
;; delete
("^\\+tmp$" (date 7) trash)
;; re-file to wl-trash-folder
("^\\+outbox$" (number 300) "$outbox;lha")
;; re-file to the specific folder
("^\\+ml/tmp$" nil)
;; do not expire
("^\\+ml/wl$" (number 500 510) wl-expire-archive-number1 t)
;; archive by message number (retaining numbers)
("^\\+ml/.*" (number 300 310) wl-expire-archive-number2 t)
;; archive by a fixed number (retaining numbers)
("^\\+diary$" (date 30) wl-expire-archive-date)
;; archive by year and month (numbers discarded)
))
Items in the list has the format of:
(regexp-for-folders specification-of-messages-to-be-deleted destination)
The folder is examined if it matches regexp-for-folders from the
beginning of the list. If you invoke expiration on the folder that does
not match any of them, nothing will happen. And if either the second or
the third element of the item is nil
, expiration will not take
place.
You can use any one of the following for specification-of-message-to-be-deleted:
(number n1 [n2])
wl-summary-expire-reserve-marks
(marked
with important/new/unread) are not deleted.
If wl-expire-number-with-reserve-marks
is non-nil, the folder
will expire so as to have 500 messages including such ones.
Otherwise, it will have 500 messages except such ones.
(date d1)
You can use any one of the following in the place of destination:
remove
hide
trash
wl-trash-folder
.
wl-summary-expire-reserve-marks
, be careful in writing your own
function.
These are four standard functions; three of them move messages to an archive
folder in the specified way. This means old messages can be compressed
and saved in a file, being deleted from the original folder.
The last one divides messages to some MH folders.
wl-expire-archive-number1
wl-expire-archive-files
is 200, messages will be re-filed to
`wl-00000.zip', `wl-00200.zip', `wl-00400.zip', ....
The archiving folders to which messages are re-filed are determined by
the name of the folder as follows (in this case, archiving folders are
handled as if elmo-archive-treat-file
were non-nil).
wl-expire-archive-folder-prefix
.
Refer to wl-expire-archive-folder-prefix
for details.
wl-expire-archive-number2
wl-expire-archive-number1
.
wl-expire-archive-date
$folder-199812;zip
. The name of the archiving folders except the
date part are determined in the same way as
wl-expire-archive-number1
.
You can set the first argument to these three standard functions to non-nil
in wl-expire-alist
so as to retain message numbers in the folder.
For example, it can be specified just after the name of the function:
("^\\+ml/wl$" (number 300 310) wl-expire-archive-number1 t)If you omit the argument, consecutive numbers from 1 are assigned for each archiving folder.
wl-expire-localdir-date
If you specify any of remove
, trash
, a folder name, or a
standard function, messages with marks in
wl-summary-expire-reserve-marks
(which are called reserved
messages thereafter) are retained.
Per default, this variable include the important, new, and unread marks, so that messages with these marks are not removed. Note that you cannot include the temporary mark (i.e. temporary marks are removed anyway), and be sure to process temporary marks before you invoke expiration.
The following setup invokes expiration when you move into the summary mode. There will be no confirmation, so make sure you made no mistake in regexp and other settings before you set up this.
(add-hook 'wl-summary-prepared-pre-hook 'wl-summary-expire)
In the folder mode, you can invoke expiration per group as well as per
folder. Therefore, if you specify `Desktop' group, all folders
matching wl-expire-alist
expire.
To treat archive folders created by wl-expire-archive-number1
and so on,
you must set non-nil value to elmo-archive-treat-file
.
If you are to use remove
, try trash
at first and see
messages move to wl-trash-folder
as expected, then replace it
with remove
. It would be dangerous to use remove
from the
beginning.
If you are to use wl-expire-archive-number1
and the like, try to
make a folder of the archiver type (zip
or lha
) and see if
you can append messages to it. Even if settings in
wl-expire-alist
and elmo-archive
are correct, messages
would not be saved anywhere and disappeared in case the archiver program
fails.
After you make sure you can archive to the folder correctly, you can invoke expiration and utilize the log.
If you set wl-expire-use-log
to t
,
`~/.elmo/expired-log' should contain the log, for example:
delete +ml/wl (593 594 595 596 597 598 599) move +ml/wl -> $ml/wl-00600;tgz;wl (600 601 602)
The first column indicates the operation, i.e. `delete', `copy', or `move'. The next is the name of the folder that expired. In the case of `copy' and `move', the destination folder is recorded after `->'. The last is the list of message numbers that are actually deleted or moved (in the case of `copy' and `move', the number is the one in the source folder, rather than the destination folder).
The three standard functions copy reserved messages to the archive
folder, but do not delete them from the source folder. Because
reserved messages and the like always remain, they are recorded in
`~/.elmo/expired-alist' so that they are not copied over and over
again. They are not recorded if copied by wl-summary-archive
.
If you enabled logging, usually `move' is recorded for re-filing, but instead `copy' and `delete' are recorded separately if reserved messages are involved. This is because it actually copies messages including reserved, then deletes ones except reserved in that case.
wl-expire-alist
nil
.
This variable specifies folders and methods to expire. For details,
refer to wl-expire-alist
settings above.
wl-summary-expire-reserve-marks
(list wl-summary-important-mark wl-summary-new-mark wl-summary-unread-mark wl-summary-unread-uncached-mark wl-summary-unread-cached-mark)Messages with these marks are retained in the folder, even after expiration. Only permanent marks can be listed, not temporary marks. You can list marks one by one as in the default; you can use the following settings as well:
all
wl-summary-read-uncached-mark
is included in addition to the
defaults.
none
wl-expire-archive-files
wl-expire-number-with-reserve-marks
nil
.
If non-nil, if expiring messages are specified by number
,
messages with wl-summary-expire-reserve-marks
are also retained.
wl-expire-archive-get-folder-function
wl-expire-archive-get-folder
.
This variable specifies a function that returns the name of an archiving
folder for standard functions in the place of destination.
You can use the following three variables for simple modification of
folder names; if you want more complex settings, define your own
function in this variable.
wl-expire-archive-get-folder
can be customized by these
variables:
wl-expire-archive-folder-name-fmt
wl-expire-archive-folder-type
wl-expire-archive-folder-prefix
wl-expire-archive-folder-name-fmt
format
string for archiving folders used in
wl-expire-archive-number1
and wl-expire-archive-number2
.
Note that you must specify the message number by `%%d', because it
is parsed twice by format
.
If you modify this, adjust wl-expire-archive-folder-num-regexp
as
well.
wl-expire-archive-date-folder-name-fmt
format
string for archiving folders used in
wl-expire-archive-date
. Note that you must specify the message
number by `%%d', because it is parsed twice by format
.
There should be `%%d' twice, one for the year and the other for the
month.
If you modify this, adjust
wl-expire-archive-date-folder-num-regexp
as well.
wl-expire-archive-folder-type
zip
.
This variable specifies an archiver type of the archiving folders.
wl-expire-archive-folder-prefix
nil
.
This variable specifies the prefix (directory structure) to archiving
folders.
Exercise extreme caution in using this feature, as it has not been
seriously tested.
In the worst case, there is a fear of destructing archiving folders.
nil
short
t
wl-expire-archive-folder-num-regexp
elmo-list-folders
.
Set it in accordance with wl-expire-archive-folder-name-fmt
.
wl-expire-archive-date-folder-num-regexp
elmo-list-folders
.
Set it in accordance with wl-expire-archive-date-folder-name-fmt
.
wl-expire-delete-oldmsg-confirm
t
.
If non-nil, messages older than the one with the largest number will be
deleted with confirmation.
If nil
, they are deleted without confirmation.
This feature is valid only if non-nil is specified as a argument to the
standard functions so as to retain numbers.
wl-expire-use-log
nil
.
If non-nil, expiration logs are recorded in `~/.elmo/expired-log'.
They are appended but not truncated or rotated automatically; you might
need to remove it manually.
wl-expire-add-seen-list
t
.
If non-nil, when messages are re-filed by expiration, read/unread
information is passed to the destination folder.
However if you do not read the destination folder from Wanderlust,
`seen' under `~/.elmo/' grows larger and larger, so you might
want to set this to nil
if you are simply saving to some
archiving folders. Even if its value is nil
, messages in the
archiving folders are simply treated as unread; it does not affect
expiration itself.
wl-expire-folder-update-msgdb
t
.
If t
, in the folder mode, expiration is carried out after
updating summary information. If you specified a list of regular
expressions of folder names, summary information is updated for matching
folders only.
Go to the first, previous, next, last section, table of contents.