Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Feature suggestion for autoload
- X-seq: zsh-workers 25288
- From: Phil Pennock <zsh-workers+phil.pennock@xxxxxxxxxxxx>
- To: Richard Hartmann <richih.mailinglist@xxxxxxxxx>
- Subject: Re: Feature suggestion for autoload
- Date: Wed, 16 Jul 2008 17:55:41 -0700
- Cc: Zsh hackers list <zsh-workers@xxxxxxxxxx>
- Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=d200803; d=spodhuis.org; h=Received:Date:From:To:Cc:Subject:Message-ID:Mail-Followup-To:References:MIME-Version:Content-Type:Content-Disposition:In-Reply-To; b=WbyIU+kN+pR3FogR4Mv4PwBATz2MMmS2Vi2fLogocjLkJZ5TpKjyC3iT9SzgMPeTwqvfBdWmsCFGZ4BQYRn+vSwPZlYV7USpDatrvC1fWv4aakccCrv9HvEjUHCrYTG4gL/PDwX2V3HiRLC5HwSC/XCtNIv8xb6EJRhtEfIE8zw=;
- In-reply-to: <2d460de70807161644u483c2c33l53734590710102d6@xxxxxxxxxxxxxx>
- Mail-followup-to: Richard Hartmann <richih.mailinglist@xxxxxxxxx>, Zsh hackers list <zsh-workers@xxxxxxxxxx>
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
- References: <2d460de70807151010m344b9a7dmeaca569f538b51c8@xxxxxxxxxxxxxx> <080715183948.ZM10577@xxxxxxxxxxxxxxxxxxxxxx> <2d460de70807161644u483c2c33l53734590710102d6@xxxxxxxxxxxxxx>
On 2008-07-17 at 01:44 +0200, Richard Hartmann wrote:
> What I meant was 'autoload every file you find in fpath'. That suggestion
> is moot now, though.
While it may be moot, this might be helpful anyway.
You might want to look at the demonstration start-up files supplied with
zsh. StartupFiles/ sub-directory of the source, no idea what any given
distribution does with them.
The provided example to do just this is:
----------------------------8< cut here >8------------------------------
# Autoload all shell functions from all directories in $fpath (following
# symlinks) that have the executable bit on (the executable bit is not
# necessary, but gives you an easy way to stop the autoloading of a
# particular shell function). $fpath should not be empty for this to work.
for func in $^fpath/*(N-.x:t); autoload $func
----------------------------8< cut here >8------------------------------
My preferred OS (FreeBSD) happens to not preserve executability on the
zsh-supplied files for the Port, so I end up with:
autoload ${^fpath}/*(N-.:t)
typeset -U fpath
fpath=(~/bin/zsh-funcs $fpath)
set -A _foo ~/bin/zsh-funcs/*(N-.x:t)
[[ ${#_foo} -gt 0 ]] && autoload $_foo
unset _foo
Just two examples.
-Phil
Messages sorted by:
Reverse Date,
Date,
Thread,
Author