From dbec4fa6ccccb717608498b83989b21967948bde Mon Sep 17 00:00:00 2001 From: Peter Stephenson Date: Fri, 21 Sep 2012 19:08:35 +0000 Subject: 30692: allow autoload +X -m to work change to _path_files to make it load in that fashion --- ChangeLog | 8 +++++++- Completion/Unix/Type/_path_files | 2 +- Doc/Zsh/builtins.yo | 5 ++++- Src/builtin.c | 4 ++-- 4 files changed, 14 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 67695c12c..231f3b143 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2012-09-21 Peter Stephenson + + * 30692: Completion/Unix/Type/_path_files, Doc/Zsh/builtins.yo, + Src/builtin.c: allow autoload +X -m to work; change _path_files + so it works on that. + 2012-09-21 Peter Stephenson * 30687 (typo fixed): Doc/Zsh/params.yo, Src/jobs.c: don't @@ -169,5 +175,5 @@ ***************************************************** * This is used by the shell to define $ZSH_PATCHLEVEL -* $Revision: 1.5722 $ +* $Revision: 1.5723 $ ***************************************************** diff --git a/Completion/Unix/Type/_path_files b/Completion/Unix/Type/_path_files index a170983ba..aa58ea09b 100644 --- a/Completion/Unix/Type/_path_files +++ b/Completion/Unix/Type/_path_files @@ -198,7 +198,7 @@ zstyle -T ":completion:${curcontext}:paths" path-completion && path_completion=1 if [[ -n "$compstate[pattern_match]" ]]; then - if { [[ -z "$SUFFIX" ]] && _have_glob_qual "$PREFIX" complete } || + if { [[ -z "$SUFFIX" ]] && _have_glob_qual "$PREFIX" complete; } || _have_glob_qual "$SUFFIX" complete; then # Copy all glob qualifiers from the line to # the patterns used when generating matches diff --git a/Doc/Zsh/builtins.yo b/Doc/Zsh/builtins.yo index 0e5353633..75745028f 100644 --- a/Doc/Zsh/builtins.yo +++ b/Doc/Zsh/builtins.yo @@ -108,7 +108,7 @@ ifnzman(noderef(Aliasing)). findex(autoload) cindex(functions, autoloading) cindex(autoloading functions) -item(tt(autoload) [ {tt(PLUS())|tt(-)}tt(UXktz) ] [ tt(-w) ] [ var(name) ... ])( +item(tt(autoload) [ {tt(PLUS())|tt(-)}tt(UXkmtz) ] [ tt(-w) ] [ var(name) ... ])( Equivalent to tt(functions -u), with the exception of tt(-X)/tt(+X) and tt(-w). @@ -129,6 +129,9 @@ 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 tt(-m) flag is also given each var(name) is treated as a +pattern and all functions already marked for autoload that match the +pattern are loaded. With the tt(-w) flag, the var(name)s are taken as names of files compiled with the tt(zcompile) builtin, and all functions defined in them are diff --git a/Src/builtin.c b/Src/builtin.c index d8493bb8a..51ddce18c 100644 --- a/Src/builtin.c +++ b/Src/builtin.c @@ -46,7 +46,7 @@ static struct builtin builtins[] = BUILTIN(".", BINF_PSPECIAL, bin_dot, 1, -1, 0, NULL, NULL), BUILTIN(":", BINF_PSPECIAL, bin_true, 0, -1, 0, NULL, NULL), BUILTIN("alias", BINF_MAGICEQUALS | BINF_PLUSOPTS, bin_alias, 0, -1, 0, "Lgmrs", NULL), - BUILTIN("autoload", BINF_PLUSOPTS, bin_functions, 0, -1, 0, "ktTUwXz", "u"), + BUILTIN("autoload", BINF_PLUSOPTS, bin_functions, 0, -1, 0, "mktTUwXz", "u"), BUILTIN("bg", 0, bin_fg, 0, -1, BIN_BG, NULL, NULL), BUILTIN("break", BINF_PSPECIAL, bin_break, 0, 1, BIN_BREAK, NULL, NULL), BUILTIN("bye", 0, bin_break, 0, 1, BIN_EXIT, NULL, NULL), @@ -2882,7 +2882,7 @@ bin_functions(char *name, char **argv, Options ops, int func) if ((pprog = patcompile(*argv, PAT_STATIC, 0))) { /* with no options, just print all functions matching the glob pattern */ queue_signals(); - if (!(on|off)) { + if (!(on|off) && !OPT_ISSET(ops,'X')) { scanmatchtable(shfunctab, pprog, 1, 0, DISABLED, shfunctab->printnode, pflags); } else { -- cgit 1.4.1