5 Happy refiling

When you come to receive hundreds of messages in a day (do not you
believe it?), refiling messages becomes a very tough job. Mew neatly
guesses default folders where the message is supposed to be refiled when
you type ‘o’. You can see an example below.

Folder name (+work/mew-dist): +

If the default value in () is proper, just type ‘RET’. The messages
will be marked with ‘o’ if its refiling folders are decided.

You can refile a message to folders of the same world to which the
message belong. As described above, a world is identified by a
combination of "case" and proto. When you input a folder to which the
message is refiled, you must not specify "case" and you must input a
folder whose proto is the same. The reason why you must not specify
"case" is that the "case" is already known. With other commands, you
have to specify the "case", if necessary, when you input folder name
in minibuffer. This command is only the exception.

Mew also provides ‘c’ which is very similar to ‘o’. To know
the difference, please refer to Refile ‘o’.

As you know, the more excellent refiling guess algorithms become, the
less user’s job troublesome. Mew provides you with the following rules.

5.1 Guess by mailing-list folders

Many users tend to refile messages destined to a mailing-list to a
folder whose name is the same as the mailing-list. Mew provides a
mechanism to guess a mailing-list folder for messages destined to
mailing-lists.

Suppose that you have a folder named +misc/pooh-lovers. The following
message is probably to be refiled to this folder.

To: pooh-lovers@example.org

Likewise, Mew searches a matching folder forward with addresses on To:
and Cc:. There are many people who do not use recursive folders. With
Mew, however, you would not be smart if you do not use it.

Smart users may wonder that they get a trouble in the following
situation where private addresses are on To: or Cc:.

To: piglet@example.org
Cc: pooh-lovers@example.org

Since Pooh is a member of pooh-lovers, he receives this message. But he
has a folder for his friend, Piglet. So, +from/piglet may be chosen.

To avoid this, Mew allows you to specify which folders are to be
ignored. The default is +from. So, please take a convention to refile
personal messages under +from.

When Mew guesses a candidate by the folders, it asks you:

Folder name (+misc/pooh-lovers): +

Just type ‘RET’ if the default is exactly what you want.

If you specify a new folder with ‘o’, the folder is created and
added to the folder list to be used for guess. Convenient, isn’t it?

The function name to provide this feature is
‘mew-refile-guess-by-folder’.

If you don’t use capital letters for folder names, configure as follows
to make this function faster:

(setq mew-use-fast-refile t)

By default, candidate includes node folders as well as leaf folders.
If you want to not select node folders but leave folders only,
configure as follows:

5.2 Guess by user defined rules

