[Contents]   [Back]   [Prev]   [Up]   [Next]   [Forward]  


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


[Contents]   [Back]   [Prev]   [Up]   [Next]   [Forward]