Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: [PATCH] Autoload and absolute paths.. Maybe after all

On Mon, 13 Feb 2017 03:56:28 -0800
Sebastian Gniazdowski <psprint2@xxxxxxxxxxxx> wrote:
> Hello,
> following doesn't work:
> # mkdir ~/myfunctions
> # mv /usr/local/share/zsh/5.3.1-dev-0/functions/calendar* ~/myfunctions
> # autoload ~/myfunctions/calendar
> # calendar
> calendar:36: calendar_scandate: function definition file not found
> called this a very big problem. Directory ~/myfunctions doesn't make
> sense. Below is a patch that addresses this. Maybe the code looks good?

It's a fairly localised change, and all the existing tests still pass,
so I don't see a problem with it.  There might be funny edge cases but
I don't propose to worry until they turn up.


diff --git a/Doc/Zsh/builtins.yo b/Doc/Zsh/builtins.yo
index 0a9021c..bdd1ad1 100644
--- a/Doc/Zsh/builtins.yo
+++ b/Doc/Zsh/builtins.yo
@@ -159,7 +159,10 @@ load from the file given (searching as usual for dump files in the given
 location).  The name of the function is the basename (non-directory
 part) of the file.  It is normally an error if the function is not found
 in the given location; however, if the option tt(-d) is given, searching
-for the function defaults to tt($fpath).
+for the function defaults to tt($fpath).  If a function is loaded by
+absolute path, any functions loaded from it that are marked for
+tt(autoload) without an absolute path have the load path of the parent
+function temporarily prepended to tt($fpath).
 If the option tt(-r) or tt(-R) is given, the function is searched for
 immediately and the location is recorded internally for use when the

Messages sorted by: Reverse Date, Date, Thread, Author