From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7453 invoked by alias); 27 Jan 2017 15:13:05 -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: 40427 Received: (qmail 21552 invoked from network); 27 Jan 2017 15:13:05 -0000 X-Qmail-Scanner-Diagnostics: from new2-smtp.messagingengine.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(66.111.4.224):SA:0(-0.4/5.0):. Processed in 2.141797 secs); 27 Jan 2017 15:13:05 -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.4 required=5.0 tests=FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS,T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.1 X-Envelope-From: psprint2@fastmail.com X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: pass (ns1.primenet.com.au: SPF record at spf.messagingengine.com designates 66.111.4.224 as permitted sender) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=fastmail.com; h= content-transfer-encoding:content-type:date:from:message-id :mime-version:subject:to:x-me-sender:x-me-sender:x-sasl-enc; s= mesmtp; bh=aFbP8P4VETQCGaquVqnYU39A7l0=; b=YzhkCht5N9fiVdmYEPJGT 70QkqH4TpCVVIiUkvmNJ3tejM0HYi5te5ann+xVq40VwyWWkCvZEfjRsXmtZcD2k l93ajlw1b5HsGmPAsl2fvN8XI9L03nUlAHtWeHsfe93QAqwkE+KYcJtutu0puO1+ 7wo1vcop/qgySpnB7FI1Ws= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:message-id:mime-version:subject:to:x-me-sender :x-me-sender:x-sasl-enc; s=smtpout; bh=aFbP8P4VETQCGaquVqnYU39A7 l0=; b=j5ZrEcwCAZ80Yej0zlnCC/HRIva0ILpxY3uBbRjVmPdnjGUjsoP0rq5mT Bxq5OMFdVQu/eP8h1ISNqeBfOs9rvQ5njrdu5K9G8OsCiPu/uUg+6LLNMlfxh6Cj nSg77PLvtS4NMjNSZu3auHqry1dfIzFX//QmS31/l0bLAtq6ZQ= X-ME-Sender: Message-Id: <1485529979.987251.861563792.06CCDCAC@webmail.messagingengine.com> From: Sebastian Gniazdowski To: zsh-workers@zsh.org MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" X-Mailer: MessagingEngine.com Webmail Interface - ajax-37809a74 Date: Fri, 27 Jan 2017 07:12:59 -0800 Subject: RE: PATH: autoload with explicit path On 11 December 2016 at 23:18, Peter Stephenson wrote: > Then I found it was pretty much as easy (easier, actually, since fewer > special cases) to implement this generally: > > autoload -Uz /path/to/myfunc > > defines myfunc to be found in the directory /path/to by reusing the > filename element of the shfunc structure that's currently unused at this > stage. I do the non-fpath autoloading by local FPATH parameter. There's drawback: if autoloaded function does further autoloading of other function, then the earlier supplied local FPATH parameter isn't active anymore. So it's not possible to have /home/user/functions/{fun1,fun2}, autoload fun1, and have fun2 available for fun1. Now, with the new feature, directory path can be attached to function and if it calls autoload itself, then the attached directory can be examined before FPATH. Could this be added? There are variations possible in this, whether it should be attached-path that overloads FPATH, or FPATH to overload attached-path. I think that a straightforward way would be to promote attached-path (examine it first), to allow basic /home/user/functions/{fun1,fun2} organization of functions, which doesn't need much head scratching, it's selecting functions "in-package", easy to understand. Having FPATH examined first would allow loading of patched fun2 from regular fpath dir, but this is inconsistent =E2=80=93=C2=A0if one would want to have patc= hed fun1 in FPATH, then he would need to drop the path argument from autoload, and copy fun2. --=20 Sebastian Gniazdowski psprint2@fastmail.com