[gnu.emacs] vm-auto-folder-alist -- how?

chris@ASYLUM.GSFC.NASA.GOV (Chris Shenton) (08/30/89)

I'm a new vm convert, trying to do the following:

(setq vm-auto-folder-alist 
      '(
	("Subject"
	 ("Returned"	. "unsent")
	 ("apollo"	. "gnu-emacs-apollo")
	 ("c++"		. "gnu-emacs-c++")
	 ("emacs" 	. "gnu-emacs")
	 ("monthly"	. "monthlies")
	 ("prolog"	. "gnu-emacs-prolog")
	 ("test" 	. "test-folder")
	 ("vms" 	. "gnu-emacs-vms")
	)
	("(From)|(Sender)"
	 ("steve" 	. "steve")
	 ("chris" 	. "chris")
	)
       )
)

It doesn't work. It frequently makes the auto-suggestion `c++',
but I guess that's from matching one or more occurrances of `c'; eg:
I'm not using the regexps properly. It never suggests anything else,
even when for example, `emacs' is blatently in the subject header...

Any hints would be appreciated. Thanks in advance.
------- End of forwarded message -------

grunwald@anchor.colorado.edu (Dirk Grunwald) (08/30/89)

I use things like the following:

(setq vm-auto-folder-alist
      '(
	("From"
	 (".*[lL]eimkuhler.*" . "ben.mail" )
	 (".*[kK]unze.*" . "kunze.mail")
	 (".*rms.*" . "rms.mail")
	 (".*tiemann.*" . "tiemann.mail")
	 (".*[tT]orek.*" . "torek.mail")
	 (".*boulder.*" . "CU.mail")
	 (".*[Cc]olorado.*" . "CU.mail")
	 )
	
	("Subject"
	 (".*[tT][eE][xX][xX]2.*" . "tex-utilities.mail")
	 (".*[Ff][Ii][Nn][Aa][Ll].*" . "Final.mail")
	 (".*[gG]\\+\\+" . "g++.mail"))
))

I've found it useful to have my vm mail files in in ``.mail''
and then add:

(setq auto-mode-alist
      (append (list
		< .... my other alist additions .... >
	(cons "\\.mail$" 'run-vm-mode))
	auto-mode-alist))
(defun run-vm-mode ()
  (vm (buffer-file-name)))


this starts up VM whenever you edit a .mail file - it also works with
the context-saving packages.

kuro@shochu.Sun.Com (Teruhiko Kurosaka - Sun Intercon) (08/31/89)

In article <8908301406.AA01144@asylum.gsfc.nasa.gov> chris@ASYLUM.GSFC.NASA.GOV (Chris Shenton) writes:

 |
 |I'm a new vm convert, trying to do the following:
 |
 |(setq vm-auto-folder-alist 
 |	'(
 ...
 |	  ("(From)|(Sender)"
 |	   ("steve" 	. "steve")
 |	   ("chris" 	. "chris")
 ...
 |
 |It doesn't work. It frequently makes the auto-suggestion `c++',
Mine doesn't work either.  I started suspecting that in vm-auto-folder-alist,
regular expressions of the form [xy] can be recognized properly but
xxxx|yyyy is not.  Does anyone know if this guess is right.
--
-------
T. Kurosaka ("Kuro") --- Sun Microsystems, Intercontinental Operation
Internet: kuro@Corp.Sun.Com  Voice:+1(415)496 6121  Fax: +1(415)858 0284
US Mail: Mail Stop A6-18, 1870 Embarcadero Rd., Palo Alto, CA 94303, USA

pk@tut.fi (Kellom{ki Pertti) (08/31/89)

On 30 Aug 89 18:40:19 GMT,
kuro@shochu.Sun.Com (Teruhiko Kurosaka - Sun Intercon) said:
kuro> In article <8908301406.AA01144@asylum.gsfc.nasa.gov> chris@ASYLUM.GSFC.NASA.GOV (Chris Shenton) writes:
kuro>  |I'm a new vm convert, trying to do the following:
kuro>  |(setq vm-auto-folder-alist 
kuro>  |	'(
kuro>  ...
kuro>  |	  ("(From)|(Sender)"
kuro>  |	   ("steve" 	. "steve")
kuro>  |	   ("chris" 	. "chris")
kuro>  ...
kuro>  |
kuro>  |It doesn't work. It frequently makes the auto-suggestion `c++',
kuro> Mine doesn't work either.  I started suspecting that in vm-auto-folder-alist,
kuro> regular expressions of the form [xy] can be recognized properly but
kuro> xxxx|yyyy is not.  Does anyone know if this guess is right.

From the elisp manual:
`\|'
     specifies an alternative.  Two regular expressions A and B with
     `\|' in between form an expression that matches anything that
     either A or B will match.

...
     Note that `\' also has special meaning inside the read syntax of
     Lisp strings (*Note String Type::).  Therefore, to build a regular
     expression that matches the `\' character, you must preceed each
     `\' in `"\\"' with another `\', i.e., `"\\\\"'.

Thus, the regexp that matches both (From) and (Sender) is, as an
elisp string, "(From)\\|(Sender)".

Hope this helps.
--
Pertti Kellom\"aki (TeX format)  # Software will be a science when programmers
  Tampere Univ. of Technology    #    stand on each other's shoulders instead
      Software Systems Lab       #            of each other's toes 

kjones@talos.uucp (Kyle Jones) (08/31/89)

Chris Shenton writes:
 > I'm a new vm convert, trying to do the following:
 > 
 > (setq vm-auto-folder-alist 
 >       '(
 >         ("Subject"
 > [...]
 >          ("c++"         . "gnu-emacs-c++")
 > [...]
 >         )

This should be ("c\\+\\+" . "gnu-emacs-c++") to work properly.  You
might want the "c" to be "[Cc]" since the regexp matching of
vm-auto-folder-alist is case sensitive.

 >         ("(From)|(Sender)"
 >          ("steve"       . "steve")
 >          ("chris"       . "chris")
 >         )

There are a number of things wrong with this, but the reason it won't
work is because the HEADER portion of the alist is supposed to be a
literal header name, not a regular expression.  The match always fails
because no header will ever begin a `('.  The incorrect regular
expression syntax has no bearing on the problem.  Use:

          ("From"
           ("steve"       . "steve")
           ("chris"       . "chris")
          )
          ("Sender"
           ("steve"       . "steve")
           ("chris"       . "chris")
          )