From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22714 invoked from network); 15 Oct 1999 09:18:46 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 15 Oct 1999 09:18:46 -0000 Received: (qmail 26685 invoked by alias); 15 Oct 1999 09:18:10 -0000 Mailing-List: contact zsh-users-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 2686 Received: (qmail 26676 invoked from network); 15 Oct 1999 09:18:09 -0000 From: "Bart Schaefer" Message-Id: <991015091801.ZM22985@candle.brasslantern.com> Date: Fri, 15 Oct 1999 09:18:01 +0000 In-Reply-To: <19991014165452.A31729@thelonious.new.ox.ac.uk> Comments: In reply to Adam Spiers "autoloading questions" (Oct 14, 4:54pm) References: <19991014165452.A31729@thelonious.new.ox.ac.uk> X-Mailer: Z-Mail (5.0.0 30July97) To: zsh users mailing list Subject: Re: autoloading questions MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii On Oct 14, 4:54pm, Adam Spiers wrote: } Subject: autoloading questions } } 1. What's the best way of checking whether an autoload of a function } will succeed? (I mean the actual loading, rather than the } invocation of the `autoload' built-in.) I can't think of anything except function testauto { emulate -L zsh local f f=( $^fpath/$1(N) ) [[ -n $f[1] ]] && $ZSH_NAME -ns < $f[1] } That requires forking an extra shell, though, and it's still nothing more than a syntax check. } 2. How can I manually cause an autoloaded function to be loaded } without actually running it Try this: function loadauto { emulate -L zsh local f f=( $^fpath/$1(N) ) eval "function $1 { $(< $f[1]) }" } (You can replace $(< $f[1]) with $mapfile[$f[1]] if you use that module, but $(<...) is already a non-forking special-case.) Actually, I guess calling loadauto would tell you whether the autoload succeeds, so it sort of answers both questions .... BTW, this question made me notice that it's not a good idea to do autoload fun zmodload parameter noglob vared functions[fun] unless you're very careful about whether you press enter. -- Bart Schaefer Brass Lantern Enterprises http://www.well.com/user/barts http://www.brasslantern.com