about summary refs log tree commit diff
path: root/Completion/Base
diff options
context:
space:
mode:
authorBart Schaefer <schaefer@zsh.org>2013-04-07 13:37:25 -0700
committerBart Schaefer <schaefer@zsh.org>2013-04-07 13:37:25 -0700
commitb4b02fbc8a6481c05bfb0eb82259e17b3a8714a4 (patch)
tree7d5c097b6faf846aeb608fc91627cd7ef32fd20f /Completion/Base
parente619a7353ad32934d680140e54358c835276ca2e (diff)
downloadzsh-b4b02fbc8a6481c05bfb0eb82259e17b3a8714a4.tar.gz
zsh-b4b02fbc8a6481c05bfb0eb82259e17b3a8714a4.tar.xz
zsh-b4b02fbc8a6481c05bfb0eb82259e17b3a8714a4.zip
31234: use an "always" block instead of "trap" to clean up various function
overrides
Diffstat (limited to 'Completion/Base')
-rw-r--r--Completion/Base/Widget/_complete_help68
1 files changed, 34 insertions, 34 deletions
diff --git a/Completion/Base/Widget/_complete_help b/Completion/Base/Widget/_complete_help
index 99f2f2dba..949a49625 100644
--- a/Completion/Base/Widget/_complete_help
+++ b/Completion/Base/Widget/_complete_help
@@ -6,41 +6,41 @@ _complete_help() {
   local _sort_tags=_help_sort_tags text i j k tmp
   typeset -A help_funcs help_tags help_sfuncs help_styles
 
-  compadd() { return 1 }
-  zstyle() {
-    local _f="${${(@)${(@)funcstack[2,(i)_(main_complete|complete|approximate|normal)]}:#_(dispatch|wanted|requested|all_labels|next_label)}% *}"
-
-    [[ -z "$_f" ]] && _f="${${(@)funcstack[2,(i)_(main_complete|complete|approximate|normal)]}:#_(dispatch|wanted|requested|all_labels|next_label)}"
-
-    if [[ "$help_sfuncs[$2]" != *${_f}* ||
-          "$help_styles[${2}${_f}]" != *${3}* ]]; then
-
-      [[ "$help_sfuncs[$2]" != *${_f}* ]] && help_sfuncs[$2]+=$'\0'"${_f}"
-      local _t
-
-      case "$1" in
-      -s) _t='[string] ';;
-      -a) _t='[array]  ';;
-      -h) _t='[assoc]  ';;
-      *)  _t='[boolean]';;
-      esac
-      help_styles[${2}${_f}]+=",${_t} ${3}:${_f}"
-    fi
-
-    # No need to call the completers more than once with different match specs.
-
-    if [[ "$3" = matcher-list ]]; then
-      set -A "$4" ''
-    else
-      builtin zstyle "$@"
-    fi
+  {
+    compadd() { return 1 }
+    zstyle() {
+      local _f="${${(@)${(@)funcstack[2,(i)_(main_complete|complete|approximate|normal)]}:#_(dispatch|wanted|requested|all_labels|next_label)}% *}"
+  
+      [[ -z "$_f" ]] && _f="${${(@)funcstack[2,(i)_(main_complete|complete|approximate|normal)]}:#_(dispatch|wanted|requested|all_labels|next_label)}"
+  
+      if [[ "$help_sfuncs[$2]" != *${_f}* ||
+            "$help_styles[${2}${_f}]" != *${3}* ]]; then
+  
+        [[ "$help_sfuncs[$2]" != *${_f}* ]] && help_sfuncs[$2]+=$'\0'"${_f}"
+        local _t
+  
+        case "$1" in
+        -s) _t='[string] ';;
+        -a) _t='[array]  ';;
+        -h) _t='[assoc]  ';;
+        *)  _t='[boolean]';;
+        esac
+        help_styles[${2}${_f}]+=",${_t} ${3}:${_f}"
+      fi
+  
+      # No need to call the completers more than once with different match specs.
+  
+      if [[ "$3" = matcher-list ]]; then
+        set -A "$4" ''
+      else
+        builtin zstyle "$@"
+      fi
+    }
+
+    ${1:-_main_complete}
+  } always {
+    unfunction compadd zstyle
   }
-  trap 'unfunction compadd zstyle' EXIT INT
-
-  ${1:-_main_complete}
-
-  unfunction compadd zstyle
-  trap - EXIT INT
 
   for i in "${(@ok)help_funcs}"; do
     text+=$'\n'"tags in context :completion:${i}:"