From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6683 invoked from network); 13 Sep 2001 16:39:17 -0000 Received: from sunsite.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 13 Sep 2001 16:39:17 -0000 Received: (qmail 24781 invoked by alias); 13 Sep 2001 16:39:10 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 15804 Received: (qmail 24769 invoked from network); 13 Sep 2001 16:39:08 -0000 From: Bart Schaefer Message-Id: <1010913163854.ZM27796@candle.brasslantern.com> Date: Thu, 13 Sep 2001 16:38:53 +0000 In-Reply-To: Comments: In reply to Gaspar Bakos "loading a set of functions" (Sep 13, 11:42am) References: X-Mailer: Z-Mail (5.0.0 30July97) To: gbakos@cfa.harvard.edu, zsh-workers@sunsite.dk Subject: Re: loading a set of functions MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii On Sep 13, 11:42am, Gaspar Bakos wrote: } } /share/zsh/3.1.9/functions } } - Is it possible to load eg. all of them? Yes, you can do for example autoload $^fpath/*(-.:t) where $^fpath means to concatenate what follows to every element of the fpath array, and *(-.:t) means the tail (:t) of the path to every plain file (.) or symlink that points to a plain file (-.). A better scheme might be to use the zcompile command to compile the set of functions you want (possibly all of them) and autoload the compiled file. You can do that with something like setopt extendedglob # needed for *~*/README below autoload -U zrecompile zrecompile -p -U ~/all.zwc $^fpath/*~*/README(N-.) fpath=(~/all.zwc) # need only this one file now autoload -w ~/all.zwc unsetopt extendedglob # if you prefer normal globbing where zrecompile is a wrapper function for zcompile which compiles the all.zwc file only if some of the source files have changed. Check out `man zshcontrib' or look up zrecompile in zsh.info. The *~*README is to leave out the README file that gets installed in one of the fpath directories by some versions of zsh. Note that this may need tweaking if you use more than one version of zsh with the same home directory (e.g., NFS mount on two different machines). In that case you'll have to create a separate .zwc file for each version, e.g., all-$ZSH_VERSION.zwc or some such. Oh, and of course zcompile isn't availble in zsh 3.0.x or early versions of 3.1.x, so if you have one of those you need to use my first example. } - Or else, if I have my own functions in a separate directory, is it } possible to autoload all without specifying their names separately? If you add your separate directory to the fpath array, either of the above will include it as well. Or you can use similar commands just for your own directory of files. } - What is the difference between functions starting with "_" and the } others? It's a naming convention only. The ones starting with underscore are used by the completion system and generally can't be called directly from the command line. } - Are there any further libraries of functions not in the distribution? There are a few functions that are in the distribution but are not installed; these generally are examples drawn from older versions of zsh where a newer/better way to accomplish the same thing now exists. There are some user-contributed functions available on www.zsh.org if you poke around, but nothing that would be described as a "library". -- Bart Schaefer Brass Lantern Enterprises http://www.well.com/user/barts http://www.brasslantern.com Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net