jed-users mailing list

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

Re: bug: jed loads file twice


Joerg Sommer <joerg@xxxxxxxxxxxx> wrote:
>autoload("email->goto_end_of_headers", "email");

The above says to load goto_end_of_headers into a namespace called
"email" from a file called "email.sl".

>autoload("mail_mode", "email");

That says to load "mail_mode" into the global namespace from a file
called "email.sl".

>define email_mode_hook()
>{
>    message("bla");
>    email->goto_end_of_headers();
>    message("blub");
>}
>
>mail_mode();

You can immediately see what will happen when mail_mode is called:
First it is loaded from email.sl into the global namespace, and then
when called, it calls email_mode_hook.  The hook makes a call to
email->goto_end_of_headers, which jed has been instructed to load into
the email namespace.  This causes email.sl to be loaded twice: once
for the global namespace and once for the email namespace.

>#v-
>
>and this is the file email.sl
>#v+
>static define goto_end_of_headers() {}
>
>public define mail_mode ()
>{
>   runhooks("email_mode_hook");
>}
>#v-

When email.sl is loaded the first time, into the Global namespace,
goto_end_of_headers will get placed into an anonymous namespace
associated with email.sl--- not in a namespace called "email".

[...]
>you can see the file email.sl gets loaded twice. Do you know why?

I hope the above explanation sheds some light on why it gets loaded
twice.

--John

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


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