From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23791 invoked by alias); 12 Dec 2016 16:05:44 -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: 40163 Received: (qmail 2941 invoked from network); 12 Dec 2016 16:05:44 -0000 X-Qmail-Scanner-Diagnostics: from mail-ua0-f170.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.217.170):SA:0(-0.0/5.0):. Processed in 1.777993 secs); 12 Dec 2016 16:05:44 -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=RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_PASS,T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.1 X-Envelope-From: schaefer@brasslantern.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.217.170 as permitted sender) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern-com.20150623.gappssmtp.com; s=20150623; h=from:message-id:date:in-reply-to:comments:references:to:subject :mime-version; bh=iPwXdDfTqq1jvHd+WOrZdk5o6B8yY5w47dUVAyIbHEE=; b=X0l/0Mzi307KIhYJXzCcIowxfvl/g0F9+rTzEusphVKd7xionIPAIpl3ee1lkudTEG jBdki6uJeDzu2VTBsIF7MKDF6ws1wzh25bxFXdaEURiqVK9RTajXnjL7O9/kmOJNI4TG HzM/nX0TsYNUvFuYskgJbeMoBMc5D/P60Wh4Z7UT5LK4uZK/I3jrWCGt4nHkwzjEmvqX sqXRonVemRxpv1CEvuQ7LUutS2zwcfZj1QrYUmR0fFZ8XGUJdkos3ytEmHfcKDIANrBj UWpoy7HuUL1z8M6y1aPHTlfjwQXTUnA3W4+vYfDKL4t4WRYwGCr+uHBQIO66nbUolQzh q9Yg== 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; bh=iPwXdDfTqq1jvHd+WOrZdk5o6B8yY5w47dUVAyIbHEE=; b=AAsMe/zt8ZOaK6BwelLruH7t6hiWIQblqQQLjUQIFWKFBt+/5twtwz71b/5ejozBQl g29X1Lkz8KHyvaoYxVpTUTZHGa5ihgGHZO38agR8D3W7gRBsYrJrJ/6QYl8Z0fzGZ1SO VIAK+FEKe1d5oEEEx8DPnhFznusWDq/5kCy2MR6+zhQBlKZbpqYnV4sV+r3UDbrBC+m2 DMYCkI/OSJCxUYw2IAiY1EGv9p7XQAMvDRfYALRrYFa50R/4srjXZVdp/+y0EqDSfEXX BrABBgXquLfLwNJ1wlpzdWAm8tbkJmOmwQoUTMXvx+rQoWwWtQJa9TyoKBJ2h+KHCFoR nDtw== X-Gm-Message-State: AKaTC00e9cfrDGgdMOAm0ML2SS18OF6RUxT0trW/ys6mfVpp6pPMuaFT2B6zlRnIVAL0Sg== X-Received: by 10.159.38.228 with SMTP id 91mr73213971uay.102.1481558729999; Mon, 12 Dec 2016 08:05:29 -0800 (PST) From: Bart Schaefer Message-Id: <161212080550.ZM935@torch.brasslantern.com> Date: Mon, 12 Dec 2016 08:05:50 -0800 In-Reply-To: <20161211221844.5e51affe@ntlworld.com> Comments: In reply to Peter Stephenson "PATH: autoload with explicit path" (Dec 11, 10:18pm) References: <20161211221844.5e51affe@ntlworld.com> X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: Zsh hackers list Subject: Re: PATH: autoload with explicit path MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii On Dec 11, 10:18pm, Peter Stephenson wrote: } } I wanted to autoload a function from an explicit path. } [...] it strikes me it's a bit mean of the shell not simply to do } something sensible with } } autoload +X /path/to/myfunc For +X only, this can be accomplished by FPATH=/path/to autoload +X myfunc Sebastian's plugin manager uses this. } That doesn't do anything sensible at the moment --- relative paths to } functions do, with the full relative path as the name, which is entirely } consistent, but absolute paths don't and in fact it tries the name as a } relative path anyway which seems Just Plain Wrong. If I understand what you're saying, that means autoload this/here/file creates a function named "this/here/file" by loading "file" from $^fpath/this/here ... yes? And then (before this patch) autoload /this/here/file creates a function named "/this/here/file" from the same location? So after this patch there is no way to autoload a function whose name begins with a slash. Not that it was especially useful to be able to do so, just confirming. } 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. } } This seemed quite a useful feature. Yes, this is specifically what Sebastian and (I think) Ray were asking for several months ago. If I may make a suggestion -- an equally useful variation would be for autoload to search the $fpath at the time of the autoload command and store the path where the file is found *iff* it is found. This would be sort of like doing autoload -Uz $^fpath/myfunc(N) except that it handles the situation where $fpath does not yet contain the "myfunc" file. Another useful variation might be to fall back to the current fpath if the function isn't found at the specified location.