zsh-workers
 help / color / mirror / code / Atom feed
From: Sebastian Gniazdowski <sgniazdowski@gmail.com>
To: Bart Schaefer <schaefer@brasslantern.com>
Cc: Zsh hackers list <zsh-workers@zsh.org>
Subject: Re: Surprising effect of fun() { local FPATH=...; autoload -X }, and a bug
Date: Thu, 29 Sep 2016 15:58:51 +0200	[thread overview]
Message-ID: <CAKc7PVCJ4RJjiV7u-9MYrZMKC-G4b5mhFM4o7rcQ7xmkEmRzvA@mail.gmail.com> (raw)
In-Reply-To: <160929001004.ZM27686@torch.brasslantern.com>

On 29 September 2016 at 09:10, Bart Schaefer <schaefer@brasslantern.com> 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


  parent reply	other threads:[~2016-09-29 13:59 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-26 22:07 Sebastian Gniazdowski
2016-09-27  7:05 ` Daniel Shahaf
2016-09-27  7:54   ` Sebastian Gniazdowski
2016-09-29  7:10 ` Bart Schaefer
2016-09-29  9:42   ` Sebastian Gniazdowski
2016-09-29 10:05     ` Sebastian Gniazdowski
2016-09-29 13:58   ` Sebastian Gniazdowski [this message]
2016-09-29 21:50     ` Bart Schaefer
2016-09-30  6:03       ` Sebastian Gniazdowski
2016-09-30 15:31         ` Bart Schaefer
2016-09-30 17:41           ` Sebastian Gniazdowski
2016-09-30 17:53             ` Sebastian Gniazdowski
2016-09-30 20:13             ` Bart Schaefer
2016-09-30  6:49       ` Daniel Shahaf
2016-09-30 18:16         ` Bart Schaefer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAKc7PVCJ4RJjiV7u-9MYrZMKC-G4b5mhFM4o7rcQ7xmkEmRzvA@mail.gmail.com \
    --to=sgniazdowski@gmail.com \
    --cc=schaefer@brasslantern.com \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).