diff options
author | Axel Beckert <abe@deuxchevaux.org> | 2020-02-16 03:29:05 +0100 |
---|---|---|
committer | Axel Beckert <abe@deuxchevaux.org> | 2020-02-16 03:29:05 +0100 |
commit | 94c033d2e281eb1f49e8366d21fc259ce8c0c4f5 (patch) | |
tree | 701ad2fd3a7867e97689d1349d46ca25a92297b4 /Doc/help/autoload | |
parent | 643de931640e01aa246723d2038328ef33737965 (diff) | |
parent | 77d203f3fbbd76386bf197f9776269a1de580bb5 (diff) | |
download | zsh-94c033d2e281eb1f49e8366d21fc259ce8c0c4f5.tar.gz zsh-94c033d2e281eb1f49e8366d21fc259ce8c0c4f5.zip |
New upstream version 5.8
Diffstat (limited to 'Doc/help/autoload')
-rw-r--r-- | Doc/help/autoload | 83 |
1 files changed, 83 insertions, 0 deletions
diff --git a/Doc/help/autoload b/Doc/help/autoload new file mode 100644 index 000000000..bc3a0294b --- /dev/null +++ b/Doc/help/autoload @@ -0,0 +1,83 @@ +autoload [ {+|-}RTUXdkmrtWz ] [ -w ] [ name ... ] + See the section `Autoloading Functions' in zshmisc(1) for full + details. The fpath parameter will be searched to find the func- + tion definition when the function is first referenced. + + If name consists of an absolute path, the function is defined to + 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 -d is given, searching for the function defaults to + $fpath. If a function is loaded by absolute path, any functions + loaded from it that are marked for autoload without an absolute + path have the load path of the parent function temporarily + prepended to $fpath. + + If the option -r or -R is given, the function is searched for + immediately and the location is recorded internally for use when + the function is executed; a relative path is expanded using the + value of $PWD. This protects against a change to $fpath after + the call to autoload. With -r, if the function is not found, it + is silently left unresolved until execution; with -R, an error + message is printed and command processing aborted immediately + the search fails, i.e. at the autoload command rather than at + function execution.. + + The flag -X may be used only inside a shell function. It causes + the calling function to be marked for autoloading and then imme- + diately loaded and executed, with the current array of posi- + tional parameters as arguments. This replaces the previous def- + inition of the function. If no function definition is found, an + error is printed and the function remains undefined and marked + for autoloading. If an argument is given, it is used as a di- + rectory (i.e. it does not include the name of the function) in + which the function is to be found; this may be combined with the + -d option to allow the function search to default to $fpath if + it is not in the given location. + + The flag +X attempts to load each name as an autoloaded func- + tion, but does not execute it. The exit status is zero (suc- + cess) if the function was not previously defined and a defini- + tion for it was found. This does not replace any existing defi- + nition of the function. The exit status is nonzero (failure) if + the function was already defined or when no definition was + found. In the latter case the function remains undefined and + marked for autoloading. If ksh-style autoloading is enabled, + the function created will contain the contents of the file plus + a call to the function itself appended to it, thus giving normal + ksh autoloading behaviour on the first call to the function. If + the -m flag is also given each name is treated as a pattern and + all functions already marked for autoload that match the pattern + are loaded. + + With the -t flag, turn on execution tracing; with -T, turn on + execution tracing only for the current function, turning it off + on entry to any called functions that do not also have tracing + enabled. + + With the -U flag, alias expansion is suppressed when the func- + tion is loaded. + + With the -w flag, the names are taken as names of files compiled + with the zcompile builtin, and all functions defined in them are + marked for autoloading. + + The flags -z and -k mark the function to be autoloaded using the + zsh or ksh style, as if the option KSH_AUTOLOAD were unset or + were set, respectively. The flags override the setting of the + option at the time the function is loaded. + + Note that the autoload command makes no attempt to ensure the + shell options set during the loading or execution of the file + have any particular value. For this, the emulate command can be + used: + + emulate zsh -c 'autoload -Uz func' + + arranges that when func is loaded the shell is in native zsh em- + ulation, and this emulation is also applied when func is run. + + Some of the functions of autoload are also provided by functions + -u or functions -U, but autoload is a more comprehensive inter- + face. |