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

Re: Re-loading files loaded via "autoload"



On Wed, Aug 11, 2021 at 11:25 AM Mikael Magnusson <mikachu@xxxxxxxxx> wrote:
>
> On 8/11/21, Zach Riggle <zachriggle@xxxxxxxxx> wrote:
> >
> > Thanks in advance for my spam.  I recently spent some time spelunking
> > in the Zsh docs for how to get an "autoload"ed module (sorry if the
> > terminology is incorrect) to be re-loaded.

A "module" usually refers to a binary object managed by "zmodload".
There really isn't a consistent shorthand terminology for an
"autoload" function that happens to define multiple helpers in its
source file.

> It is implied in some places that you can do this, but perhaps it is
> worth mentioning explicitly somewhere?

Given that we have an entire section dedicated to "Autoloading
functions" it would seem reasonable to mention it there.

> eg, we have this, which mentions it in a comment of the example code:
>        It is also possible to create a function that is not  marked
> as  autoloaded,
>        but which loads its own definition by searching fpath, by using
> `autoload -X'
>        within a shell function.  For example, the following are equivalent:

Those are no longer entirely equivalent, for one thing as you noted
about loading from absolute paths.  There's no way to attach this
metadata to the function definition when wrapping up an "autoload -X"
command yourself.  Some update of that example is probably worthwhile.
(This shortcoming does not apply to "autoload +X" as far as I know.)




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