From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1361 invoked by alias); 29 Sep 2016 13:59:20 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 39499 Received: (qmail 12005 invoked from network); 29 Sep 2016 13:59:20 -0000 X-Qmail-Scanner-Diagnostics: from mail-qt0-f179.google.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.99.2/21882. spamassassin: 3.4.1. Clear:RC:0(209.85.216.179):SA:0(0.0/5.0):. Processed in 0.426068 secs); 29 Sep 2016 13:59:20 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=FREEMAIL_FROM,SPF_PASS, T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.1 X-Envelope-From: sgniazdowski@gmail.com X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: pass (ns1.primenet.com.au: SPF record at _netblocks.google.com designates 209.85.216.179 as permitted sender) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=X+3DbrwPgW3qdXKvTILAo9vuV9y9tnHTNS3hLXKeFxQ=; b=h5XZTXsweZjTUk7zxpVSiHtq6DHD9PyoVaJVci8WjDbCcq3OIWL2BNBqiWInUXcnzQ rF6+DZCbbCLrEf33fCCFZu/n/xZxF4/qEicqLpkmtUUPOrOzB309jqpV0h+nSSVDxve6 d9Ook2O/xeeMXX3g7/0V5TeRbCpnMILz6XWU4WcY2jwewLDB3iGOASYCNpv+p8HDHBku QqY2UngSEUXq80WEjKAC/sPlbqGRWfBEXTThYDl9Cbp8hI4Nd2V2qcTsRo/mqH8QqC3h bfOZn4EaDKkFItUD0T4jx3qxBJC+0zx4pCQyPbEIcm3UjOPUiHjl/Z8S6fXgpK/cMBox CW6g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=X+3DbrwPgW3qdXKvTILAo9vuV9y9tnHTNS3hLXKeFxQ=; b=hl+Nlz40MSIZAEuIxaCHie6QbJIwmouHAJ/3dEuOIP6RhaLnVfErtMNrLGA1xy388M Q4C5NsWbMqracFMJBbCwLHLFh44fhTAwp593aK0zx4igztQ8fXPTWe18hDOrOUVDD4wK fEVUTf1YZ7Yb48ExpgN/qNRbdaKbrvXMy8nMtpHM6luUdr9j5wJPRe3FJF0B5v2CERoo OQW9yiA6lj7w91kkeff36Nnrg1OnEJt2KbAjKhXTGTEI+VfiXg7QeOX0c89fE8FINmuI gn1QF9TLnH2L0PdWsCBIOriEqm16wjmgdO08oEXherzrvs8TpIQKHqPzobDnQ09jr6MG W4mw== X-Gm-Message-State: AA6/9RmBQ1PiKjTV28ckh+iUYAQNwhRQsOVYWmJwseJBN0xErnnrsJ6clfLMFcpKS/w+ZaWbxpC33rKqT81kAw== X-Received: by 10.237.51.101 with SMTP id u92mr1683579qtd.125.1475157551852; Thu, 29 Sep 2016 06:59:11 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: <160929001004.ZM27686@torch.brasslantern.com> References: <160929001004.ZM27686@torch.brasslantern.com> From: Sebastian Gniazdowski Date: Thu, 29 Sep 2016 15:58:51 +0200 Message-ID: Subject: Re: Surprising effect of fun() { local FPATH=...; autoload -X }, and a bug To: Bart Schaefer Cc: Zsh hackers list Content-Type: text/plain; charset=UTF-8 On 29 September 2016 at 09:10, Bart Schaefer 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