Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: zsh libs



Marc Chantreux wrote:
> hello,
> 
> Few days ago, Nikolai Weibull told us about autoload to deal with
> namespaces. I'm trying to use this tips for my own libs.
> 
> I load my new lib with autoload -U but when i execute the function for
> the first time, it wasn't executed.
> 
> does anyone knows why ?
> 
> 
> > fpath+=$PWD
> > cat ldap/new
> #autoload ldap/read ldap/write ldap/new
> 
> ldap/new  ()  { print "new ..."  }
> ldap/read  () { print "reading ..."  }
> ldap/write () { print "writting ..." }

In zsh's standard form of autoload the file contains just the function
body, so that all that happens when it's first executed is that the
functions contained inside are defined.  This is different from other
shells.

However, it's simple to convert the file you've got:  just add

  ldap/new "$@"

to the end of the file.

-- 
Peter Stephenson <pws@xxxxxxx>                  Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK                          Tel: +44 (0)1223 692070


To access the latest news from CSR copy this link into a web browser:  http://www.csr.com/email_sig.php



Messages sorted by: Reverse Date, Date, Thread, Author