jed-users mailing list

[2003 Date Index] [2003 Thread Index] [Other years]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]

Re: Namespaces for modes?


"Paul Boekholt" <p.boekholt@xxxxxxxxx> wrote:

> The next version of cal.sl will have a function mark_diary_entries() that
> will highlight dates for which you have diary entries. Users may want
their
> appointments highlighted on starting the calendar with some lines in their
> .jedrc:
>
> autoload("mark_diary_entries", "cal");
> define calendar_mode_hook()
> {
>    mark_diary_entries();
> }
>
> If mark_diary_entries() were static this wouldn't be possible - you would
> have to require("cal") which is 600 lines.

Supposed it will be not required to invoke this function at the
"Slang>" or "M-x" prompt, I would prefer to do it with a namespace
like that:

in cal.sl:
...
static variable configs= struct{
     max_lines,
     ....
     fp_mark_diary_entries
};
....
fp_mark_diary_entries= &mark_diary_entries;
....
runhooks( "cal_init_hook", configs);

in jed.rc:
define calendar_mode_hook( configs)
{
   configs.max_lines= 10;
   ...
   @configs.fp_mark_diary_entries();
}

Beyond that I would consider to avoid the call-back
in the hook function and replace this by a configs
flag variable, on which the function might be called
behind runhooks.

-- Klaus






--------------------------
To unsubscribe send email to <jed-users-request@xxxxxxxxxxx> with
the word "unsubscribe" in the message body.
Need help? Email <jed-users-owner@xxxxxxxxxxx>.


[2003 date index] [2003 thread index]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]