about summary refs log tree commit diff
path: root/Completion/Core
diff options
context:
space:
mode:
Diffstat (limited to 'Completion/Core')
-rw-r--r--Completion/Core/_approximate7
-rw-r--r--Completion/Core/_description10
-rw-r--r--Completion/Core/_expand11
-rw-r--r--Completion/Core/_list4
-rw-r--r--Completion/Core/_main_complete9
-rw-r--r--Completion/Core/_match4
-rw-r--r--Completion/Core/_message5
-rw-r--r--Completion/Core/_oldlist5
-rw-r--r--Completion/Core/_path_files10
-rw-r--r--Completion/Core/_requested2
-rw-r--r--Completion/Core/_setup12
-rw-r--r--Completion/Core/_tags10
-rw-r--r--Completion/Core/compinit32
13 files changed, 60 insertions, 61 deletions
diff --git a/Completion/Core/_approximate b/Completion/Core/_approximate
index fc2d6afa0..bb1faa7b3 100644
--- a/Completion/Core/_approximate
+++ b/Completion/Core/_approximate
@@ -20,7 +20,7 @@ local curcontext="${curcontext}" oldcontext
 
 oldcontext="$curcontext"
 
-_style -s '' max-errors cfgacc
+zstyle -s ":completion${curcontext}:" max-errors cfgacc
 
 # Get the number of errors to accept.
 
@@ -79,11 +79,12 @@ while [[ _comp_correct -le comax ]]; do
                "e:$_comp_correct" "o:$PREFIX$SUFFIX"
 
   if _complete; then
-    if _style '' insert-unambiguous &&
+    if zstyle -t ":completion${curcontext}:" insert-unambiguous &&
        [[ "${#compstate[unambiguous]}" -ge "${#:-$PREFIX$SUFFIX}" ]]; then
       compstate[pattern_insert]=unambiguous
     elif _requested original &&
-         ( [[ compstate[nmatches] -gt 1 ]] || _style '' original ); then
+         ( [[ compstate[nmatches] -gt 1 ]] ||
+           zstyle -t ":completion${curcontext}:" original ); then
       local expl
 
       _description -V original expl original
diff --git a/Completion/Core/_description b/Completion/Core/_description
index 3bf15d320..89a0733a8 100644
--- a/Completion/Core/_description
+++ b/Completion/Core/_description
@@ -16,17 +16,19 @@ _setup "$1"
 
 name="$2"
 
-_style -s "$1" format format || _style -s descriptions format format
+zstyle -s ":completion${curcontext}:$1" format format ||
+    zstyle -s ":completion${curcontext}:descriptions" format format
 
-_style -s "$1" hidden hidden
+zstyle -s ":completion${curcontext}:$1" hidden hidden
 if [[ "$hidden" = (all|yes|true|1|on) ]]; then
   [[ "$hidden" = all ]] && format=''
   hide=(-n)
 fi
-_style -s "$1" group-name gname && [[ -z "$gname" ]] && gname="$1"
+zstyle -s ":completion${curcontext}:$1" group-name gname &&
+    [[ -z "$gname" ]] && gname="$1"
 
 shift 2
-[[ -n "$format" ]] && compfmt format "$format" "d:$1" "${(@)argv[2,-1]}"
+[[ -n "$format" ]] && zformat -f format "$format" "d:$1" "${(@)argv[2,-1]}"
 
 if [[ -n "$gname" ]]; then
   if [[ -n "$format" ]]; then
diff --git a/Completion/Core/_expand b/Completion/Core/_expand
index bde5ee2f8..cdfc2a8d1 100644
--- a/Completion/Core/_expand
+++ b/Completion/Core/_expand
@@ -13,7 +13,8 @@ local exp word="$PREFIX$SUFFIX" sort expr expl curcontext="${curcontext}"
 
 # First, see if we should insert all *completions*.
 
-if _style -s '' completions expr && [[ "${(e):-\$[$expr]}" -eq 1 ]]; then
+if zstyle -s ":completion${curcontext}:" completions expr &&
+   [[ "${(e):-\$[$expr]}" -eq 1 ]]; then
   compstate[insert]=all
   return 1
 fi
@@ -29,7 +30,8 @@ exp=("$word")
 # First try substitution. That weird thing spanning multiple lines
 # changes quoted spaces, tabs, and newlines into spaces.
 
-_style -s '' substitute expr && [[ "${(e):-\$[$expr]}" -eq 1 ]] &&
+zstyle -s ":completion${curcontext}:" substitute expr &&
+    [[ "${(e):-\$[$expr]}" -eq 1 ]] &&
     exp=( "${(e)exp//\\[ 	
 ]/ }" )
 
