From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5538 invoked by alias); 18 Sep 2015 18:45:32 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 20589 Received: (qmail 20839 invoked from network); 18 Sep 2015 18:45:30 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.0 X-Authority-Analysis: v=2.1 cv=T/C1EZ6Q c=1 sm=1 tr=0 a=Qosx6O6xXGET3N4RHWVm7w==:117 a=Qosx6O6xXGET3N4RHWVm7w==:17 a=N659UExz7-8A:10 a=OEnFkqQRfgIL0TfTigQA:9 a=pILNOxqGKmIA:10 Message-id: <55FC5BC8.4040107@eastlink.ca> Date: Fri, 18 Sep 2015 11:45:28 -0700 From: Ray Andrews User-Agent: Mozilla/5.0 (X11; Linux i686; rv:31.0) Gecko/20100101 Icedove/31.7.0 MIME-version: 1.0 To: zsh-users@zsh.org Subject: Re: Autoload vs regular function References: <150918101506.ZM26893@torch.brasslantern.com> In-reply-to: <150918101506.ZM26893@torch.brasslantern.com> Content-type: text/plain; charset=windows-1252; format=flowed Content-transfer-encoding: 7bit On 09/18/2015 10:15 AM, Bart Schaefer wrote: > On Sep 18, 8:34am, Sebastian Gniazdowski wrote: > } > } are there any pitfalls about functions declared in this way instead of > } using autoload and separate files? Is this enough to have plugin for > } e.g. antigen? > > There aren't any pitfalls to this, except that the file has to be > sourced (i.e., all the functions fully defined in shell memory) unless > there is a single entry-point function whose name can be the same as > the basename of the file, and thereby trigger loading the whole thing. > > E.g. the _git file that handles completion for all the git subcommands > has a whole slew of helper functions, none of which are loaded until > an attempt to complete for "git" is done, at which time the _git entry > point function loads all of them. Can you rough in an example of that for us Bart? Sounds like an elegant idea. I wonder if it is possible that when one types a command that is not found, it could trigger a sort of search in some directory for a script that would itself source the very command not found and then run it? Sorta a reinvention of autoload but maybe more transparent. >