From xemacs-m  Wed Apr  9 05:54:17 1997
Received: from jagor.srce.hr (hniksic@jagor.srce.hr [161.53.2.130])
	by xemacs.org (8.8.5/8.8.5) with ESMTP id FAA10393
	for <xemacs-beta@xemacs.org>; Wed, 9 Apr 1997 05:54:13 -0500 (CDT)
Received: (from hniksic@localhost)
          by jagor.srce.hr (8.8.5/8.8.4)
	  id MAA21530; Wed, 9 Apr 1997 12:54:08 +0200 (MET DST)
Sender: hniksic@public.srce.hr
To: XEmacs Developers <xemacs-beta@xemacs.org>
Cc: kyle_jones@wonderworks.com
Cc: emacs-custom@sunsite.auc.dk
Subject: Re: minibuf.el
References: <kigbu7phc96.fsf@jagor.srce.hr> 	<QQckka25111.199704081500@crystal.WonderWorks.COM> 	<rj7midselu.fsf@zuse.dina.kvl.dk> 	<QQckke26142.199704081614@crystal.WonderWorks.COM> 	<rj4tdhscaa.fsf@zuse.dina.kvl.dk> 	<199704081655.MAA13047@anthem.CNRI.Reston.Va.US> <QQckkk27342.199704081735@crystal.WonderWorks.COM>
X-URL: ftp://gnjilux.cc.fer.hr/pub/unix/util/wget/
X-Attribution: Hrv
X-Face: &}4JQk=L;e.~x+|eo]#DGk@x3~ed!.~lZ}YQcYb7f[WL9L'Z*+OyA\nA
        EL1M(".[qvI#a2E6WYI5>>e7'@_)3Ol9p|Nn2wNa/;~06jL*B%tTcn/X
        vhAu7qeES0\|MF%$;sI#yn1+y"
From: Hrvoje Niksic <hniksic@srce.hr>
Date: 09 Apr 1997 12:54:07 +0200
Message-ID: <kighghg8o1c.fsf@jagor.srce.hr>
Lines: 134

Kyle Jones <kyle_jones@wonderworks.com> writes:

> I agree.  What I've decided to do with VM's hairball variables
> (vm-virtual-folder-alist, vm-auto-folder-alist, and vm-spool-files
> come to mind) is write functions to modify them.  The function would
> have simple call syntax which avoids users having to write lists of
> lists of lists of...

Customize can help here too.  It'I have meditated on the :inline
keyword hard and long, but I think I got it.

Here is a definition for `vm-virtual-folder-alist', as a nice
demonstration of the power of customize.  It might be useful to have
in the docs, or somewhere, as an example.

(defcustom vm-virtual-folder-alist nil
  "*Non-nil value should be a list of virtual folder definitions.

A virtual folder is a mapping of messages from one or more real folders
into what appears to be a single folder.  A virtual folder definition
specifies which real folders should be searched for prospective messages
and what the inclusion criteria are.

Each virtual folder definition should have the following form:

  (VIRTUAL-FOLDER-NAME
    ( (FOLDER-NAME ...)
      (SELECTOR [ARG ...]) ... )
    ... )

VIRTUAL-FOLDER-NAME is the name of the virtual folder being defined.
This is the name by which you and VM will refer to this folder.

FOLDER-NAME should be the name of a real folder.  There may be more than
one FOLDER-NAME listed, the SELECTORs within that sublist will apply to
them all.  If FOLDER-NAME is a directory, VM will assume this to mean that
all the folders in that directory should be searched.

The SELECTOR is a Lisp symbol that tells VM how to decide whether a message
from one of the folders specified by the FOLDER-NAMEs should be included
in the virtual folder.  Some SELECTORs require an argument ARG; unless
otherwise noted ARG may be omitted.

The recognized SELECTORs are:

   author          - matches message if ARG matches the author; ARG should be a
                     regular expression.
   and             - matches the message if all its argument
                     selectors match the message.  Example:
                        (and (author \"Derek McGinty\") (new))
                     matches all new messages from Derek McGinty.
                     `and' takes any number of arguments. 
   any             - matches any message.
   deleted         - matches message if it is flagged for deletion.
   edited          - matches message if it has been edited.
   filed           - matched message if it has been saved with its headers.
   forwarded       - matches message if it has been forwarded.
   header          - matches message if ARG matches any part of the header
                     portion of the message; ARG should be a
                     regular expression. 
   label           - matches message if message has a label named ARG.
   less-chars-than - matches message if message has less than ARG
                     characters.  ARG should be a number.
   less-lines-than - matches message if message has less than ARG
                     lines.  ARG should be a number.
   more-chars-than - matches message if message has more than ARG
                     characters.  ARG should be a number.
   more-lines-than - matches message if message has more than ARG
                     lines.  ARG should be a number.
   marked          - matches message if it is marked, as with vm-mark-message.
   new             - matches message if it is new.
   not             - matches message only if its selector argument
                     does NOT match the message.  Example:
                       (not (deleted))
                     matches messages that are not deleted.
   or              - matches the message if any of its argument
                     selectors match the message.  Example:
                        (or (author \"Dave Weckl\") (subject \"drum\"))
                     matches messages from Dave Weckl or messages
                     with the word \"drum\" in their Subject header.
                     `or' takes any number of arguments.
   read            - matches message if it is neither new nor unread.
   recipient       - matches message if ARG matches any part of the recipient
                     list of the message.  ARG should be a regular expression.
   replied         - matches message if it has been replied to.
   sent-after      - matches message if it was sent after the date ARG.
                     A fully specified date looks like this:
                       \"31 Dec 1999 23:59:59 GMT\"
                     although the parts can appear in any order.
                     You can leave out any part and it will
                     default to the current date's value for that
                     part, with the exception of the hh:mm:ss
                     part which defaults to midnight.
   sent-before     - matches message if it was sent before the date ARG.
                     A fully specified date looks like this:
                       \"31 Dec 1999 23:59:59 GMT\"
                     although the parts can appear in any order.
                     You can leave out any part and it will
                     default to the current date's value for that
                     part, with the exception of the hh:mm:ss
                     part which defaults to midnight.
   subject         - matches message if ARG matches any part of the message's
                     subject; ARG should be a regular expression.
   text            - matches message if ARG matches any part of the text
                     portion of the message; ARG should be a
                     regular expression.
   unread          - matches message if it is old but unread.
   written         - matches message if it has been saved without its headers.
"
  :type '(repeat
	  (list :inline t
		(string :tag "Virtual Folder")
		(repeat
		 :tag "Folder Contents"
		 (list :inline t
		       (repeat :tag "Files" (string :tag "Folder"))
		       (repeat :tag "Folder Selectors"
			       (list :inline t
				     (symbol :tag "Selector")
				     sexp)))))))

I hope this is satisfactory.  As an additional bonus, you can add
validation routines for selectors, etc.

Note for customize gurus:

I think that the lists with `:inline t' set shouldn't print `List' up
there, as they are spliced anyway.  It only obfuscates things.

-- 
Hrvoje Niksic <hniksic@srce.hr> | Student at FER Zagreb, Croatia
--------------------------------+--------------------------------
Unspeakable horrors from outer space paralyze the living and
resurrect the dead!

