[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

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.


[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

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:

(setq mew-use-node-folder nil)

[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

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

Let’s look at an example.

(setq mew-refile-guess-alist
  '(("To:"
      ("staff@example.jp"  "+jp/staff")
      ("staff@example.net" "+net/staff"))))

This means that if To: contains staff@example.jp +jp/staff is selected and if To: has staff@example.net +net/staff is chosen.

The format of this rule is as follow:

rule ::= '<rule>
<rule> ::= ((<key> <alist>) (<key> <alist>) ... [<special>])

The whole is a list of (<key> <alist>). A field name is specified for <key>. The format for <alist> is as follows:

<alist> ::= (<value> <folder>|<rule>) (<value> <folder>|<rule>) ...

<value> is a field value for <key>. <folder> means a folder to be chosen if matched. You can write <rule> recursively instead of <folder>. (See section The format of configuration.)

There are two special <key>s: ‘nil’ and ‘t’. ‘nil’ is used to specify <folder> to be returned when nothing is guessed. ‘t’ can specify <folder> to be returned in addition to guessed values.

<special> ::= (t <folder>) | (nil <folder>)

If you know regular expression, a more advanced rule can be defined like this.

(setq mew-refile-guess-alist
  '(("Newsgroups:"
    ("^nifty\\.\\([^ ]+\\)" "+Nifty/\\1")
    (".*"                   "+rec/news"))
   ("To:"
    ("\\(inet\\|wide\\)@wnoc-fuk" "+wide/\\1-wnoc-fuk"))
   ("From:" 
    ("uucp@"    "+adm/uucp")
    ("ftpsync@" "+adm/ftpsync"))
   (nil "+unknown")))

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


[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

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’.


[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

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:.


[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

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:

(setq mew-refile-guess-alist
  '(("From:"
      ("piglet@example.org" "+from/piglet")
      ("p-p-p@example.org"  "+from/piglet"))))

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).


[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

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’.


[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

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’.

The function name is ‘mew-refile-guess-by-default’.


[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

5.8 Controlling rules

Mew controls guess rules by two variables, ‘mew-refile-guess-control’ and ‘mew-refile-ctrl-multi’. If you want multiple candidates, set ‘mew-refile-ctrl-multi’ ‘t’. Otherwise, set it ‘nil’.

By default, ‘mew-refile-guess-control’ is declared as follows (since it is a declaration, ‘defvar’ is used):

(defvar mew-refile-guess-control
  '(mew-refile-guess-by-alist
    mew-refile-ctrl-throw
    mew-refile-guess-by-newsgroups
    mew-refile-guess-by-folder
    mew-refile-ctrl-throw
    mew-refile-ctrl-auto-boundary
    mew-refile-guess-by-thread
    mew-refile-ctrl-throw
    mew-refile-guess-by-from-folder
    mew-refile-ctrl-throw
    mew-refile-guess-by-from
    mew-refile-ctrl-throw
    mew-refile-guess-by-default))

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’.

C-uo’ displays the flow of guess rules in Message buffer.


[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

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’.

C-uM-o’ targets messages marked with ‘*’ regardless the value of ‘mew-refile-auto-refile-skip-any-mark’.

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.

(defvar mew-refile-guess-control
  '(mew-refile-guess-by-alist
    mew-refile-ctrl-throw
    mew-refile-guess-by-newsgroups
    mew-refile-guess-by-folder
    mew-refile-ctrl-throw
    mew-refile-ctrl-auto-boundary
    mew-refile-guess-by-thread
    mew-refile-ctrl-throw
    mew-refile-guess-by-from-folder
    mew-refile-ctrl-throw
    mew-refile-guess-by-from
    mew-refile-ctrl-throw
    mew-refile-guess-by-default))

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.


[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

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.

lc

Copy a message to a local folder.

mlc

Copy messages marked with ‘*’ to a local folder.

li

Copy a message to the server side of IMAP.

mli

Copy messages marked with ‘*’ to the server side of IMAP.


[ << ] [ >> ]           [Top] [Contents] [Index] [ ? ]

This document was generated on April 16, 2012 using texi2html 5.0.