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

Re: Surprising effect of fun() { local FPATH=...; autoload -X }, and a bug



On 29 September 2016 at 09:10, Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
> On Sep 27, 12:07am, Sebastian Gniazdowski wrote:
> }
> }             eval "function $func {
> }                 local FPATH="$PLUGIN_DIR":"${FPATH}"
> }                 builtin autoload -X ${opts[*]}
> }             }"
> }
> } What I astonishingly realized today is that functions autoloaded this
> } way can further use autoload builtin purely normally. FPATH visible
> } from the specially-autoloaded function is modified, has the required
> } added component, and builtin autoload works as expected (even with
> } <5.1 Zsh, it has a more specific manual autoload stub).
>
> This will be the case as long as the autoload command AND the first
> run of the normally-autoloaded function BOTH happen during the FIRST
> run of the "specially-loaded" function.

Now I can easily parse what you wrote (the call stacks were heavy)
after I've added fprintf() to builtin.c / typeset_single. Indeed, it
is called before first run of special-autoloaded functions. On second
run there's no "local FPATH" being run, and further-autoloaded
functions are not found. I simplified my test case and just run uizcm
twice. During second run new autoload functions aren't resolved. Turns
out a normal fpath-extending loading support is needed for Zplugin,
unless a creative solution is found

Best regards,
Sebastian Gniazdowski



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