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

Re: autoload

On 09/13/2015 07:38 PM, Bart Schaefer wrote:
Would it make more sense written like ${^fpath} ?  It's the operator
that causes an array (a b c) to expand to e.g. a/* b/* c/* instead of
to a b c/* -- cf. the rc_expand_param setopt.
Yikes, that's brand new to me, I only know the caret as negation. So this is a feature specific--it seems--to getting useful path expansion. Just echoing some dirs, I get the
point loud and clear. That's powerful.
(N) means nonomatch, so empty directories disappear from the result
instead of causing a globbing error.  (-) is follow symlinks, so that
combined with (N) any dangling symlinks also disappear.  These both are
documented in the "Glob Qualifiers" subsection of the manual.

Nuts, I scanned that page top to bottom looking at random, and there it is near the
very bottom. 'NULL_GLOB' it says.  Thanks for the explanation.
Well, yes, but that only autoloads Sebastian's navigation functions
(and any others whose names happen to start with "n-").

Of course, I'm just experimenting for now.  Getting the feel ...
You don't autoload from a location, you autoload a name and the fpath
is searched for it.
Ah! ... I'm subconsciously thinking in terms of finding commands. No!

   autoload /usr/local/share/zsh/site-functions/n-*(N-.:t)

... is a kind of trick--we are grabbing the names of files and using them as the names of functions to be found later, but we are NOT actually passing definitions. Yes?

autoload n-list n-cd n-env n-kill n-panelize n-options n-aliases n-functions n-history n-preview

... is actually more 'honest' since all autoload really knows at that point is names. Definitions
will be retrieved later. Yes?

(zcompile on the other hand DOES load from locations rather than from
a path search, so if you use zcompile + autoload -w you get the path

Sounds like a good idea, would that not be preferable? Why not prime the pump with both the name and the location? I'm over my head of course, but it seems that the '(...(N-.:t)' style command could notify autoload of both name and location in one go thus obviating the need to rummage through $fpath. As always, if that's not done there will be a good reason.

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