Re: user-functions

From: Edward S. Hirgelt (esh@tibco.com)
Date: Mon Jan 13 1997 - 20:01:00 CET


>>>>> "Kevin" == Kevin Moye <kjm@cobia.epfl.ch> writes:

    Kevin> It seems like having the ability to define arguments for
    Kevin> user-functions would greatly increase the flexiblity of
    Kevin> ctwm. Let me give an example:

[example deleted]

    Kevin> Function "Workspace_application( workspace application )"
    Kevin> {
    Kevin> f.gotoworkspace workspace
    Kevin> f.exec application
    Kevin> }

What you can do instead is use M4. You can write the function above
as a simple M4 macro that looks something like

define(`Workspace_application',`
Function "WS_$1_$2"
{
   f.gotoworkspace "$1"
   f.exec $2
}
')

Now you can say

Workspace_application(One,app1)
Workspace_application(Two,app1)
Workspace_application(Three,app1)

Then, bind WS_One_app1, WS_Two_app1, and WS_Three_app1 to the
appropriate events.

With a little effort you can develop some M4 macros to deal with most
of the repitition. I suspect that by using diversions you can even
use a macro for binding the function that automatically generates the
definition and ensures that it appears in the right spot in .ctwmrc

This should be a lot easier than adding this to CTWM.

Hope this helps,
Ed
----------------------------------------------------------------------
 Edward S. Hirgelt "Education is the ability to listen to
 TIBCO Inc. almost anything without losing your
                                temper or your self-confidence."
 Palo Alto, Ca --Robert Frost
 esh@tibco.com 415 846 5034
----------------------------------------------------------------------



This archive was generated by hypermail 2.1.2 : Sat Jun 22 2002 - 06:45:03 CEST