From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15919 invoked by alias); 15 Sep 2015 03:48:10 -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: 20563 Received: (qmail 20985 invoked from network); 15 Sep 2015 03:48:09 -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-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:message-id:date:in-reply-to:comments :references:to:subject:mime-version:content-type; bh=Gkv/VwuErvpsnT0Vwfofo156ZAPLHg6d93HrOy6EUDQ=; b=d8qEw+E/1KIEPW7qTerhfXmyYyTclqdmN3JP8Q5L/GiIQNqSatsBvZF3T3g8b6lBEw 0CaehG0tGKjWOAUJcE7DIi6ALhy+3PjqXdOf2OpiRhx27dhKV9X1aClV18uL4GHMy09m HVk13NueWq64hzTJx1NlpMi3BoNwPYOIG4lZNEJ26deuR9OyJyktxFMVTCw81mdTSGor qM62U3qNQOn4D2fald+dS+AzvVBELsIWPV3xXXhN7an4M78krnPcQ7w/qjuOMM5ZlFUt pETp1k3YRhSfuodGtagbrteiuzF6eeRTJBDmon/20ZJAtk7X59X1wF1zZba2D6vtIRoi w7Sg== X-Gm-Message-State: ALoCoQmgRBgNqtpB71KOESet+8f8lj4L7A/806sADETIZd0YBFFkfOdgKKvZuVaIw0Tq/C2F4tIz X-Received: by 10.182.19.167 with SMTP id g7mr511618obe.13.1442288885996; Mon, 14 Sep 2015 20:48:05 -0700 (PDT) From: Bart Schaefer Message-Id: <150914204803.ZM26255@torch.brasslantern.com> Date: Mon, 14 Sep 2015 20:48:03 -0700 In-Reply-To: <55F786EC.2080007@eastlink.ca> Comments: In reply to Ray Andrews "Re: autoload" (Sep 14, 7:48pm) References: <55F465E6.1040405@eastlink.ca> <2125131442086868@web14o.yandex.ru> <55F4930A.40608@eastlink.ca> <150912151040.ZM12254@torch.brasslantern.com> <55F4AF59.70606@eastlink.ca> <150912164339.ZM26555@torch.brasslantern.com> <55F62DA2.9090908@eastlink.ca> <150913193803.ZM25193@torch.brasslantern.com> <55F6403A.1000401@eastlink.ca> <150914132113.ZM26035@torch.brasslantern.com> <55F786EC.2080007@eastlink.ca> X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: zsh-users@zsh.org Subject: Re: autoload MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii On Sep 14, 7:48pm, Ray Andrews wrote: } } One more thing if you would Bart: get me started with combining zcompile } with autoload as you mentioned. It sounds like a good idea but I can't } find anything on it. I wrote about this in workers/36529 -- but I see that Sebastian had redirected that thread from zsh-users to zsh-workers, so perhaps it wasn't seen. I'll reproduce here (so workers readers can stop now). Take a look at the "zcompile" builtin and the "zrecompile" utility. If you zcompile a collection of functions into a .zwc file, you can -- -- add the .zwc file name directly to $fpath and it will be searched like a directory at autoloaded-function execution time -- specify the -z / -k behavior options at zcompile time so they don't have to be passed to autoload -- easily autoload everything in the file: autoload -w functions.zwc ZWC files are machine-independent but zsh-version-dependent. They get memory-mapped when that's supported so the OS pages them efficiently. The drawbacks are the version dependency if you frequently rebuild a bleeding-edge shell (but see zrecompile) and that zcompile doesn't yet support "sticky emulation" in any meaningful way. Also, a ZWC file is not like an archive file (e.g., a ZIP); you can't append or remove individual functions, the whole file has to be rebuilt. Finally, for Ray, you can for example replace your entire $fpath with a single ZWC file: # Assume starting here with the default $fpath zsh_default_functions=~/.zsh-default-functions.zwc if ! zcompile -t $zsh_default_functions >&/dev/null then # File is missing or out of date. Rebuild it. # Removes the file if any function cannot be compiled. zcompile $zsh_default_functions $^fpath/*(N.:A) fi if [[ -f $zsh_default_functions ]] then fpath=( $zsh_default_functions ) autoload -w $zsh_default_functions fi