From 9d83e165fc1d32abebb04388f46785b14017f837 Mon Sep 17 00:00:00 2001 From: Mikael Magnusson Date: Fri, 9 Dec 2011 15:54:17 +0000 Subject: unposted: remove duplicated 'the' in compsys.yo. --- Doc/Zsh/compsys.yo | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Doc/Zsh/compsys.yo') diff --git a/Doc/Zsh/compsys.yo b/Doc/Zsh/compsys.yo index e07ac0e9e..54c0d5db8 100644 --- a/Doc/Zsh/compsys.yo +++ b/Doc/Zsh/compsys.yo @@ -4808,7 +4808,7 @@ Note also that tt(_values) normally adds the character used as the separator between values as an auto-removable suffix (similar to a `tt(/)' after a directory). However, this is not possible for a `tt(->)var(string)' action as the matches for the argument are -generated by the calling function. To get the usual behaviour, the +generated by the calling function. To get the usual behaviour, the calling function can add the separator var(x) as a suffix by passing the options `tt(-qS) var(x)' either directly or indirectly to tt(compadd). -- cgit v1.2.3 From 290ab11885d7a3beb1b4158b4d8e6e5ed2b33e11 Mon Sep 17 00:00:00 2001 From: Peter Stephenson Date: Sun, 11 Dec 2011 17:48:26 +0000 Subject: discussed in 29984: use m+7 for files more than a week old --- ChangeLog | 5 ++++- Doc/Zsh/compsys.yo | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) (limited to 'Doc/Zsh/compsys.yo') diff --git a/ChangeLog b/ChangeLog index 46af8feb6..c5355ef50 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2011-12-11 Peter Stephenson + * discussed in 29984: Doc/Zsh/compsys.yo: use m+7 for files + "more than a week old" since w+1 is a bit counterintuitive. + * 29991: Doc/Zsh/expn.yo, Src/glob.c: allow explicit 'd' for days in time qualifiers. @@ -15722,5 +15725,5 @@ ***************************************************** * This is used by the shell to define $ZSH_PATCHLEVEL -* $Revision: 1.5535 $ +* $Revision: 1.5536 $ ***************************************************** diff --git a/Doc/Zsh/compsys.yo b/Doc/Zsh/compsys.yo index 54c0d5db8..01c8625fc 100644 --- a/Doc/Zsh/compsys.yo +++ b/Doc/Zsh/compsys.yo @@ -3970,7 +3970,7 @@ Example: example(_example_caching_policy () { # rebuild if cache is more than a week old local -a oldp - oldp=( "$1"(Nmw+1) ) + oldp=( "$1"(Nm+7) ) (( $#oldp )) }) ) -- cgit v1.2.3 From 3f98949ca8915d2d9c095ccaa65b308ab502b6c6 Mon Sep 17 00:00:00 2001 From: Bart Schaefer Date: Tue, 13 Dec 2011 17:43:01 +0000 Subject: 30012: add $state_descr --- Completion/Base/Core/_main_complete | 3 ++- Completion/Base/Utility/_arguments | 2 ++ Completion/Base/Utility/_values | 1 + Completion/Zsh/Command/_zle | 2 +- Doc/Zsh/compsys.yo | 25 +++++++++++++++---------- 5 files changed, 21 insertions(+), 12 deletions(-) (limited to 'Doc/Zsh/compsys.yo') diff --git a/Completion/Base/Core/_main_complete b/Completion/Base/Core/_main_complete index c50ff9db4..9bc5611de 100644 --- a/Completion/Base/Core/_main_complete +++ b/Completion/Base/Core/_main_complete @@ -23,7 +23,8 @@ eval "$_comp_setup" local func funcs ret=1 tmp _compskip format nm call match min max i num\ _completers _completer _completer_num curtag _comp_force_list \ _matchers _matcher _c_matcher _matcher_num _comp_tags _comp_mesg \ - mesg str context state line opt_args val_args curcontext="$curcontext" \ + mesg str context state state_descr line opt_args val_args \ + curcontext="$curcontext" \ _last_nmatches=-1 _last_menu_style _def_menu_style _menu_style sel \ _tags_level=0 \ _saved_exact="${compstate[exact]}" \ diff --git a/Completion/Base/Utility/_arguments b/Completion/Base/Utility/_arguments index 126d9c315..d70c44259 100644 --- a/Completion/Base/Utility/_arguments +++ b/Completion/Base/Utility/_arguments @@ -344,6 +344,7 @@ if (( $# )) && comparguments -i "$autod" "$singopt[@]" "$@"; then context=() state=() + state_descr=() while true; do while _tags; do @@ -376,6 +377,7 @@ if (( $# )) && comparguments -i "$autod" "$singopt[@]" "$@"; then if (( ! $state[(I)$action] )); then comparguments -W line opt_args state+=( "$action" ) + state_descr+=( "$descr" ) if [[ -n "$usecc" ]]; then curcontext="${oldcontext%:*}:$subc" else diff --git a/Completion/Base/Utility/_values b/Completion/Base/Utility/_values index c2ae26465..ab0e46a9c 100644 --- a/Completion/Base/Utility/_values +++ b/Completion/Base/Utility/_values @@ -87,6 +87,7 @@ if compvalues -i "$@"; then if [[ "$action" = -\>* ]]; then compvalues -v val_args state="${${action[3,-1]##[ ]#}%%[ ]#}" + state_descr="$descr" if [[ -n "$usecc" ]]; then curcontext="${oldcontext%:*}:$subc" else diff --git a/Completion/Zsh/Command/_zle b/Completion/Zsh/Command/_zle index 80f217711..2bfc708e5 100644 --- a/Completion/Zsh/Command/_zle +++ b/Completion/Zsh/Command/_zle @@ -44,7 +44,7 @@ case "$state[1]" in '(-)*:widget arguments: ' && ret=0 ;; (widget*) - _wanted -C "$context[1]" widgets expl widget compadd -k widgets && ret=0 + _wanted -C "$context[1]" widgets expl "${state_descr[1]:-widget}" compadd -k widgets && ret=0 ;& (function) [[ $state[1] != *function ]] || # Handle fall-through diff --git a/Doc/Zsh/compsys.yo b/Doc/Zsh/compsys.yo index 01c8625fc..665c0d454 100644 --- a/Doc/Zsh/compsys.yo +++ b/Doc/Zsh/compsys.yo @@ -3687,10 +3687,12 @@ state of processing; the calling function then makes its own arrangements for generating completions. For example, functions that implement a state machine can use this type of action. -Where tt(_arguments) encounters a `tt(->)var(string)', it will strip -all leading and trailing whitespace from var(string) and set the array -tt(state) to the set of all var(strings)s for which an action is to be -performed. +Where tt(_arguments) encounters var(action) in the `tt(->)var(string)' +format, it will strip all leading and trailing whitespace from var(string) +and set the array tt(state) to the set of all var(string)s for which an +action is to be performed. The elements of the array tt(state_descr) are +assigned the corresponding var(message) field from each var(optarg) +containing such an var(action). By default and in common with all other well behaved completion functions, _arguments returns status zero if it was able to add matches and @@ -3698,7 +3700,8 @@ non-zero otherwise. However, if the tt(-R) option is given, tt(_arguments) will instead return a status of 300 to indicate that tt($state) is to be handled. -In addition to tt($state), tt(_arguments) also sets the global +In addition to tt($state) and tt($state_descr), tt(_arguments) also +sets the global parameters `tt(context)', `tt(line)' and `tt(opt_args)' as described below, and does not reset any changes made to the special parameters such as tt(PREFIX) and tt(words). This gives the calling function the @@ -3708,7 +3711,7 @@ A function calling tt(_arguments) with at least one action containing a `tt(->)var(string)' must therefore declare appropriate local parameters: -example(local context state line +example(local context state state_descr line typeset -A opt_args) to prevent tt(_arguments) from altering the global environment. @@ -4794,15 +4797,17 @@ values (but not those for the arguments) should be printed. The associative array tt(val_args) is used to report values and their arguments; this works similarly to the tt(opt_args) associative array used by tt(_arguments). Hence the function calling tt(_values) should -declare the local parameters tt(state), tt(line), tt(context) and -tt(val_args): +declare the local parameters tt(state), tt(state_descr), tt(line), +tt(context) and tt(val_args): -example(local context state line +example(local context state state_descr line typeset -A val_args) when using an action of the form `tt(->)var(string)'. With this function the tt(context) parameter will be set to the name of the -value whose argument is to be completed. +value whose argument is to be completed. Note that for tt(_values), +the tt(state) and tt(state_descr) are scalars rather than arrays. +Only a single matching state is returned. Note also that tt(_values) normally adds the character used as the separator between values as an auto-removable suffix (similar to a -- cgit v1.2.3