@@ -39,7 +41,8 @@ _style -s '' substitute expr && [[ "${(e):-\$[$expr]}" -eq 1 ]] &&
 
 # Now try globbing.
 
-_style -s '' glob expr && [[ "${(e):-\$[$expr]}" -eq 1 ]] &&
+zstyle -s ":completion${curcontext}:" glob expr &&
+    [[ "${(e):-\$[$expr]}" -eq 1 ]] &&
     exp=( ${~exp}(N) )
 
 # If we don't have any expansions or only one and that is the same
@@ -50,7 +53,7 @@ _style -s '' glob expr && [[ "${(e):-\$[$expr]}" -eq 1 ]] &&
 
 # Now add as matches whatever the user requested.
 
-_style -s '' sort sort
+zstyle -s ":completion${curcontext}:" sort sort
 
 [[ "$sort" = (yes|true|1|on) ]] && exp=( "${(@o)exp}" )
 
diff --git a/Completion/Core/_list b/Completion/Core/_list
index 6c72bc9e9..294467eca 100644
--- a/Completion/Core/_list
+++ b/Completion/Core/_list
@@ -8,7 +8,7 @@ local pre suf curcontext="${curcontext}:list" expr
 
 # Get the strings to compare.
 
-if _style '' word; then
+if zstyle -t ":completion${curcontext}:" word; then
   pre="$HISTNO$LBUFFER"
   suf="$RBUFFER"
 else
@@ -18,7 +18,7 @@ fi
 
 # Should we only show a list now?
 
-_style -s '' condition expr
+zstyle -s ":completion${curcontext}:" condition expr
 if [[ ( -z "$expr" || "${(e):-\$[$expr]}" -eq 1 ) &&
       ( "$pre" != "$_list_prefix" || "$suf" != "$_list_suffix" ) ]]; then
 
diff --git a/Completion/Core/_main_complete b/Completion/Core/_main_complete
index 2bacad88b..285413726 100644
--- a/Completion/Core/_main_complete
+++ b/Completion/Core/_main_complete
@@ -17,7 +17,7 @@
 # state than the global one for which you are completing.
 
 
-local comp post ret=1 _compskip _prio_num=1 _cur_context format \
+local comp post ret=1 _compskip _prio_num=1 format \
       context state line opt_args val_args curcontext="$curcontext" \
       _last_nmatches=-1 _last_menu_style _def_menu_style _menu_style sel \
       _saved_exact="$compstate[exact]" \
