diff options
Diffstat (limited to 'Completion')
-rw-r--r-- | Completion/Base/Completer/_expand_alias | 2 | ||||
-rw-r--r-- | Completion/Base/Core/_main_complete | 7 | ||||
-rw-r--r-- | Completion/Base/Widget/_bash_completions | 2 | ||||
-rw-r--r-- | Completion/Base/Widget/_complete_debug | 4 | ||||
-rw-r--r-- | Completion/Base/Widget/_complete_help | 4 | ||||
-rw-r--r-- | Completion/Base/Widget/_correct_word | 2 | ||||
-rw-r--r-- | Completion/Base/Widget/_expand_word | 2 | ||||
-rw-r--r-- | Completion/Base/Widget/_history_complete_word | 2 | ||||
-rw-r--r-- | Completion/Base/Widget/_next_tags | 2 | ||||
-rw-r--r-- | Completion/compinit | 11 |
10 files changed, 20 insertions, 18 deletions
diff --git a/Completion/Base/Completer/_expand_alias b/Completion/Base/Completer/_expand_alias index 3809a834f..e711338a8 100644 --- a/Completion/Base/Completer/_expand_alias +++ b/Completion/Base/Completer/_expand_alias @@ -2,7 +2,7 @@ local word expl tmp pre sel what -setopt localoptions ${_comp_options[@]} +eval "$_comp_setup" if [[ -n $funcstack[2] ]]; then if [[ "$funcstack[2]" = _prefix ]]; then diff --git a/Completion/Base/Core/_main_complete b/Completion/Base/Core/_main_complete index f38354815..eecb30b34 100644 --- a/Completion/Base/Core/_main_complete +++ b/Completion/Base/Core/_main_complete @@ -16,12 +16,7 @@ # which makes the output of setopt and unsetopt reflect a different # state than the global one for which you are completing. -setopt localoptions ${_comp_options[@]} - -exec </dev/null # ZLE closes stdin, which can cause errors - -# Failed returns from this code are not real errors -setopt localtraps noerrexit ; trap - ZERR +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 \ diff --git a/Completion/Base/Widget/_bash_completions b/Completion/Base/Widget/_bash_completions index 6980e8bfd..7abb654d4 100644 --- a/Completion/Base/Widget/_bash_completions +++ b/Completion/Base/Widget/_bash_completions @@ -25,7 +25,7 @@ # that will not have been overridden, so you should add '~' to the # list of keys at the top of the for-loop. -setopt localoptions ${_comp_options[@]} +eval "$_comp_setup" local key=$KEYS[-1] expl diff --git a/Completion/Base/Widget/_complete_debug b/Completion/Base/Widget/_complete_debug index acdb48fd8..6f670c8a9 100644 --- a/Completion/Base/Widget/_complete_debug +++ b/Completion/Base/Widget/_complete_debug @@ -1,8 +1,6 @@ #compdef -k complete-word \C-x? -setopt localoptions ${_comp_options[@]} - -setopt localtraps noerrexit ; trap - ZERR +eval "$_comp_setup" (( $+_debug_count )) || integer -g _debug_count local tmp=${TMPPREFIX}${$}${words[1]:t}$[++_debug_count] diff --git a/Completion/Base/Widget/_complete_help b/Completion/Base/Widget/_complete_help index bfbfa3222..ffbcf0caa 100644 --- a/Completion/Base/Widget/_complete_help +++ b/Completion/Base/Widget/_complete_help @@ -1,9 +1,7 @@ #compdef -k complete-word \C-xh _complete_help() { - setopt localoptions ${_comp_options[@]} - - exec </dev/null # ZLE closes stdin, which can cause errors + eval "$_comp_setup" local _sort_tags=_help_sort_tags text i j k tmp typeset -A help_funcs help_tags help_sfuncs help_styles diff --git a/Completion/Base/Widget/_correct_word b/Completion/Base/Widget/_correct_word index 11b37efb1..fe2fbfeb1 100644 --- a/Completion/Base/Widget/_correct_word +++ b/Completion/Base/Widget/_correct_word @@ -7,7 +7,7 @@ # If configurations keys with the prefix `correctword_' are # given they override those starting with `correct_'. -setopt localoptions ${_comp_options[@]} +eval "$_comp_setup" local curcontext="$curcontext" diff --git a/Completion/Base/Widget/_expand_word b/Completion/Base/Widget/_expand_word index 48ce87ede..1e8ddb21b 100644 --- a/Completion/Base/Widget/_expand_word +++ b/Completion/Base/Widget/_expand_word @@ -2,7 +2,7 @@ # Simple completion front-end implementing expansion. -setopt localoptions ${_comp_options[@]} +eval "$_comp_setup" local curcontext="$curcontext" diff --git a/Completion/Base/Widget/_history_complete_word b/Completion/Base/Widget/_history_complete_word index 1142f2f91..fe2a846db 100644 --- a/Completion/Base/Widget/_history_complete_word +++ b/Completion/Base/Widget/_history_complete_word @@ -15,7 +15,7 @@ # range -- range of history words to complete _history_complete_word () { - setopt localoptions ${_comp_options[@]} + eval "$_comp_setup" local expl direction stop curcontext="$curcontext" diff --git a/Completion/Base/Widget/_next_tags b/Completion/Base/Widget/_next_tags index 29196a14d..0620a1f99 100644 --- a/Completion/Base/Widget/_next_tags +++ b/Completion/Base/Widget/_next_tags @@ -3,7 +3,7 @@ # Main widget. _next_tags() { - setopt localoptions ${_comp_options[@]} + eval "$_comp_setup" local ins ops="$PREFIX$SUFFIX" diff --git a/Completion/compinit b/Completion/compinit index 05ef2c379..4b85be764 100644 --- a/Completion/compinit +++ b/Completion/compinit @@ -139,8 +139,19 @@ _comp_options=( NO_cshnullglob NO_allexport NO_aliases + NO_errexit ) +# And this one should be `eval'ed at the beginning of every entry point +# to the completion system. It sets up what we currently consider a +# sane environment. That means we set the options above, make sure we +# have a valid stdin descriptor (zle closes it before calling widgets) +# and don't get confused by user's ZERR trap handlers. + +_comp_setup='setopt localoptions localtraps ${_comp_options[@]}; + exec </dev/null; + trap - ZERR' + # These can hold names of functions that are to be called before/after all # matches have been generated. |