about summary refs log tree commit diff
path: root/Completion
diff options
context:
space:
mode:
authorTanaka Akira <akr@users.sourceforge.net>2000-02-03 17:22:40 +0000
committerTanaka Akira <akr@users.sourceforge.net>2000-02-03 17:22:40 +0000
commited41dafd3c79ebf2ce390ee9af54fe8bb21deb73 (patch)
treea45e062eb30e19f11c04c8bb7d30e36c1b77eb7e /Completion
parent52a67fbbda1eda1e45d9aa6eed6c9650fbd6d0b1 (diff)
downloadzsh-ed41dafd3c79ebf2ce390ee9af54fe8bb21deb73.tar.gz
zsh-ed41dafd3c79ebf2ce390ee9af54fe8bb21deb73.tar.xz
zsh-ed41dafd3c79ebf2ce390ee9af54fe8bb21deb73.zip
zsh-workers/9546
Diffstat (limited to 'Completion')
-rw-r--r--Completion/Base/_arguments10
-rw-r--r--Completion/Base/_combination4
-rw-r--r--Completion/Base/_describe4
-rw-r--r--Completion/Base/_first2
-rw-r--r--Completion/Base/_jobs8
-rw-r--r--Completion/Base/_subscript2
-rw-r--r--Completion/Base/_tilde4
-rw-r--r--Completion/Base/_values8
-rw-r--r--Completion/Builtins/_pids6
-rw-r--r--Completion/Builtins/_popd4
-rw-r--r--Completion/Builtins/_sched2
-rw-r--r--Completion/Builtins/_signals4
-rw-r--r--Completion/Builtins/_stat2
-rw-r--r--Completion/Builtins/_zftp19
-rw-r--r--Completion/Builtins/_zstyle20
-rw-r--r--Completion/Commands/_complete_help2
-rw-r--r--Completion/Commands/_correct_word6
-rw-r--r--Completion/Commands/_expand_word6
-rw-r--r--Completion/Commands/_history_complete_word12
-rw-r--r--Completion/Core/_alternative2
-rw-r--r--Completion/Core/_approximate11
-rw-r--r--Completion/Core/_complete11
-rw-r--r--Completion/Core/_correct5
-rw-r--r--Completion/Core/_description12
-rw-r--r--Completion/Core/_expand13
-rw-r--r--Completion/Core/_files14
-rw-r--r--Completion/Core/_list6
-rw-r--r--Completion/Core/_main_complete6
-rw-r--r--Completion/Core/_match8
-rw-r--r--Completion/Core/_menu4
-rw-r--r--Completion/Core/_message4
-rw-r--r--Completion/Core/_normal8
-rw-r--r--Completion/Core/_oldlist6
-rw-r--r--Completion/Core/_path_files18
-rw-r--r--Completion/Core/_setup12
-rw-r--r--Completion/Core/_sort_tags6
-rw-r--r--Completion/Core/_tags8
-rw-r--r--Completion/Core/compinit10
-rw-r--r--Completion/Debian/_apt2
-rw-r--r--Completion/Debian/_deb_packages2
-rw-r--r--Completion/User/_cvs4
-rw-r--r--Completion/User/_domains2
-rw-r--r--Completion/User/_groups2
-rw-r--r--Completion/User/_hosts2
-rw-r--r--Completion/User/_ports2
-rw-r--r--Completion/User/_socket2
-rw-r--r--Completion/User/_urls4
-rw-r--r--Completion/User/_users2
-rw-r--r--Completion/X/_x_color2
49 files changed, 169 insertions, 146 deletions
diff --git a/Completion/Base/_arguments b/Completion/Base/_arguments
index fe98240ce..1a5fd10f5 100644
--- a/Completion/Base/_arguments
+++ b/Completion/Base/_arguments
@@ -162,7 +162,7 @@ while [[ "$1" = -(O*|C) ]]; do
   esac
 done
 
