Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: PATH: autoload with explicit path
- X-seq: zsh-workers 40163
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: Zsh hackers list <zsh-workers@xxxxxxx>
- Subject: Re: PATH: autoload with explicit path
- Date: Mon, 12 Dec 2016 08:05:50 -0800
- 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==
- In-reply-to: <20161211221844.5e51affe@ntlworld.com>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <20161211221844.5e51affe@ntlworld.com>
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.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author