zsh-workers
 help / color / mirror / code / Atom feed
* loading a set of functions
@ 2001-09-13 15:42 Gaspar Bakos
  2001-09-13 16:38 ` Bart Schaefer
  2001-09-13 17:56 ` Borsenkow Andrej
  0 siblings, 2 replies; 3+ messages in thread
From: Gaspar Bakos @ 2001-09-13 15:42 UTC (permalink / raw)
  To: zsh-workers

Hi,

I am also a newcomer to zsh. I see plenty of functions in the
<installation path>/share/zsh/3.1.9/functions

- Is it possible to load eg. all of them?

- Or else, if I have my own functions in a separate directory, is it
possible to autoload all without specifying their names separately?

- What is the difference between functions starting with "_" and the
others?

- Are there any further libraries of functions not in the distribution?

Cheers,
Gaspar

+ ------------------------------------------------------------------------ +
Gaspar A. Bakos
Predoctoral Fellow, Solar and Stellar Physics Division
Harvard-Smithsonian Center for Astrophysics
Cambridge, 60 Garden Street, MA 02138 (USA)
Phone(office): 617-495-7410 Fax: 617-495-7049
email: bakos@cfa.harvard.edu or bakos@konkoly.hu
homepage: http://cfa-www.harvard.edu/~bakos
+ ------------------------------------------------------------------------ +



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: loading a set of functions
  2001-09-13 15:42 loading a set of functions Gaspar Bakos
@ 2001-09-13 16:38 ` Bart Schaefer
  2001-09-13 17:56 ` Borsenkow Andrej
  1 sibling, 0 replies; 3+ messages in thread
From: Bart Schaefer @ 2001-09-13 16:38 UTC (permalink / raw)
  To: gbakos, zsh-workers

On Sep 13, 11:42am, Gaspar Bakos wrote:
}
} <installation path>/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   


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: loading a set of functions
  2001-09-13 15:42 loading a set of functions Gaspar Bakos
  2001-09-13 16:38 ` Bart Schaefer
@ 2001-09-13 17:56 ` Borsenkow Andrej
  1 sibling, 0 replies; 3+ messages in thread
From: Borsenkow Andrej @ 2001-09-13 17:56 UTC (permalink / raw)
  To: gbakos; +Cc: zsh-workers

Gaspar Bakos wrote:
> Hi,
> 
> I am also a newcomer to zsh. I see plenty of functions in the
> <installation path>/share/zsh/3.1.9/functions
> 


You definitely need an update. 3.1.9 is quite old.


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2001-09-13 17:56 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-09-13 15:42 loading a set of functions Gaspar Bakos
2001-09-13 16:38 ` Bart Schaefer
2001-09-13 17:56 ` Borsenkow Andrej

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).