-zstyle -s ":completion${curcontext}:options" auto-description autod
+zstyle -s ":completion:${curcontext}:options" auto-description autod
 
 if (( $# )) && comparguments -i "$autod" "$@"; then
   local nm="$compstate[nmatches]" action noargs aret expl local
@@ -172,7 +172,7 @@ if (( $# )) && comparguments -i "$autod" "$@"; then
 
   if comparguments -D descr action; then
     comparguments -C subc
-    curcontext="${oldcontext}:$subc"
+    curcontext="${oldcontext%:*}:$subc"
 
     if comparguments -O next direct odirect equal; then
       opts=yes
@@ -201,7 +201,7 @@ if (( $# )) && comparguments -i "$autod" "$@"; then
           comparguments -W line opt_args
           state="${${action[3,-1]##[ 	]#}%%[ 	]#}"
 	  if [[ -n "$usecc" ]]; then
-	    curcontext="${oldcontext}:$subc"
+	    curcontext="${oldcontext%:*}:$subc"
 	  else
 	    context="$subc"
 	  fi
@@ -259,7 +259,7 @@ if (( $# )) && comparguments -i "$autod" "$@"; then
       fi
 
       if [[ -z "$matched$mesg" ]] && _requested options &&
-          { ! zstyle -t ":completion${curcontext}:options" prefix-needed ||
+          { ! zstyle -t ":completion:${curcontext}:options" prefix-needed ||
             [[ "$origpre" = [-+]* ||
                ( -z "$aret$mesg" && nm -eq compstate[nmatches] ) ]] } ; then
 	local prevpre="$PREFIX" previpre="$IPREFIX"
@@ -320,7 +320,7 @@ if (( $# )) && comparguments -i "$autod" "$@"; then
 	matched=yes
 
 	comparguments -L "${equal[1]%%:*}" descr action subc
-	curcontext="${oldcontext}:$subc"
+	curcontext="${oldcontext%:*}:$subc"
 
 	_tags arguments
 
diff --git a/Completion/Base/_combination b/Completion/Base/_combination
index 0f9673b06..875d3c2cb 100644
--- a/Completion/Base/_combination
+++ b/Completion/Base/_combination
@@ -11,7 +11,7 @@
 #  Assume an user sets the style `hosts-ports-users' as for the my-accounts
 #  tag:
 #
-#    zstyle ':completion:*:telnet*:my-accounts' hosts-ports-users \
+#    zstyle ':completion:*:*:telnet:*:my-accounts' hosts-ports-users \
 #      host0:: host1::user1 host2::user2
 #      mail-server:{smtp,pop3}:
 #      news-server:nntp:
@@ -78,7 +78,7 @@ key="${1%:*}"
 num="${${1##*:}:-1}"
 shift
 
-if zstyle -a ":completion${curcontext}:$tag" "$style" tmp; then
+if zstyle -a ":completion:${curcontext}:$tag" "$style" tmp; then
   eval "tmp=( \"\${(@M)tmp:#\${(j($sep))~pats}}\" )"
   if (( keys[(in:num:)$key] != 1 )); then
     eval "tmp=( \${tmp#\${(j(${sep}))~\${(@)\${(@)keys[2,(rn:num:)\$key]}/*/*}}$sep} )"
diff --git a/Completion/Base/_describe b/Completion/Base/_describe
index 1db7e6fb6..684385d13 100644
--- a/Completion/Base/_describe
+++ b/Completion/Base/_describe
@@ -16,7 +16,7 @@ fi
 
 _tags "$_type" || return 1
 
-zstyle -t ":completion${curcontext}:$_type" verbose && _showd=yes
+zstyle -t ":completion:${curcontext}:$_type" verbose && _showd=yes
 
 _description "$_type" _expl "$1"
 shift
@@ -28,7 +28,7 @@ else
 fi
 
 [[ "$_type" = options ]] &&
-    zstyle -t ":completion${curcontext}:options" prefix-hidden && _hide=yes
+    zstyle -t ":completion:${curcontext}:options" prefix-hidden && _hide=yes
 
 while compdescribe -g _args _tmpd _tmpmd _tmps _tmpms; do
 
diff --git a/Completion/Base/_first b/Completion/Base/_first
index f81ab465e..566cfc785 100644
--- a/Completion/Base/_first
+++ b/Completion/Base/_first
@@ -50,7 +50,7 @@
 #       # We first search in the last ten words, then in the last
 #       # twenty words, and so on...
 #       while [[ i -le max ]]; do
-#         if zstyle -t ":completion${curcontext}:history-words" sort; then
+#         if zstyle -t ":completion:${curcontext}:history-words" sort; then
 #           _description history-words expl "history ($n)"
 #         else
 #           _description -V history-words expl "history ($n)"
diff --git a/Completion/Base/_jobs b/Completion/Base/_jobs
index e12410f99..fc2f3d87f 100644
--- a/Completion/Base/_jobs
+++ b/Completion/Base/_jobs
@@ -5,12 +5,12 @@ local expl disp jobs job jids pfx='%' desc how
 _tags jobs || return 1
 
 if [[ "$1" = -t ]]; then
-  zstyle -t ":completion${curcontext}:jobs" prefix-needed &&
+  zstyle -t ":completion:${curcontext}:jobs" prefix-needed &&
       [[ "$PREFIX" != %* && compstate[nmatches] -ne 0 ]] && return 1
   shift
 fi
-zstyle -t ":completion${curcontext}:jobs" prefix-hidden && pfx=''
-zstyle -t ":completion${curcontext}:jobs" verbose       && desc=yes
+zstyle -t ":completion:${curcontext}:jobs" prefix-hidden && pfx=''
+zstyle -t ":completion:${curcontext}:jobs" verbose       && desc=yes
 
 if [[ "$1" = -r ]]; then
   jids=( "${(@k)jobstates[(R)running*]}" )
@@ -34,7 +34,7 @@ if [[ -n "$desc" ]]; then
   done
 fi
 
-zstyle -s ":completion${curcontext}:jobs" numbers how
+zstyle -s ":completion:${curcontext}:jobs" numbers how
 
 if [[ "$how" = (yes|true|on|1) ]]; then
   jobs=( "$jids[@]" )
diff --git a/Completion/Base/_subscript b/Completion/Base/_subscript
index fdda19301..b74fe795d 100644
--- a/Completion/Base/_subscript
+++ b/Completion/Base/_subscript
@@ -21,7 +21,7 @@ elif [[ ${(Pt)${compstate[parameter]}} = array* ]]; then
   while _tags; do
     if _requested -V indexes expl 'array index'; then
       ind=( {1..${#${(P)${compstate[parameter]}}}} )
-      if zstyle -t ":completion${curcontext}:indexes" verbose; then
+      if zstyle -t ":completion:${curcontext}:indexes" verbose; then
         list=()
         for i in "$ind[@]"; do
           [[ "$i" = ${PREFIX}*${SUFFIX} ]] &&
diff --git a/Completion/Base/_tilde b/Completion/Base/_tilde
index 128fd7ffa..35621d9d3 100644
--- a/Completion/Base/_tilde
+++ b/Completion/Base/_tilde
@@ -22,9 +22,9 @@ while _tags; do
       compadd "$suf[@]" "$expl[@]" "$@" - "${(@k)nameddirs}"
 
   if _requested -V directory-stack expl 'directory stack' &&
-     { ! zstyle -t ":completion${curcontext}:directory-stack" prefix-needed ||
+     { ! zstyle -t ":completion:${curcontext}:directory-stack" prefix-needed ||
        [[ "$PREFIX" = [-+]* || nm -eq compstate[nmatches] ]] }; then
-    if zstyle -t ":completion${curcontext}:directory-stack" verbose; then
+    if zstyle -t ":completion:${curcontext}:directory-stack" verbose; then
       integer i
 
       lines=("${PWD}" "${dirstack[@]}")
diff --git a/Completion/Base/_values b/Completion/Base/_values
index 7b174bc58..e8004ba6f 100644
--- a/Completion/Base/_values
+++ b/Completion/Base/_values
@@ -20,7 +20,7 @@ if compvalues -i "$@"; then
 
     _tags values || return 1
 
-    curcontext="${oldcontext}:values"
+    curcontext="${oldcontext%:*}:values"
 
     compvalues -V noargs args opts
 
@@ -47,7 +47,7 @@ if compvalues -i "$@"; then
 	SUFFIX="$suffix"
         IPREFIX="${IPREFIX}${args[1]%%:*}="
 	compvalues -L "${args[1]%%:*}" descr action subc
-	curcontext="${oldcontext}:$subc"
+	curcontext="${oldcontext%:*}:$subc"
       fi
     else
       compvalues -d descr
@@ -68,7 +68,7 @@ if compvalues -i "$@"; then
     fi
   else
     compvalues -C subc
-    curcontext="${oldcontext}:$subc"
+    curcontext="${oldcontext%:*}:$subc"
   fi
 
   if ! _tags arguments; then
@@ -88,7 +88,7 @@ if compvalues -i "$@"; then
     compvalues -v val_args
     state="${${action[3,-1]##[ 	]#}%%[ 	]#}"
     if [[ -n "$usecc" ]]; then
-      curcontext="$subc"
+      curcontext="${oldcontext%:*}:$subc"
     else
       context="$subc"
     fi
diff --git a/Completion/Builtins/_pids b/Completion/Builtins/_pids
index 8b5d27bc5..b00e811bb 100644
--- a/Completion/Builtins/_pids
+++ b/Completion/Builtins/_pids
@@ -12,12 +12,12 @@ if [[ "$1" = -m ]]; then
   shift 2
 fi
 
-zstyle -a ":completion${curcontext}:ps" arguments args
+zstyle -a ":completion:${curcontext}:ps" arguments args
 
 out="$(command ps $args 2>/dev/null)"
 
-if zstyle -t ":completion${curcontext}:processes" verbose; then
-  zstyle -a ":completion${curcontext}:ps" list-arguments listargs
+if zstyle -t ":completion:${curcontext}:processes" verbose; then
+  zstyle -a ":completion:${curcontext}:ps" list-arguments listargs
   (( $#listargs )) || listargs=( "$args[@]" )
   if [[ "$listargs" = "$args" ]]; then
     list=("${(@Mr:COLUMNS-1:)${(f@)out}[2,-1]:#[ 	]#${PREFIX}[0-9]#${SUFFIX}[ 	]*${~match}}")
diff --git a/Completion/Builtins/_popd b/Completion/Builtins/_popd
index 8c5b1208d..586018952 100644
--- a/Completion/Builtins/_popd
+++ b/Completion/Builtins/_popd
@@ -11,10 +11,10 @@ local expl list lines revlines disp
 
 _wanted -V directory-stack expl 'directory stack' || return 1
 
-! zstyle -t ":completion${curcontext}:directory-stack" prefix-needed ||
+! zstyle -t ":completion:${curcontext}:directory-stack" prefix-needed ||
     [[ $PREFIX = [-+]* ]] || return 1
 
-if zstyle -t ":completion${curcontext}:directory-stack" verbose; then
+if zstyle -t ":completion:${curcontext}:directory-stack" verbose; then
   # get the list of directories with their canonical number
   # and turn the lines into an array, removing the current directory
   lines=("${dirstack[@]}")
diff --git a/Completion/Builtins/_sched b/Completion/Builtins/_sched
index ea11eeb65..851659033 100644
--- a/Completion/Builtins/_sched
+++ b/Completion/Builtins/_sched
@@ -7,7 +7,7 @@ if [[ CURRENT -eq 2 ]]; then
     _wanted -C - jobs expl 'scheduled jobs' || return 1
 
     lines=(${(f)"$(sched)"})
-    if zstyle -t ":completion${curcontext}:jobs" verbose; then
+    if zstyle -t ":completion:${curcontext}:jobs" verbose; then
       disp=( -ld lines )
     else
       disp=()
diff --git a/Completion/Builtins/_signals b/Completion/Builtins/_signals
index 545d83924..ad1f0131b 100644
--- a/Completion/Builtins/_signals
+++ b/Completion/Builtins/_signals
@@ -22,11 +22,11 @@ done
 
 if _wanted signals expl signal &&
        { [[ -z "$minus" ]] ||
-         ! zstyle -t ":completion${curcontext}:signals" prefix-needed ||
+         ! zstyle -t ":completion:${curcontext}:signals" prefix-needed ||
          [[ "$PREFIX" = -* ]] } ; then
   local disp tmp
 
-  if zstyle -t ":completion${curcontext}:signals" prefix-hidden; then
+  if zstyle -t ":completion:${curcontext}:signals" prefix-hidden; then
     tmp=( "${(@)signals[1,last]}" )
     disp=(-d tmp)
   else
diff --git a/Completion/Builtins/_stat b/Completion/Builtins/_stat
index ca7d2900d..ae884066f 100644
--- a/Completion/Builtins/_stat
+++ b/Completion/Builtins/_stat
@@ -10,7 +10,7 @@ else
   while _tags; do
     _requested files && _files && ret=0
     _requested options expl 'inode element' &&
-        { ! zstyle -t ":completion${curcontext}:options" prefix-needed ||
+        { ! zstyle -t ":completion:${curcontext}:options" prefix-needed ||
           [[ "$PREFIX[1]" = + || ret -eq 1 ]] } &&
         compadd "$expl[@]" - +device +inode +mode +nlink +uid +gid +rdev \
                              +size +atime +mtime +ctime +blksize +block +link
diff --git a/Completion/Builtins/_zftp b/Completion/Builtins/_zftp
index 8407de30e..6246015ec 100644
--- a/Completion/Builtins/_zftp
+++ b/Completion/Builtins/_zftp
@@ -9,7 +9,7 @@
 # Don't try any more completion after this.
 _compskip=all
 
-local subcom expl
+local subcom expl curcontext="${curcontext}"
 
 if [[ $words[1] = zftp ]]; then
   if [[ $CURRENT -eq 2 ]]; then
@@ -20,6 +20,7 @@ if [[ $words[1] = zftp ]]; then
     return
   fi
   subcom=$words[2]
+  curcontext="${curcontext/:zftp:/:zftp-${words[2]}:}"
 else
   subcom=$words[1]
 fi
@@ -27,27 +28,27 @@ fi
 case $subcom in
   *(cd|ls|dir))
     # complete remote directories
-    _tags -C "$subcom" directories && zfcd_match $PREFIX $SUFFIX
+    _tags directories && zfcd_match $PREFIX $SUFFIX
     ;;
 
   *(get(|at)|gcp|delete|remote))
     # complete remote files
-    _tags -C "$subcom" files && zfget_match $PREFIX $SUFFIX
+    _tags files && zfget_match $PREFIX $SUFFIX
     ;;
 
   *(put(|at)|pcp))
     # complete local files
-    _tags -C "$subcom" files && _files
+    _tags files && _files
     ;;
 
   *(open|anon|params))
     # complete hosts:  should do cleverer stuff with user names
-    _tags -C "$subcom" hosts && _hosts
+    _tags hosts && _hosts
     ;;
 
   *(goto|mark))
     # complete bookmarks.  First decide if ncftp mode is go.
-    _wanted -C "$subcom" bookmarks expl bookmark || return 1
+    _wanted bookmarks expl bookmark || return 1
     if [[ $words[2] = -*n* ]]; then
       if [[ -f ~/.ncftp/bookmarks ]]; then
         compadd "$expl[@]" - $(awk -F, 'NR > 2 { print $1 }' ~/.ncftp/bookmarks)
@@ -61,7 +62,7 @@ case $subcom in
 
   *session)
     # complete sessions, excluding the current one.
-    _wanted -C "$subcom" sessions expl 'another FTP session' &&
+    _wanted sessions expl 'another FTP session' &&
         compadd "$expl[@]" - ${$(zftp session):#$ZFTP_SESSION}
     ;;
 
@@ -69,7 +70,7 @@ case $subcom in
     # complete arguments like sess1:file1 sess2:file2
     if [[ $PREFIX = *:* ]]; then
       # complete file in the given session
-      _tags -C "$subcom" files || return 1
+      _tags files || return 1
       local sess=${PREFIX%%:*} oldsess=$ZFTP_SESSION
       compset -p $(( $#sess + 1 ))
       [[ -n $sess ]] && zftp session $sess
@@ -77,7 +78,7 @@ case $subcom in
       [[ -n $sess && -n $oldsess ]] && zftp session $oldsess
     else
       # note here we can complete the current session
-      _wanted -C "$subcom" sessions expl 'FTP session' &&
+      _wanted sessions expl 'FTP session' &&
           compadd "$expl[@]" -S : - $(zftp session)
     fi
     ;;
diff --git a/Completion/Builtins/_zstyle b/Completion/Builtins/_zstyle
index 4629344cc..5b99eacdf 100644
--- a/Completion/Builtins/_zstyle
+++ b/Completion/Builtins/_zstyle
@@ -1,7 +1,7 @@
 #compdef zstyle
 
 local curcontext="$curcontext" state context ostate line expl ctop
-local nm=$compstate[nmatches]
+local nm=$compstate[nmatches] mesg
 typeset -A opt_args
 
 typeset -A styles
@@ -17,6 +17,7 @@ styles=(
   condition		 c:
   cursor		 c:bool
   disable-stat		 c:bool
+  domains                c:
   expand		 c:
   file-patterns		 c:
   format		 c:
@@ -87,9 +88,20 @@ while [[ -n $state ]]; do
 
   case "$ostate" in
     contexts)
-      if [[ $PREFIX != :*: ]]; then
-	_wanted contexts expl context &&
-	compadd -P : -S : "$expl[@]" completion zftp
+      if _wanted contexts expl context; then
+        if [[ $PREFIX != :*: ]]; then
+	  compadd -P : -S : "$expl[@]" completion zftp
+        elif [[ $PREFIX = :completion:* ]]; then
+          mesg=''
+          case "$PREFIX" in
+          :completion:[^:]#) mesg=function ;;
+          :completion:[^:]#:[^:]#) mesg=completer ;;
+          :completion:[^:]#:[^:]#:[^:]#) mesg='command or context' ;;
+          :completion:[^:]#:[^:]#:[^:]#:[^:]#) mesg=argument ;;
+          :completion:[^:]#:[^:]#:[^:]#:[^:]#:[^:]#) mesg=tag ;;
+	  esac
+	  [[ -n "$mesg" ]] && _message "$mesg"
+        fi
       fi
       ;;
 
diff --git a/Completion/Commands/_complete_help b/Completion/Commands/_complete_help
index b172e76db..9d3e47add 100644
--- a/Completion/Commands/_complete_help
+++ b/Completion/Commands/_complete_help
@@ -12,7 +12,7 @@ _complete_help() {
 
   for i in "${(@k)help_funcs}"; do
     text="${text}
-tags in context ${i}"
+tags in context :completion:${i}"
     for j in "${(@s.:.)help_funcs[$i][2,-1]}"; do
       text="${text}${help_tags[${i}${j}]}	(${j})"
     done
diff --git a/Completion/Commands/_correct_word b/Completion/Commands/_correct_word
index e0fee1fff..46480da47 100644
--- a/Completion/Commands/_correct_word
+++ b/Completion/Commands/_correct_word
@@ -9,6 +9,10 @@
 
 local curcontext="$curcontext"
 
-[[ -z "$curcontext" ]] && curcontext=":correct-word"
+if [[ -z "$curcontext" ]]; then
+  curcontext="correct-word:::"
+else
+  curcontext="correct-word:${curcontext#*:}"
+fi
 
 _main_complete _correct
diff --git a/Completion/Commands/_expand_word b/Completion/Commands/_expand_word
index b4e22de48..ad334da9d 100644
--- a/Completion/Commands/_expand_word
+++ b/Completion/Commands/_expand_word
@@ -7,6 +7,10 @@
 
 local curcontext="$curcontext"
 
-[[ -z "$curcontext" ]] && curcontext=":expand-word"
+if [[ -z "$curcontext" ]]; then
+  curcontext="correct-word:::"
+else
+  curcontext="expand-word:${curcontext#*:}"
+fi
 
 _main_complete _expand
diff --git a/Completion/Commands/_history_complete_word b/Completion/Commands/_history_complete_word
index 7867189e8..cc1877911 100644
--- a/Completion/Commands/_history_complete_word
+++ b/Completion/Commands/_history_complete_word
@@ -25,9 +25,9 @@ _history_complete_word () {
     direction=older
   fi
 
-  zstyle -s ":completion${curcontext}:history-words" stop stop
+  zstyle -s ":completion:${curcontext}:history-words" stop stop
 
-  zstyle -t ":completion${curcontext}:history-words" list || compstate[list]=''
+  zstyle -t ":completion:${curcontext}:history-words" list || compstate[list]=''
 
   if [[ -n "$compstate[old_list]" &&
         ( -n "$stop" || "$compstate[insert]" = menu ) ]] ; then
@@ -67,14 +67,14 @@ _history_complete_word () {
 }
 
 _history_complete_word_gen_matches () {
-  if zstyle -t ":completion${curcontext}:history-words" list; then
-    if zstyle -t ":completion${curcontext}:history-words" sort; then
+  if zstyle -t ":completion:${curcontext}:history-words" list; then
+    if zstyle -t ":completion:${curcontext}:history-words" sort; then
       _description history-words expl 'history word'
     else
       _description -V history-words expl 'history word'
     fi
   else
-    if zstyle -t ":completion${curcontext}:history-words" sort; then
+    if zstyle -t ":completion:${curcontext}:history-words" sort; then
       expl=()
     else
       expl=('-V' '')
@@ -84,7 +84,7 @@ _history_complete_word_gen_matches () {
   [[ -n "$_hist_stop" ]] && PREFIX="$_hist_old_prefix"
 
   local rem_dups
-  if zstyle -t ":completion${curcontext}:history-words" remove-all-dups; then
+  if zstyle -t ":completion:${curcontext}:history-words" remove-all-dups; then
     rem_dups=''
   else
     rem_dups='-1'
diff --git a/Completion/Core/_alternative b/Completion/Core/_alternative
index 791d7517e..73292cb52 100644
--- a/Completion/Core/_alternative
+++ b/Completion/Core/_alternative
@@ -7,7 +7,7 @@ subopts=()
 while getopts 'O:C:' opt; do
   case "$opt" in
   O) subopts=( "${(@P)OPTARG}" ) ;;
-  C) curcontext="${curontext}:$OPTARG" ;;
+  C) curcontext="${curcontext%:*}:$OPTARG" ;;
   esac
 done
 
diff --git a/Completion/Core/_approximate b/Completion/Core/_approximate
index bb1faa7b3..283f30e83 100644
--- a/Completion/Core/_approximate
+++ b/Completion/Core/_approximate
@@ -16,11 +16,12 @@ local curcontext="${curcontext}" oldcontext
 
 [[ "${#:-$PREFIX$SUFFIX}" -le 1 ]] && return 1
 
-[[ "$curcontext" != *:correct* ]] && curcontext="${curcontext}:approximate"
+[[ "$curcontext" != [^:]#:correct:* ]] &&
+    curcontext="${curcontext/:[^:]#:/:approximate:}"
 
 oldcontext="$curcontext"
 
-zstyle -s ":completion${curcontext}:" max-errors cfgacc
+zstyle -s ":completion:${curcontext}:" max-errors cfgacc
 
 # Get the number of errors to accept.
 
@@ -73,18 +74,18 @@ compstate[matcher]=-1
 [[ -z "$compstate[pattern_match]" ]] && compstate[pattern_match]='*'
 
 while [[ _comp_correct -le comax ]]; do
-  curcontext="${oldcontext}:$_comp_correct"
+  curcontext="${oldcontext/(#b)([^:]#:[^:]#:)/${match[1][1,-2]}-${_comp_correct}:}"
 
   _description corrections _correct_expl corrections \
                "e:$_comp_correct" "o:$PREFIX$SUFFIX"
 
   if _complete; then
-    if zstyle -t ":completion${curcontext}:" 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 ]] ||
-           zstyle -t ":completion${curcontext}:" original ); then
+           zstyle -t ":completion:${curcontext}:" original ); then
       local expl
 
       _description -V original expl original
diff --git a/Completion/Core/_complete b/Completion/Core/_complete
index 00c5e1e9a..d589c1707 100644
--- a/Completion/Core/_complete
+++ b/Completion/Core/_complete
@@ -4,16 +4,17 @@
 # a normal completion function, but as one possible value for the
 # completer style.
 
-local comp name curcontext="$curcontext" oldcontext
+local comp name oldcontext
+typeset -T curcontext="$curcontext" ccarray
 
-[[ "$funcstack[2]" = _main_complete ]] && curcontext="${curcontext}:complete"
+ccarray[2]=complete
 
 oldcontext="$curcontext"
 
 # If we have a user-supplied context name, use only that.
 
 if [[ -n "$compcontext" ]]; then
-  curcontext="${curcontext}:$compcontext"
+  ccarray[3]="$compcontext"
 
   comp="$_comps[$compcontext]"
   [[ -z "$comp" ]] || "$comp"
@@ -25,7 +26,7 @@ fi
 
 comp="$_comps[-first-]"
 if [[ ! -z "$comp" ]]; then
-  curcontext="${curcontext}:-first-"
+  ccarray[3]=-first-
   "$comp"
   if [[ "$_compskip" = all ]]; then
     _compskip=''
@@ -46,7 +47,7 @@ else
 
   local cname="-${compstate[context]:s/_/-/}-"
 
-  curcontext="${oldcontext}:$cname"
+  ccarray[3]="$cname"
 
   comp="$_comps[$cname]"
 
diff --git a/Completion/Core/_correct b/Completion/Core/_correct
index 35114ed22..76560dfb2 100644
--- a/Completion/Core/_correct
+++ b/Completion/Core/_correct
@@ -8,9 +8,8 @@
 # Supported configuration keys are the same as for `_approximate', only
 # starting with `correct'.
 
-local ret=1 opm="$compstate[pattern_match]" curcontext="${curcontext}"
-
-[[ "$curcontext" != :correct* ]] && curcontext="${curcontext}:correct"
+local ret=1 opm="$compstate[pattern_match]"
+local curcontext="${curcontext/:[^:]#:/:correct:}"
 
 compstate[pattern_match]='-'
 
diff --git a/Completion/Core/_description b/Completion/Core/_description
index ffe016df8..b35889c4d 100644
--- a/Completion/Core/_description
+++ b/Completion/Core/_description
@@ -18,19 +18,19 @@ _setup "$1"
 
 name="$2"
 
-zstyle -s ":completion${curcontext}:$1" format format ||
-    zstyle -s ":completion${curcontext}:descriptions" format format
+zstyle -s ":completion:${curcontext}:$1" format format ||
+    zstyle -s ":completion:${curcontext}:descriptions" format format
 
-zstyle -s ":completion${curcontext}:$1" hidden hidden
+zstyle -s ":completion:${curcontext}:$1" hidden hidden
 if [[ "$hidden" = (all|yes|true|1|on) ]]; then
   [[ "$hidden" = all ]] && format=''
   hide=(-n)
 fi
-zstyle -s ":completion${curcontext}:$1" group-name gname &&
+zstyle -s ":completion:${curcontext}:$1" group-name gname &&
     [[ -z "$gname" ]] && gname="$1"
-zstyle -s ":completion${curcontext}:$1" matcher match &&
+zstyle -s ":completion:${curcontext}:$1" matcher match &&
     match=(-M "${(q)match}")
-if zstyle -a ":completion${curcontext}:$1" ignored-patterns _comp_ignore; then
+if zstyle -a ":completion:${curcontext}:$1" ignored-patterns _comp_ignore; then
   ign=(-F _comp_ignore)
 else
   _comp_ignore=()
diff --git a/Completion/Core/_expand b/Completion/Core/_expand
index cdfc2a8d1..b1609ad40 100644
--- a/Completion/Core/_expand
+++ b/Completion/Core/_expand
@@ -7,13 +7,12 @@
 # the expansions done produce no result or do not change the original
 # word from the line.
 
-local exp word="$PREFIX$SUFFIX" sort expr expl curcontext="${curcontext}"
-
-[[ "$curcontext" != :expand* ]] && curcontext="${curcontext}:expand"
+local exp word="$PREFIX$SUFFIX" sort expr expl
+local curcontext="${curcontext/:[^:]#:/:expand:}"
 
 # First, see if we should insert all *completions*.
 
-if zstyle -s ":completion${curcontext}:" completions expr &&
+if zstyle -s ":completion:${curcontext}:" completions expr &&
    [[ "${(e):-\$[$expr]}" -eq 1 ]]; then
   compstate[insert]=all
   return 1
@@ -30,7 +29,7 @@ exp=("$word")
 # First try substitution. That weird thing spanning multiple lines
 # changes quoted spaces, tabs, and newlines into spaces.
 
-zstyle -s ":completion${curcontext}:" substitute expr &&
+zstyle -s ":completion:${curcontext}:" substitute expr &&
     [[ "${(e):-\$[$expr]}" -eq 1 ]] &&
     exp=( "${(e)exp//\\[ 	
 ]/ }" )
@@ -41,7 +40,7 @@ zstyle -s ":completion${curcontext}:" substitute expr &&
 
 # Now try globbing.
 
-zstyle -s ":completion${curcontext}:" glob expr &&
+zstyle -s ":completion:${curcontext}:" glob expr &&
     [[ "${(e):-\$[$expr]}" -eq 1 ]] &&
     exp=( ${~exp}(N) )
 
@@ -53,7 +52,7 @@ zstyle -s ":completion${curcontext}:" glob expr &&
 
 # Now add as matches whatever the user requested.
 
-zstyle -s ":completion${curcontext}:" sort sort
+zstyle -s ":completion:${curcontext}:" sort sort
 
 [[ "$sort" = (yes|true|1|on) ]] && exp=( "${(@o)exp}" )
 
diff --git a/Completion/Core/_files b/Completion/Core/_files
index f7ce74d80..cd337713a 100644
--- a/Completion/Core/_files
+++ b/Completion/Core/_files
@@ -25,11 +25,11 @@ if [[ "$group[2]" = files ]]; then
   group=()
 fi
 
-if zstyle -s ":completion${curcontext}:all-files" file-patterns tmp &&
+if zstyle -s ":completion:${curcontext}:all-files" file-patterns tmp &&
    [[ -n "$tmp" ]]; then
   aopts=(-g "$tmp")
 fi
-if zstyle -s ":completion${curcontext}:directories" file-patterns tmp &&
+if zstyle -s ":completion:${curcontext}:directories" file-patterns tmp &&
    [[ -n "$tmp" ]]; then
   dopts=(-g "$tmp")
   if [[ "$type" = (*dir*glob*|*glob*dir*) ]]; then
@@ -38,7 +38,7 @@ if zstyle -s ":completion${curcontext}:directories" file-patterns tmp &&
     type="${type}dir"
   fi
 fi
-if zstyle -s ":completion${curcontext}:globbed-files" file-patterns tmp &&
+if zstyle -s ":completion:${curcontext}:globbed-files" file-patterns tmp &&
    [[ -n "$tmp" ]]; then
   gopts=(-g "$tmp")
   if [[ "$type" != (*dir*glob*|*glob*dir*) ]]; then
@@ -64,7 +64,7 @@ while _tags; do
       group[2]=all-files
       _setup all-files
       [[ -z "$hasign" ]] &&
-        zstyle -a ":completion${curcontext}:all-files" ignored-patterns _comp_ignore &&
+        zstyle -a ":completion:${curcontext}:all-files" ignored-patterns _comp_ignore &&
 	  ign=(-F _comp_ignore)
     fi
     _path_files "$opts[@]" "$ign[@]" "$aopts[@]"
@@ -75,7 +75,7 @@ while _tags; do
         group[2]=globbed-files
 	_setup globbed-files
         [[ -z "$hasign" ]] &&
-          zstyle -a ":completion${curcontext}:all-files" ignored-patterns _comp_ignore &&
+          zstyle -a ":completion:${curcontext}:all-files" ignored-patterns _comp_ignore &&
 	    ign=(-F _comp_ignore)
       fi
       _path_files "$opts[@]" "$ign[@]" "$dopts[@]" "$gopts[@]" && return 0
@@ -84,7 +84,7 @@ while _tags; do
         group[2]=directories
 	_setup directories
         [[ -z "$hasign" ]] &&
-          zstyle -a ":completion${curcontext}:all-files" ignored-patterns _comp_ignore &&
+          zstyle -a ":completion:${curcontext}:all-files" ignored-patterns _comp_ignore &&
 	    ign=(-F _comp_ignore)
       fi
       _path_files "$opts[@]" "$ign[@]" "$dopts[@]" && return 0
@@ -94,7 +94,7 @@ while _tags; do
       group[2]=globbed-files
       _setup globbed-files
       [[ -z "$hasign" ]] &&
-        zstyle -a ":completion${curcontext}:all-files" ignored-patterns _comp_ignore &&
+        zstyle -a ":completion:${curcontext}:all-files" ignored-patterns _comp_ignore &&
 	  ign=(-F _comp_ignore)
     fi
     if [[ "$type" = (*dir*glob*|*glob*dir*) ]]; then
diff --git a/Completion/Core/_list b/Completion/Core/_list
index 294467eca..597d173ad 100644
--- a/Completion/Core/_list
+++ b/Completion/Core/_list
@@ -4,11 +4,11 @@
 # insert possible completions only after the list has been shown at
 # least once.
 
-local pre suf curcontext="${curcontext}:list" expr
+local pre suf expr curcontext="${curcontext/:[^:]#:/:list:}"
 
 # Get the strings to compare.
 
-if zstyle -t ":completion${curcontext}:" 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?
 
-zstyle -s ":completion${curcontext}:" 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 09feae10f..ebe256588 100644
--- a/Completion/Core/_main_complete
+++ b/Completion/Core/_main_complete
@@ -35,6 +35,8 @@ _failed_tags=()
 
 typeset -U _lastdescr
 
+[[ -z "$curcontext" ]] && curcontext=:::
+
 # Special completion contexts after `~' and `='.
 
 if compset -P 1 '='; then
@@ -55,7 +57,7 @@ _last_menu_style=()
 if (( ! $# )); then
   local tmp
 
-  zstyle -a ":completion${curcontext}:" completer tmp
+  zstyle -a ":completion:${curcontext}:" completer tmp
   set -- "$tmp[@]"
 fi
 
@@ -123,7 +125,7 @@ if (( $compstate[nmatches] )); then
   fi
 elif [[ compstate[matcher] -eq compstate[total_matchers] &&
         $#_lastdescr -ne 0 ]] &&
-     zstyle -s ":completion${curcontext}:warnings" format format; then
+     zstyle -s ":completion:${curcontext}:warnings" format format; then
   local str
 
   _lastdescr=( "\`${(@)^_lastdescr:#}'" )
diff --git a/Completion/Core/_match b/Completion/Core/_match
index b7075b715..42416242d 100644
--- a/Completion/Core/_match
+++ b/Completion/Core/_match
@@ -1,7 +1,7 @@
 #autoload
 
 # This is intended to be used as a completer function after the normal
-# completer as in: `zstyle ":completion:*" completer _complete _match'.
+# completer as in: `zstyle ":completion:::::" completer _complete _match'.
 # It temporarily switches on pattern matching, allowing you to try 
 # completion on patterns without having to setopt glob_complete.
 #
@@ -10,7 +10,7 @@
 # be expanded using globbing.
 
 local tmp opm="$compstate[pattern_match]" ret=0 orig ins
-local curcontext="${curcontext}:match"
+local curcontext="${curcontext/:[^:]#:/:match:}"
 
 # Do nothing if we don't have a pattern or there are still global
 # match specifications to try.
@@ -19,8 +19,8 @@ tmp="${${:-$PREFIX$SUFFIX}#[~=]}"
 [[ "$tmp:q" = "$tmp" ||
    compstate[matcher] -ne compstate[total_matchers] ]] && return 1
 
-zstyle -s ":completion${curcontext}:" original orig
-zstyle -b ":completion${curcontext}:" 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/_menu b/Completion/Core/_menu
index 7f8035098..5ec1a1a55 100644
--- a/Completion/Core/_menu
+++ b/Completion/Core/_menu
@@ -1,12 +1,12 @@
 #autoload
 
-local curcontext="${curcontext}:menu"
+local curcontext="${curcontext/:[^:]#:/:menu:}"
 
 # This completer is an example showing how menucompletion can be
 # implemented with the new completion system.
 # Use this one before the normal _complete completer, as in:
 #
-#   zstyle ":completion:*" completer _menu _complete
+#   zstyle ":completion:::::" completer _menu _complete
 
 if [[ -n "$compstate[old_list]" ]]; then
 
diff --git a/Completion/Core/_message b/Completion/Core/_message
index 8ae93f973..a6cb799e5 100644
--- a/Completion/Core/_message
+++ b/Completion/Core/_message
@@ -4,8 +4,8 @@ local format
 
 _tags messages || return 1
 
-zstyle -s ":completion${curcontext}:messages" format format ||
-    zstyle -s ":completion${curcontext}:descriptions" format format
+zstyle -s ":completion:${curcontext}:messages" format format ||
+    zstyle -s ":completion:${curcontext}:descriptions" format format
 
 if [[ -n "$format" ]]; then
   zformat -f format "$format" "d:$1" "${(@)argv[2,-1]}"
diff --git a/Completion/Core/_normal b/Completion/Core/_normal
index a9e1dc5e4..c3315610f 100644
--- a/Completion/Core/_normal
+++ b/Completion/Core/_normal
@@ -16,7 +16,7 @@ local curcontext="$curcontext"
 
 command="$words[1]"
 if [[ CURRENT -eq 1 ]]; then
-  curcontext="${curcontext}:-command-"
+  curcontext="${curcontext%:*:*}:-command-:"
 
   comp="$_comps[-command-]"
   [[ -z "$comp" ]] || "$comp" && ret=0
@@ -26,15 +26,15 @@ else
   if [[ "$command[1]" == '=' ]]; then
     eval cmd1\=$command
     cmd2="$command[2,-1]"
-    curcontext="${curcontext}::${cmd2}:"
+    curcontext="${curcontext%:*:*}:${cmd2}:"
   elif [[ "$command" == */* ]]; then
     cmd1="$command"
     cmd2="${command:t}"
-    curcontext="${curcontext}::${cmd2}:"
+    curcontext="${curcontext%:*:*}:${cmd2}:"
   else
     cmd1="$command"
     cmd2="$commands[$command]"
-    curcontext="${curcontext}::${cmd1}:"
+    curcontext="${curcontext%:*:*}:${cmd1}:"
   fi
 fi
 
diff --git a/Completion/Core/_oldlist b/Completion/Core/_oldlist
index b0092d586..450e3cb29 100644
--- a/Completion/Core/_oldlist
+++ b/Completion/Core/_oldlist
@@ -1,8 +1,8 @@
 #autoload
 
-local curcontext="${curcontext}:oldlist" list
+local curcontext="${curcontext/:[^:]#:/:oldlist:}" list
 
-zstyle -s ":completion${curcontext}:" 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'
@@ -34,7 +34,7 @@ fi
 if [[ -z $compstate[old_insert] && -n $compstate[old_list] ]]; then
   compstate[old_list]=keep
 elif [[ $WIDGET = *complete(|-prefix|-word) ]] &&
-     zstyle -t ":completion${curcontext}:" menu; then
+     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 cacf62cd7..a41f8d73a 100644
--- a/Completion/Core/_path_files
+++ b/Completion/Core/_path_files
@@ -82,7 +82,7 @@ while getopts "P:S:qr:R:W:F:J:V:X:f/g:M:12n" opt; do
 done
 
 if [[ -z "$_file_pat_checked" ]] &&
-   zstyle -s ":completion${curcontext}:files" file-patterns tmp1 &&
+   zstyle -s ":completion:${curcontext}:files" file-patterns tmp1 &&
    [[ -n "$tmp1" ]]; then
   if [[ "$tmp1" = '*(-/)' ]]; then
     gopt=''
@@ -126,7 +126,7 @@ if [[ "$sopt" = - ]]; then
   fi
 fi
 
-if zstyle -s ":completion${curcontext}:files" sort tmp1; then
+if zstyle -s ":completion:${curcontext}:files" sort tmp1; then
   case "$tmp1" in
   *size*)             sort=oL;;
   *links*)            sort=ol;;
@@ -159,7 +159,7 @@ fi
 
 # Skip over sequences of slashes.
 
-zstyle -t ":completion${curcontext}:paths" squeeze-slashes && skips=yes
+zstyle -t ":completion:${curcontext}:paths" squeeze-slashes && skips=yes
 
 # We get the prefix and the suffix from the line and save the whole
 # original string. Then we see if we will do menucompletion.
@@ -293,7 +293,7 @@ for prepath in "$prepaths[@]"; do
       [[ ! -o globdots && "$PREFIX" = .* ]] &&
           tmp2=( "$tmp2[@]" ${^tmp1}.*(-/) )
       if [[ -o globdots || "$PREFIX" = .* ]] &&
-         zstyle -s ":completion${curcontext}:paths" special-dirs atmp; then
+         zstyle -s ":completion:${curcontext}:paths" special-dirs atmp; then
 	if [[ "$atmp" = (yes|true|1|on) ]]; then
 	  tmp2=( "$tmp2[@]" . .. )
 	elif [[ "$atmp" = .. ]]; then
@@ -305,7 +305,7 @@ for prepath in "$prepaths[@]"; do
       [[ ! -o globdots && "$PREFIX" = .* ]] &&
           tmp2=( "$tmp2[@]" ${^tmp1}.${^~pats} )
       if (( $#tmp2 )) &&
-         zstyle -s ":completion${curcontext}:files" ignore-parents rem &&
+         zstyle -s ":completion:${curcontext}:files" ignore-parents rem &&
 	 [[ ( "$rem" != *dir* || "$pats" = '*(-/)' ) &&
 	    ( "$rem" != *..* || "$tmp1" = *../* ) ]]; then
         if [[ "$rem" = *parent* ]]; then
@@ -330,7 +330,7 @@ for prepath in "$prepaths[@]"; do
            expl=( "$expl[@]" -F _comp_ignore )
       fi
       if [[ "$sopt" = *[/f]* && ( -o globdots || "$PREFIX" = .* ) ]] &&
-	  zstyle -s ":completion${curcontext}:paths" special-dirs atmp; then
+	  zstyle -s ":completion:${curcontext}:paths" special-dirs atmp; then
 	if [[ "$atmp" = (yes|true|1|on) ]]; then
 	  tmp2=( "$tmp2[@]" . .. )
 	elif [[ "$atmp" = .. ]]; then
@@ -465,8 +465,8 @@ for prepath in "$prepaths[@]"; do
       compquote tmp1 tmp2
 
       if [[ -n $menu ]] ||
-         ! zstyle -t ":completion${curcontext}:paths" expand suffix; then
-        (( $#tmp4 )) && zstyle -t ":completion${curcontext}:paths" cursor &&
+         ! zstyle -t ":completion:${curcontext}:paths" expand suffix; then
+        (( $#tmp4 )) && zstyle -t ":completion:${curcontext}:paths" cursor &&
             compstate[to_end]=''
         if [[ "$tmp3" = */* ]]; then
 	  compadd -Qf "$mopts[@]" -p "$linepath$tmp2" -s "/${tmp3#*/}" \
@@ -555,7 +555,7 @@ done
 
 exppaths=( "${(@)exppaths:#$eorig}" )
 
-if zstyle -t ":completion${curcontext}: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/_setup b/Completion/Core/_setup
index 4054f5ecc..b3b2bdb33 100644
--- a/Completion/Core/_setup
+++ b/Completion/Core/_setup
@@ -2,7 +2,7 @@
 
 local val nm="$compstate[nmatches]"
 
-if zstyle -a ":completion${curcontext}:$1" list-colors val; then
+if zstyle -a ":completion:${curcontext}:$1" list-colors val; then
   zmodload -e zsh/complist || zmodload -i zsh/complist
   if [[ "$1" = default ]]; then
     ZLS_COLORS="${(j.:.)${(@)val:gs/:/\\\:}}"
@@ -11,7 +11,7 @@ if zstyle -a ":completion${curcontext}:$1" list-colors val; then
   fi
 fi
 
-if zstyle -s ":completion${curcontext}:$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
@@ -21,7 +21,7 @@ else
   compstate[list]="$_saved_list"
 fi
 
-if zstyle -s ":completion${curcontext}:$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
@@ -31,7 +31,7 @@ else
   compstate[list]="$_saved_list"
 fi
 
-if zstyle -s ":completion${curcontext}:$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
@@ -41,7 +41,7 @@ else
   compstate[last_prompt]="$_saved_lastprompt"
 fi
 
-if zstyle -s ":completion${curcontext}:$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
@@ -54,7 +54,7 @@ fi
 [[ _last_nmatches -ge 0 && _last_nmatches -ne nm ]] &&
     _menu_style=( "$_last_menu_style[@]" "$_menu_style[@]" )
 
-if zstyle -a ":completion${curcontext}:$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/_sort_tags b/Completion/Core/_sort_tags
index 6f07eec1c..778a6000b 100644
--- a/Completion/Core/_sort_tags
+++ b/Completion/Core/_sort_tags
@@ -6,15 +6,15 @@ comptry options
 case "$curcontext" in
 # Some silly examples commented out:
 #
-# *::*p[bgpn]m:*)           # change the order for file-completion
+# *:*:*:*p[bgpn]m:*)           # change the order for file-completion
 #   comptry globbed-files directories
 #   comptry all-files
 #   ;;
-# *::dvips::-o*)            # automatic context set by _arguments
+# *:*:*:dvips:-o*)            # automatic context set by _arguments
 #   comptry all-files
 #   return
 #   ;;
-# *::kill:*)
+# *:*:*:kill:*)
 #   comptry processes
 #   return                  # this return ensures that we use only processes
 #   ;;
diff --git a/Completion/Core/_tags b/Completion/Core/_tags
index 208ec32b1..d2d5555fa 100644
--- a/Completion/Core/_tags
+++ b/Completion/Core/_tags
@@ -7,10 +7,10 @@ if (( $# )); then
   local curcontext="$curcontext" order tag nodef
 
   if [[ "$1" = -C?* ]]; then
-    curcontext="${curcontext}:${1[3,-1]}"
+    curcontext="${curcontext%:*}:${1[3,-1]}"
     shift
   elif [[ "$1" = -C ]]; then
-    curcontext="${curcontext}:${2}"
+    curcontext="${curcontext%:*}:${2}"
     shift 2
   else
     targs=()
@@ -18,7 +18,7 @@ if (( $# )); then
 
   [[ "$1" = -(|-) ]] && shift
 
-  if zstyle -a ":completion${curcontext}" group-order order; then
+  if zstyle -a ":completion:${curcontext}:" group-order order; then
     local name
 
     for name in "$order[@]"; do
@@ -42,7 +42,7 @@ if (( $# )); then
 
   if [[ -n "$_sort_tags" ]]; then
     "$_sort_tags" "$@"
-  elif zstyle -a ":completion${curcontext}" tag-order order; then
+  elif zstyle -a ":completion:${curcontext}:" tag-order order; then
 
     for tag in $order; do
       case $tag in
diff --git a/Completion/Core/compinit b/Completion/Core/compinit
index bfb697279..cd9ec7c2f 100644
--- a/Completion/Core/compinit
+++ b/Completion/Core/compinit
@@ -475,11 +475,11 @@ compstyle() {
 zstyle ':completion:*'                      verbose       'yes'
 zstyle ':completion:*'                      prefix-needed 'yes'
 zstyle ':completion:*'                      prefix-hidden 'no'
-zstyle ':completion:(correct|approximate):' max-errors    '2' numeric
-zstyle ':completion:correct:'               prompt        'correct to:'
-zstyle ':completion:*'                      completer     '_complete'
-zstyle ':completion*:default'               list-colors   "${(s.:.)ZLS_COLORS:-${ZLS_COLOURS:-no=0:fi=0:di=0:ln=0:pi=0:so=0:bd=0:cd=0:ex=0}}"
-(( $+SELECTMIN )) && zstyle ':completion*:default' menu "select=$SELECTMIN"
+zstyle ':completion:*:(correct|approximate):*' max-errors    '2' numeric
+zstyle ':completion:*:correct:*'               prompt        'correct to:'
+zstyle ':completion:*::::'                      completer     '_complete'
+zstyle ':completion:*::::default'               list-colors   "${(s.:.)ZLS_COLORS:-${ZLS_COLOURS:-no=0:fi=0:di=0:ln=0:pi=0:so=0:bd=0:cd=0:ex=0}}"
+(( $+SELECTMIN )) && zstyle ':completion:*::::default' menu "select=$SELECTMIN"
 zstyle ':completion:*' tag-order 'arguments values' options \
                                  globbed-files directories all-files
 
diff --git a/Completion/Debian/_apt b/Completion/Debian/_apt
index ebb455e76..60b8d51d6 100644
--- a/Completion/Debian/_apt
+++ b/Completion/Debian/_apt
@@ -106,7 +106,7 @@ tmp2=("$tmp2[@]" $_ra_left${(M)^short_bool:#$~tmp1} $_ra_left${(M)^short_intleve
 tmp3=("$tmp3[@]" $_ra_left${(M)^short_hasarg:#$~tmp1} $_ra_left${(M)^short_configfile:#$~tmp1} $_ra_left${(M)^short_arbitem:#$~tmp1})
 _describe -o option tmp2 -- tmp3 -S='
 
-  comp_opt='{ ! zstyle -t ":completion${curcontext}:options" prefix-needed || [[ "$PREFIX" = -* ]] }'" && { $comp_short; $comp_long }"
+  comp_opt='{ ! zstyle -t ":completion:${curcontext}:options" prefix-needed || [[ "$PREFIX" = -* ]] }'" && { $comp_short; $comp_long }"
 
   regex_short=()
   regex_long=()
diff --git a/Completion/Debian/_deb_packages b/Completion/Debian/_deb_packages
index 9df52eab6..94499cbdb 100644
--- a/Completion/Debian/_deb_packages
+++ b/Completion/Debian/_deb_packages
@@ -39,7 +39,7 @@ _deb_packages () {
     return
   }
 
-  zstyle -s ":completion${curcontext}" packageset pkgset
+  zstyle -s ":completion:${curcontext}:" packageset pkgset
 
   [[ "$pkgset" = (installed|uninstalled|avail|available) ]] || {
     pkgset="$command"
diff --git a/Completion/User/_cvs b/Completion/User/_cvs
index 1a1a40b0f..15eb6b872 100644
--- a/Completion/User/_cvs
+++ b/Completion/User/_cvs
@@ -40,7 +40,7 @@ _cvs_command () {
 
     cmd="${${(k)cmds[(R)* $words[1] *]}:-${(k)cmds[(i)$words[1]]}}"
     if (( $#cmd )); then
-      curcontext="${curcontext%:*}:$cmd"
+      curcontext="${curcontext%:*:*}:cvs-${cmd}:"
       _cvs_$cmd
     else
       _message "unknown cvs command: $words[1]"
@@ -390,7 +390,7 @@ _cvs_watchers () {
 
 (( $+functions[_cvs_loadstat] )) ||
 _cvs_loadstat () {
-  zstyle -t ":completion${curcontext}:cvs" disable-stat && return
+  zstyle -t ":completion:${curcontext}:" disable-stat && return
   (( $+_cvs_loadstat_tried )) && return
   _cvs_loadstat_tried=yes
 
diff --git a/Completion/User/_domains b/Completion/User/_domains
index a27f6f34a..cf7e9befe 100644
--- a/Completion/User/_domains
+++ b/Completion/User/_domains
@@ -2,7 +2,7 @@
 
 local expl domains tmp
 
-if ! zstyle -a ":completion${curcontext}:domains" domains domains; then
+if ! zstyle -a ":completion:${curcontext}:domains" domains domains; then
   if (( ! $+_cache_domains )); then
     _cache_domains=()
     if [[ -f /etc/resolv.conf ]]; then
diff --git a/Completion/User/_groups b/Completion/User/_groups
index fbd884688..051bb829a 100644
--- a/Completion/User/_groups
+++ b/Completion/User/_groups
@@ -4,7 +4,7 @@ local expl groups
 
 _wanted groups expl group || return 1
 
-if ! zstyle -a ":completion${curcontext}:groups" groups groups; then
+if ! zstyle -a ":completion:${curcontext}:groups" groups groups; then
   (( $+_cache_groups )) ||
       if (( ${+commands[ypcat]} )); then
         : ${(A)_cache_groups:=${${(s: :)$(ypcat group.byname)}%%:*}} # If you use YP
diff --git a/Completion/User/_hosts b/Completion/User/_hosts
index 6078514b6..cab65329c 100644
--- a/Completion/User/_hosts
+++ b/Completion/User/_hosts
@@ -2,7 +2,7 @@
 
 local expl hosts
 
-if ! zstyle -a ":completion${curcontext}:hosts" hosts hosts; then
+if ! zstyle -a ":completion:${curcontext}:hosts" hosts hosts; then
   (( $+_cache_hosts )) ||
       : ${(A)_cache_hosts:=${(s: :)${(ps:\t:)${${(f)~~"$(</etc/hosts)"}%%\#*}##[:blank:]#[^[:blank:]]#}}}
 
diff --git a/Completion/User/_ports b/Completion/User/_ports
index 07428fe75..8cf90a913 100644
--- a/Completion/User/_ports
+++ b/Completion/User/_ports
@@ -2,7 +2,7 @@
 
 local expl ports
 
-if ! zstyle -a ":completion${curcontext}:ports" ports ports; then
+if ! zstyle -a ":completion:${curcontext}:ports" ports ports; then
   (( $+_cache_ports )) ||
       : ${(A)_cache_ports:=${${(M)${${(f)"$(</etc/services)"}:#\#*}#*/tcp}%%[ 	]*}}
 
diff --git a/Completion/User/_socket b/Completion/User/_socket
index d6a8b7af7..bb9ee2a67 100644
--- a/Completion/User/_socket
+++ b/Completion/User/_socket
@@ -9,7 +9,7 @@ local curcontext="$curcontext" state line expl
 typeset -A opt_args
 
 [[ $CURRENT -eq 2 ]] && _wanted options expl option &&
-    { ! zstyle -t ":completion${curcontext}:options" prefix-needed ||
+    { ! zstyle -t ":completion:${curcontext}:options" prefix-needed ||
       [[ "$PREFIX" = -* ]] } &&
     compadd -M 'r:|[_-]=* r:|=*' "$expl[@]" - -version
 
diff --git a/Completion/User/_urls b/Completion/User/_urls
index d8a6f06f5..3f2cab789 100644
--- a/Completion/User/_urls
+++ b/Completion/User/_urls
@@ -40,9 +40,9 @@
 
 local ipre scheme host user uhosts ret=1 expl
 local urls_path localhttp
-zstyle -s ":completion${curcontext}:urls" path urls_path ||
+zstyle -s ":completion:${curcontext}:urls" path urls_path ||
     urls_path="${ZDOTDIR:-$HOME}/.zsh/urls"
-zstyle -a ":completion${curcontext}:urls" local localhttp
+zstyle -a ":completion:${curcontext}:urls" local localhttp
 local localhttp_servername="$localhttp[1]"
 local localhttp_documentroot="$localhttp[2]"
 local localhttp_userdir="$localhttp[3]"
diff --git a/Completion/User/_users b/Completion/User/_users
index 45ed0f89d..1df724208 100644
--- a/Completion/User/_users
+++ b/Completion/User/_users
@@ -7,7 +7,7 @@ local expl users
 
 _wanted users expl user || return 1
 
-zstyle -a ":completion${curcontext}:users" users users &&
+zstyle -a ":completion:${curcontext}:users" users users &&
     compadd "$expl[@]" "$@" - "$users[@]" && return 0
 
 compadd "$@" "$expl[@]" - "${(@k)userdirs}"
diff --git a/Completion/X/_x_color b/Completion/X/_x_color
index 592667c40..43f8ad5cd 100644
--- a/Completion/X/_x_color
+++ b/Completion/X/_x_color
@@ -15,7 +15,7 @@ if (( ! $+_color_cache )); then
 
   # Cache of color names doesn't exist yet, create it.
 
-  zstyle -s ":completion${curcontext}:colors" path file
+  zstyle -s ":completion:${curcontext}:colors" path file
   if [[ -n "$file" ]]; then
     _color_cache=( "${(@)${(@f)$(< $file)}[2,-1]##*		}" )
   else