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

Re: PATCH: autoload with explicit path

Peter Stephenson wrote on Tue, Jan 17, 2017 at 18:36:06 +0000:
> autoload /path/to/foo
> autoload foo
> leaves foo marked as to be loaded from /path/to/foo.  I should probably
> document this (and that therefore to unmark the path you need to
> unfunction).  I think this is the right way of doing it as the explicit
> path should continue to override the more vague autoload with no path
> indicated, and this is safer in case some code decides it needs a
> function and inadvertently resets the path the user carefully decided to
> give the function.

Suppose $^fpath/foo/bar(N) has two matches, how do I explicitly autoload
the second one?  I.e., how do I disambiguate «autoload foo/bar» (with no
leading slash) to load a particular copy of foo/bar?

Just removing the $FPATH element containing the former foo/bar would
prevent foo/bar from autoloading functions that are only available in
that $FPATH element.  (Which might be the system default $fpath dir)

I wonder if we need «autoload -d /qux foo/bar», or perhaps cause
«autoload /qux/./foo/bar» load a function named "foo/bar" (the idea of
assigning a meaning to /./ elements is borrowed from rsyncd.conf).

(I'm assuming «autoload foo/bar» is a first-class use-case.)

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