Re: [Evolution] Expression: (match-all (header-exists "X-Junkmail"))



On Thu, 2003-10-30 at 12:18, Lars Weissflog wrote:
On Thu, 2003-10-30 at 17:00, Luke Scharf wrote:

Some googling suggested that the following statement should do what I
want: 
        (match-all (header-exists "X-Junkmail"))
However, it returns precisely zero messages.


Hi Luke,

could you give me some hints where to read about the sytax for the
expression box. Tried some time ago, but no luck. Apparently, I'm to
stupid to google successfully on this. 

As near as I've been able to find, the syntax isn't documented anywhere
-- at least by the Evolution folks.  If I had to bet, I'd say that they
used Guile.  See: http://www.gnu.org/software/guile/

I gathered that it's the Scheme programming language, which is a variant
of Lisp.  It's a functional programming language, which is substantially
different from C/C++/Java/Pascal/Bash/Windows batch file
language/Perl/etc.  I had to learn it for a class during my CS degree,
and it's very elegant for a some things.  Some people have trouble
wrapping their heads around it, since recursion[0] can get confusing if
you're not careful.  Computer Science types love this language because
the pieces that it's built out of are so simple.


Anyway, so now that the background's out of the way, I'll explain how to
read the expression that I'm trying to run.  In Lisp, everything is a
list.  A typical list would look like this:
        (item1 item2 item3)

That's great, but how do you make it do anything?  Well, if you call the
list as program code, then the first item is the name of a function and
the rest are data that the function can use.  It's a lot like Polish
notation for math:
        (add 1 2)
So, if you run the above list in a Scheme interpreter, you'll get 3,
assuming that someone has decided what "add" means.

So, the function (match-all #t) that I refer to means "select all
messages where true is true".  The #t is a shortcut for "true", and it's
a placeholder for something more interesting.

In Lisp, an item can be another list.  So, it's not uncommon to see
something like (add (add 2 3) 5), which equals 10 when it's done.  So,
now a typical use of the expression box would be something (line breaks
are ignored) like:
        (match-all
                (header-contains "From" "lscharf corepower com")
                (header-contains "To" "lscharf corepower com")
        )
As I understand it, this should "select all messages to are to and from
me" or, in plainer English, "select all messages that I wrote to
myself". 

I haven't been able to find any definitive documentation on this, and
the expressions that I really want don't work -- so I'm not exactly an
authority.  I'm just a CS geek who wants to manipulate his e-mail.

I suspect that the "Expression" box is a convenience for the developers
of Evolution, and wasn't really intended to do much more than allow the
geekiest of the geeky to do slightly more complex searches than what you
can do with the regular GUI.

Anyway, I hope that what I've written is helpful -- and I invite anyone
and everyone to correct me where may be wrong!

-Luke

[0] Aside from having lots of parentheses, Scheme doesn't get
complicated until your functions start calling themselves -- this is the
"recursion" that I mentioned above.  And that's a subject for a couple
of lectures in a programming class.




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]