There are some cases where the refile guess mechanism by folders does
not work as you wish. For example, for both a message whose To: is
staff@example.jp and another message whose To: is staff@example.net,
the same folder would be selected with guess by folders
(e.g. "+net/staff"). So, Mew allows you to define your own rules
explicitly. (You must use the new format for
‘mew-refile-guess-alist’. For more information, see

5.3 Guess by thread

Mew provides a mechanism to guess a folder where the parent message of a
current message was refiled before.

For example, Pooh, Piglet, and Roo had a chat to go and get honey. So,
Pooh made +project/honey then refiled the message to it. The further
messages, if they are properly replied, they are supposed to be refiled
to +project/honey.

Information that which folder was chosen for messages is stored to
"~/Mail/.mew-refile-msgid-alist". ‘mew-lisp-max-length’
controls the amount of this information. The default value is 2000
messages. If you want limits it to 3000 messages, put the following to
"~/.mew.el".

(setq mew-lisp-max-length 3000)

The function name to provide this feature is
‘mew-refile-guess-by-message-id’.

5.4 Guess by private folders

In addition to the mechanism to select a mailing-list folder described
in Guess by mailing-list folders, Mew provides a mechanism to choose a private
folder. Since private folders locate under +from, we can say that this
mechanism select a folder from the folders under +from. Let’s see the
following example:

To: pooh@example.net
From: piglet@example.org

Pooh received a message from Piglet. If Pooh uses this mechanism,
+from/piglet will be chosen according to From:. (Folders under +from can
be recurse. And you can select the entire address for a folder name
instead of the user part.)

The function to provide this feature is
‘mew-refile-guess-by-from-folder’.

Next, let’s consider a care where Pooh replied to Piglet. Since Pooh
Cc:ed the message to himself, the message was also delivered to him.

To: piglet@example.org
Cc: pooh@example.net
From: pooh@example.net

How do you feel if you are Pooh? You may want to refile this to
+from/pooh. Also, you may want to move this to +from/piglet. So, it
can be customized.

If ‘mew-refile-guess-from-me-is-special’ is ‘t’ and if an
address in From: is yourself, ‘mew-refile-guess-by-from-folder’
select a folder under +from according to To: and/or Cc:.

5.5 Guess by From:

Mew also provides a mechanism to guess a folder by the place where a
message that has the same From: field is refiled.

Suppose that Piglet has two addresses, piglet@example.org and
p-p-p@example.org. Pooh wants to refile messages from Piglet to
+from/piglet no matter what his From: is. This policy can, of course, be
implemented if Pooh specifies rules explicitly as follows:

But such a work may bother you. So, first refile a message whose From:
is piglet@example.org to +from/piglet. At this time, +from/piglet is
created. Next, refile a message whose From: is p-p-p@example.org to
+from/piglet. Here Mews learns that p-p-p@example.org was refiled to
+from/piglet. After this, when messages whose From: is p-p-p@example.org
are refiled, +from/piglet is chosen.

For another example, you can refile messages from machinery to +adm/misc
without defining an explicit rule.

Information for relationship between From: and folder is stored to
"~/Mail/.mew-refile-from-alist". ‘mew-lisp-max-length’
controls the amount of this information as the same as
Guess by thread.

The function name to provide this feature is
‘mew-refile-guess-by-from’.

If the value of ‘mew-refile-guess-from-me-is-special’ is ‘t’,
‘mew-refile-guess-by-from’ acts as
‘mew-refile-guess-by-from-folder’ (see section Guess by private folders).

5.6 Guess by Newsgroups:

For those who read articles of NetNews received by e-mail with Mew, Mew
provides a mechanism to guess a folder by Newsgroups:. The function name
to provide this feature is ‘mew-refile-guess-by-newsgroups’.

5.7 Guess by default rule

The default rule is to extract a user name from From: and to choose
‘+from/user’. But if ‘mew-refile-guess-strip-domainpart’ is
‘nil’, it extracts the entire address. So,
‘+from/user@domain’ is chosen. The default value of
‘mew-refile-guess-strip-domainpart’ is ‘t’.

Mew executes every function defined in ‘mew-refile-guess-control’
in order. Each function may guess multiple candidates.

Let’s see the following example of ‘mew-refile-guess-control’
action.

‘mew-refile-guess-by-alist’

guessed +aaa and +bbb.

‘mew-refile-guess-by-folder’

guessed +ccc and +ddd.

‘mew-refile-guess-by-default’

guessed +eee.

If you want to provide all candidates, +aaa - +eee, set
‘mew-refile-ctrl-multi’ ‘t’. If you want to provide +aaa only,
set it ‘nil’.

If you want +aaa - +ddd but do not want left candidates, in other words,
you want +eee only when no candidate is guessed by functions executed
before, set ‘mew-refile-ctrl-multi’ ‘t’ and insert
‘mew-refile-ctrl-throw’ between ‘mew-refile-guess-by-folder’
and ‘mew-refile-guess-by-default’.

5.9 Auto refile

Those who receives many messages everyday is prone to store thousands of
messages in the +inbox (or %inbox) folder. In such a case, they may want
to speak out like this, "Hey messages, get out of the folder to
somewhere". Mew provides a feature to satisfy such laziness. :)
‘M-o’ is the spell.

When you execute this function, it marks specific messages with
‘o’. The specific messages mean messages which are not marked
with ‘o’ nor ‘D’ if
‘mew-refile-auto-refile-skip-any-mark’ is ‘nil’. If
‘mew-refile-auto-refile-skip-any-mark’ is ‘t’, they mean
non-marked messages (i.e. read). The default value of
‘mew-refile-auto-refile-skip-any-mark’ is ‘nil’.

Refile rule is the same described in the previous section. Please note
that what this function does is just mark messages with
‘o’. Messages are not refiled until you will press ‘x’.

Mew’s refile mechanism is so smart that it would be harmful for this
function. That is, most users would not understand where messages have
been refiled if Mew made most use of its guess mechanism. :) For this
reason, break is provided to limit usage of guess functions. Recall the
declaration up above.

You can find the ‘mew-refile-ctrl-auto-boundary’ function in
‘mew-refile-guess-control’. Only when auto refile is used, Mew
ignores guess functions below this function. If guess functions above
‘mew-refile-ctrl-auto-boundary’ didn’t guess any folder for a
message, the message is not marked with ‘o’. Insert
‘mew-refile-ctrl-auto-boundary’ before you ruin.

5.10 Copying messages across worlds

"Refile" described above is moving messages in the same world. By
contrast, you may want to move messages from a world to another
world. You can accomplish this by copying messages from a world to
another and deleting the original messages. Here we describe how to
copy messages to another world.

You may want to copy a message to a local folder. For this, type
‘lc’. If you execute ‘lc’ in a remote folder, Mew removes
information related to the remote folder from the cached message and
copy it to a local folder. (You can use ‘lc’ in a local folder,
too. In this case, a message is moved in the same world.)

To opy a message in a folder to an IMAP folder (the server side), type
‘li’.

To copy messages marked with ‘*’ to a local folder, use ‘mlc’.
To copy messages marked with ‘*’ to an IMAP folder, use ‘mli’.

Here is a summary of commands which copy messages from a world to
another.