jed-users mailing list

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

make_ini and autoload [was: Re: rst mode with tokenlist navigator]


G. Milde wrote:
On 10.05.06, Marko Mahnic wrote:
define autoload_file() % macro, macro ..., file
{
   variable file = ();
   loop(_NARGS - 1) autoload ( (), file);
}

This would make life easier. However, including in site.sl is Johns
decision. I could consider sl_utils.sl (which actually is a collection of
functions I would like to see in site.sl).

Just for clearity I would propose the name autoload_from_file() or even autoloads_from_file() or simpler autoloads()

This function would also make ini.sl a bit simpler. However, I do not like
to make ini.sl depend on a non-standard function, this is why I use
_autoload() there.

Günter


sl_utils seems a good place. autoloads() seems a better choice for the name
since autoload_from_file might imply that it is possible to autoload from
something other than a file.

Since the function is very short, you could define it as private
in every ini.sl. Or you could do this:

  % csvutils.sl
  "buffer_compress";
  "spaces2tab";
  "format_table";
  "goto_max_column";
  "format_table_rect";
  loop(5) autoload( (), "M:\\jed\\libjmr\\csvutils.sl");

I think this version pops a value from stack, then pushes
two values to the stack, so it is slower than _autoload(5).
To speed things up you can rewrite it as

  loop(5) { "M:\\jed\\libjmr\\csvutils.sl"; autoload(); }

This should work better since it pushes the same number of
values as _autoload(5). It is still slower because of many
calls to autoload().

So the improved utility function for sl_utils.sl or site.sl is

   public define autoloads() % macro, macro ..., file
   {
      variable file = ();
      loop(_NARGS - 1) { file; autoload(); }
   }

(Maybe in a future version of SLang autoload will work like autoloads ...)

Marko


--------------------------
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]