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

6. Happy refiling

When you come to receive hundreds of messages in a day(don't 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.

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

6.1 Guess by mailing-list folders  
6.2 Guess by user defined rules  
6.3 Guess by thread  
6.4 Guess by private folders  
6.5 Guess by From:  
6.6 Guess by Newsgroups:  
6.7 Guess by default rule  
6.8 Controlling rules  
6.9 Auto refile  


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

6.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@mew.org 

Likewise, Mew searches a matching folder forward with addresses on To: and Cc:. There are many people who don't use recursive folders. With Mew, however, you would not be smart if you don't 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@mew.org
Cc: pooh-lovers@mew.org

Since pooh is a member of pooh-lovers, he receives this message. But he has a folder for his friend, pooh. 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'.


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

6.2 Guess by user defined rules

There are some cases where the refile guess mechanism by folders doesn't work as you wish. For example, for both a message whose To: is staff@mew.org and another message whose To: is staff@iijlab.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.

Let's look at an example.

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

This means that if To: contains staff@mew.org +net/mew/staff is selected and if To: has staff@iijlab.net +net/iijlab/staff is chosen.

The format of this rule is as follow:

 
rule ::= '((<key> <alist>) (<key> <alist>) (<key> <alist>) ...)

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. Please note that <value> and <folder> is separated with `.'.

There are two special <key>s: `nil' and `t'. `nil' is used to specify <value> to be returned when nothing is guessed. `t' is for <value> to be returned in addition to guessed values.

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] [ ? ]

6.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 1000 messages. If you want limits it to 2000 messages, put the following to "~/.emacs".

 
(setq mew-lisp-max-length 2000)

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


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

6.4 Guess by private folders

In addition to the mechanism to select a mailing-list folder described in See section 6.1 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@mew.org
From: piglet@mew.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@mew.org
Cc: pooh@mew.org
From: pooh@mew.org

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] [ ? ]

6.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@beech.tree.uk and p-p-p@mew.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@beech.tree.uk" . "+from/piglet")
      ("p-p-p@mew.org"        . "+from/piglet"))))

But such a work may bother you. So, first refile a message whose From: is piglet@beech.tree.uk to +from/piglet. At this time, +from/piglet is created. Next, refile a message whose From: is p-p-p@mew.org to +from/piglet. Here Mews learns that p-p-p@mew.org was refiled to +from/piglet. After this, when messages whose From: is p-p-p@mew.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 See section 6.3 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 6.4 Guess by private folders).


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

6.6 Guess by Newsgroups:

For those who read NetNews received by Email with Mew, Mew provides a mechanism to guess a folder by Newsgroups:. It will be also useful when Mew integrates NetNews in the future. The function name to provide this feature is `mew-refile-guess-by-newsgroups'.


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

6.7 Guess by default rule

The default rule is extract an address from From: and chooses `+from/user@domain'. But if `mew-refile-guess-strip-domainpart' is `t', it extracts the user part. So, `+from/user' is chosen.

The function name is `mew-refile-guess-by-default'.


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

6.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, +bbb.
`mew-refile-guess-by-folder'
guessed +ccc, +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 don't 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] [ ? ]

6.9 Auto refile

Those who receives many messages everyday is prone to store thousands of messages in the +inbox folder. In such a case, they may want to speak out like this, "Hey messages, get out of the +inbox 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. The default value of `mew-refile-auto-refile-skip-any-mark' is `nil'. If executed with `C-u', the targets mean 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.


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

This document was generated by XEmacs shared group account on December, 19 2009 using texi2html 1.65.