@@ -56,7 +56,7 @@ _last_menu_style=()
 if (( ! $# )); then
   local tmp
 
-  _style -a '' completer tmp
+  zstyle -a ":completion${curcontext}:" completer tmp
   set -- "$tmp[@]"
 fi
 
@@ -139,7 +139,7 @@ fi
 if [[ compstate[nmatches] -eq 0 &&
       compstate[matcher] -eq compstate[total_matchers] &&
       $#_lastdescr -ne 0 ]] &&
-   _style -s warnings format format; then
+   zstyle -s ":completion${curcontext}:warnings" format format; then
   local str
 
   compstate[list]='list force'
@@ -151,7 +151,8 @@ if [[ compstate[nmatches] -eq 0 &&
   *) str="${(j:, :)_lastdescr[1,-2]}, or $_lastdescr[-1]";;
   esac
 
-  compadd -UX "${format//\\%d/$str}" -n ''
+  zformat -f format "$format" "d:$str"
+  compadd -UX "$format" -n ''
 fi
 
 _lastcomp=( "${(@kv)compstate}" )
diff --git a/Completion/Core/_match b/Completion/Core/_match
index d5556dfcd..0a9d755c4 100644
--- a/Completion/Core/_match
+++ b/Completion/Core/_match
@@ -19,8 +19,8 @@ tmp="${${:-$PREFIX$SUFFIX}#[~=]}"
 [[ "$tmp:q" = "$tmp" ||
    compstate[matcher] -ne compstate[total_matchers] ]] && return 1
 
-_style -s '' original orig
-_style -b '' insert-unambiguous ins
+zstyle -s ":completion${curcontext}:" original orig
+zstyle -b ":completion${curcontext}:" insert-unambiguous ins
 
 # Try completion without inserting a `*'?
 
diff --git a/Completion/Core/_message b/Completion/Core/_message
index 6b2666253..8ae93f973 100644
--- a/Completion/Core/_message
+++ b/Completion/Core/_message
@@ -4,10 +4,11 @@ local format
 
 _tags messages || return 1
 
-_style -s messages format format || _style -s descriptions format format
+zstyle -s ":completion${curcontext}:messages" format format ||
+    zstyle -s ":completion${curcontext}:descriptions" format format
 
 if [[ -n "$format" ]]; then
-  compfmt format "$format" "d:$1" "${(@)argv[2,-1]}"
+  zformat -f format "$format" "d:$1" "${(@)argv[2,-1]}"
   if [[ $compstate[nmatches] -eq 0 ]]; then
     compstate[list]='list force'
     compstate[insert]=''
diff --git a/Completion/Core/_oldlist b/Completion/Core/_oldlist
index ba57ed6b4..b0092d586 100644
--- a/Completion/Core/_oldlist
+++ b/Completion/Core/_oldlist
@@ -2,7 +2,7 @@
 
 local curcontext="${curcontext}:oldlist" list
 
-_style -s '' list list
+zstyle -s ":completion${curcontext}:" list list
 
 # If this is a listing widget and there is already an old list,
 # and either the style :oldlist:list is `always', or it is not `never'
@@ -33,7 +33,8 @@ fi
 
 if [[ -z $compstate[old_insert] && -n $compstate[old_list] ]]; then
   compstate[old_list]=keep
-elif [[ $WIDGET = *complete(|-prefix|-word) ]] && _style '' menu; then
+elif [[ $WIDGET = *complete(|-prefix|-word) ]] &&
+     zstyle -t ":completion${curcontext}:" menu; then
   if [[ -n $compstate[old_insert] ]]; then
     compstate[old_list]=keep
     if [[ $WIDGET = *reverse* ]]; then
diff --git a/Completion/Core/_path_files b/Completion/Core/_path_files
index e5135a422..2dcfa625c 100644
--- a/Completion/Core/_path_files
+++ b/Completion/Core/_path_files
@@ -116,7 +116,7 @@ orig="${PREFIX}${SUFFIX}"
 # If given no `-F' option, we want to use the `ignored-suffixes'-style.
 
 if (( ! $#ignore )); then
-  if _style -a files ignored-suffixes ignore; then
+  if zstyle -a ":completion${curcontext}:files" ignored-suffixes ignore; then
     ignore=(-F "( $ignore )")
   else
 
@@ -347,8 +347,10 @@ for prepath in "$prepaths[@]"; do
       tmp4="$testpath"
       compquote tmp1 tmp4
 
-      if [[ -n $menu ]] || ! _style paths expand '*suffix*'; then
-        _style paths cursor && compstate[to_end]=''
+      if [[ -n $menu ]] ||
+         ! zstyle -t ":completion${curcontext}:paths" expand suffix; then
+        zstyle -t ":completion${curcontext}:paths" cursor &&
+            compstate[to_end]=''
         if [[ "$tmp3" = */* ]]; then
 	  compadd -Qf "$mopts[@]" -p "$linepath$tmp4" -s "/${tmp3#*/}" \
 	          -W "$prepath$realpath$testpath" "$ignore[@]" \
@@ -436,7 +438,7 @@ done
 
 exppaths=( "${(@)exppaths:#$orig}" )
 
-if _style paths expand '*prefix*' &&
+if zstyle -t ":completion${curcontext}:paths" expand prefix &&
    [[ $#exppaths -gt 0 && nm -eq compstate[nmatches] ]]; then
   PREFIX="${opre}"
   SUFFIX="${osuf}"
diff --git a/Completion/Core/_requested b/Completion/Core/_requested
index 3bc6f3b40..a582adfb9 100644
--- a/Completion/Core/_requested
+++ b/Completion/Core/_requested
@@ -8,8 +8,6 @@ else
   tag="$1"
 fi
 
-comptags -C _cur_context
-
 comptags -R "$tag" &&
     if [[ $# -gt 1 ]]; then
       _description "$@"
diff --git a/Completion/Core/_setup b/Completion/Core/_setup
index bdef1bf8e..fa1495ced 100644
--- a/Completion/Core/_setup
+++ b/Completion/Core/_setup
@@ -2,7 +2,7 @@
 
 local val nm="$compstate[nmatches]"
 
-if _style -a "$1" list-colors val; then
+if zstyle -a ":completion${curcontext}:$1" list-colors val; then
   if [[ "$1" = default ]]; then
     ZLS_COLORS="${(j.:.)${(@)val:gs/:/\\\:}}"
   else
@@ -10,7 +10,7 @@ if _style -a "$1" list-colors val; then
   fi
 fi
 
-if _style -s "$1" list-packed val; then
+if zstyle -s ":completion${curcontext}:$1" list-packed val; then
   if [[ "$val" = (yes|true|1|on) ]]; then
     compstate[list]="${compstate[list]} packed"
   else
@@ -20,7 +20,7 @@ else
   compstate[list]="$_saved_list"
 fi
 
-if _style -s "$1" list-rows-first val; then
+if zstyle -s ":completion${curcontext}:$1" list-rows-first val; then
   if [[ "$val" = (yes|true|1|on) ]]; then
     compstate[list]="${compstate[list]} rows"
   else
@@ -30,7 +30,7 @@ else
   compstate[list]="$_saved_list"
 fi
 
-if _style -s "$1" last-prompt val; then
+if zstyle -s ":completion${curcontext}:$1" last-prompt val; then
   if [[ "$val" = (yes|true|1|on) ]]; then
     compstate[last_prompt]=yes
   else
@@ -40,7 +40,7 @@ else
   compstate[last_prompt]="$_saved_lastprompt"
 fi
 
-if _style -s "$1" accept-exact val; then
+if zstyle -s ":completion${curcontext}:$1" accept-exact val; then
   if [[ "$val" = (yes|true|1|on) ]]; then
     compstate[exact]=accept
   else
@@ -53,7 +53,7 @@ fi
 [[ _last_nmatches -ge 0 && _last_nmatches -ne nm ]] &&
     _menu_style=( "$_last_menu_style[@]" "$_menu_style[@]" )
 
-if _style -a "$1" menu val; then
+if zstyle -a ":completion${curcontext}:$1" menu val; then
   _last_nmatches="$nm"
   _last_menu_style=( "$val[@]" )
 else
diff --git a/Completion/Core/_tags b/Completion/Core/_tags
index b39c0fff5..fcef91061 100644
--- a/Completion/Core/_tags
+++ b/Completion/Core/_tags
@@ -18,7 +18,7 @@ if (( $# )); then
 
   [[ "$1" = -(|-) ]] && shift
 
-  if _style -a '' group-order order; then
+  if zstyle -a ":completion${curcontext}" group-order order; then
     local name
 
     for name in "$order[@]"; do
@@ -42,10 +42,6 @@ if (( $# )); then
 
   "${_sort_tags:-_sort_tags}" "$@"
 
-  # Also store the context (used below and in _requested).
-
-  _cur_context="$curcontext"
-
   # Return non-zero if at least one set of tags should be used.
 
   comptags -T
@@ -57,10 +53,6 @@ fi
 
 local tags
 
-# Reset the current context.
-
-comptags -C _cur_context
-
 _failed_tags=( "$_failed_tags[@]" "$_last_tags[@]" )
 
 # Return failure if no sets remaining.
diff --git a/Completion/Core/compinit b/Completion/Core/compinit
index 06586cdc4..0d99aadd5 100644
--- a/Completion/Core/compinit
+++ b/Completion/Core/compinit
@@ -440,19 +440,19 @@ compstyle() {
   if (( ! $# )); then
     local pats styles vals pat style pre eq
 
-    compstyles -G pats
+    zstyle -g pats
 
-    for pat in "$pats[@]"; do
+    for pat in "${(@M)pats:#:completion*}"; do
       if [[ -n "$long" ]]; then
-        pre="compstyle ${(qq)pat} "
+        pre="compstyle ${(qq)pat#:completion} "
       else
-        print "$pat"
+        print "${pat#:completion}"
 	pre='    '
 	eq=' ='
       fi
-      compstyles -G styles "$pat"
+      zstyle -g styles "$pat"
       for style in "$styles[@]"; do
-        compstyles -G vals "$pat" "$style"
+        zstyle -g vals "$pat" "$style"
         print "${pre}${style}${eq}" "${(@qq)vals}"
       done
     done
@@ -461,26 +461,24 @@ compstyle() {
   fi
 
   if [[ "$1" = -d ]]; then
-    case "$#" in
-    1) compstyles -d ;;
-    2) compstyles -d "$2" ;;
-    *) 
-      local pat="$2" style
+    if [[ $# -gt 1 ]]; then
+      zstyle -d ":completion$2" "${(@)argv[3,-1]}"
+    else
+      local pats
 
-      shift
+      zstyle -g pats
 
-      for style; do
-        compstyles -d "$pat" "$style"
+      for pat in "${(@M)pats:#:completion}"; do
+        zstyle -d "$pat"
       done
-      ;;
-    esac
+    fi
 
     return 0
   fi
 
   [[ "$1" = -(|-) ]] && shift
 
-  compstyles -a "$@"
+  zstyle - ":completion$1" "${(@)argv[2,-1]}"
 
   return 0
 }