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

Re: Is this statement correct?



On Sep 19,  9:50am, Andrej Borsenkow wrote:
} Subject: RE: Is this statement correct?
}
} > > This is not usually
} > > a problem, because zsh always looks for the newest file when loading a
} > > function, but it may cause slower shell startup and function loading.
} 
} It does not work:
} 
} bor@itsrm2% print $fpath
} /home/bor/.zsh.d/completion /home/bor/.zsh.d/std-3.1.9-dev-6.zwc
} /home/bor/.zsh.d/functions /tools/share/zsh/site-functions ... (standard
} part follows)
} bor@itsrm2% ll /tools/share/zsh/3.1.9-dev-6/functions/Core/_match
} -rw-r--r--   1 root     other       1539 Sep 19 09:44
} /tools/share/zsh/3.1.9-dev-6/functions/Core/_match
} bor@itsrm2% ll ~/.zsh.d/std-3.1.9-dev-6.zwc
} -rw-------   1 bor      sinix    1491984 Sep 18 11:08
} /home/bor/.zsh.d/std-3.1.9-dev-6.zwc
} 
} Zsh takes _match from digest file and *not* from external definition.
} Even if it is newer.

The order of $fpath takes precedence over the newness of the files.  It
doesn't search for the newest thing anywhere in $fpath; it checks for
the newest one of any two otherwise-equivalent sources of the function.

In particular, zsh does not read the name of the source file out of the
digest file and try to find it.  The autoload-time checks are all done
relative to *directories* named in $fpath.  If you put a digest name
into $fpath (as you have), then that file is accepted automatically.

If on the other hand you leave directory names in the path and put the
digest file alongside the directory (within that directory's parent),
then zsh will check for the newer of a function in the directory or a
function in the digest file.

So if you have fpath=(/zsh/fdir) and these three files:
    /zsh/fdir.zwc     /zsh/fdir/func     /zsh/fdir/func.zwc
Then zsh will always pick the newest one for the definition of "func".

I suppose the example in contrib.yo is a bit misleading because it
replaces the directory names with digest file names in $fpath.  That's
actually not necessary for zrecompile to work.

-- 
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   



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