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

Re: autoload



On 09/19/2015 02:22 PM, Bart Schaefer wrote:
As I've pointed out, these are exactly the same as

     zcompile /Functions/Functions.zwc /Functions/*
     FPATH=/Functions/Functions.zwc autoload +X -w /Functions/Functions.zwc

Although the better practice would be to do

     zcompile /Functions.zwc /Functions/*
     FPATH=/Functions.zwc autoload +X -w /Functions.zwc

By gum it works if you get it exactly right:

-"zcompile ... (N-.:t)" ... or it barfs if there's a directory on the same path. Fussy fussy. -"autoload +X -w ..." works with Sebastian's, but not with mine (which are all functions).
-"autoload -w ..." works with mine but not Sebastian's.
-"source miscfunctions" *before* calling an autoloaded function to have it work the first time.
-Append new dirs to FPATH or other things break.

if not because of the way fpath is searched, then for the same reason that
you shouldn't do

     tar -c /Functions/Functions.tar /Functions/*
... and most importantly, follow this advice, or if you rerun zcompile where there's already a .zwc, it rather dumbly tries to eat it's own tail and build itself into itself and nothing works.

I guess the zcompile of my dreams would be able to process both scripts and functions in one go, and be able to see the functions in 'miscfunctions' regardless of the filename, and not try to digest existing .zwc's, and not worry about directories. And the autoload of my dreams would be able to pass all of it back every time. Best to leave it to zsh internals it's too
fragile for anything else.  Apologies to the list for all this.





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