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

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

This document was generated by U-X61T\saito on October, 15 2008 using texi2html 1.78.