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

Re: autoload

On Sep 13,  7:14pm, Ray Andrews wrote:
} Tightening up my understanding of this a bit ...
} >      autoload $^fpath/*(N-.:t)
} ... works fine, but what does the caret do?

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.

} Also I think I recognize the '(N-.:t)' as a globbing modifier, and I 
} know the '.' and
} the ':t' but I can't find any info on the 'N-'

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

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

Well, yes, but that only autoloads Sebastian's navigation functions
(and any others whose names happen to start with "n-").

} Interesting that autoload must have the
} path stripped off for it.  Why wouldn't it know to do that automatically?

You don't autoload from a location, you autoload a name and the fpath
is searched for it.  It would be misleading for autoload to discard
a directory which is passed to it in favor of one that appears earlier
in the fpath array, so you have to explicitly do so if that's what you

(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

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