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/_alternative25
-rw-r--r--Completion/Core/_complete7
-rw-r--r--Completion/Core/_files16
-rw-r--r--Completion/Core/_main_complete5
-rw-r--r--Completion/Core/_message2
-rw-r--r--Completion/Core/_normal1
-rw-r--r--Completion/Core/_options2
-rw-r--r--Completion/Core/_parameters2
-rw-r--r--Completion/Core/_requested10
-rw-r--r--Completion/Core/_set_options2
-rw-r--r--Completion/Core/_sort_tags28
-rw-r--r--Completion/Core/_style55
-rw-r--r--Completion/Core/_tags123
-rw-r--r--Completion/Core/_unset_options2
-rw-r--r--Completion/Core/compinit266
15 files changed, 208 insertions, 338 deletions
diff --git a/Completion/Core/_alternative b/Completion/Core/_alternative
index 158f3a07a..f13fc9e5a 100644
--- a/Completion/Core/_alternative
+++ b/Completion/Core/_alternative
@@ -1,19 +1,22 @@
 #autoload
 
-local tags def expl descr action mesgs nm="$compstack[nmatches]"
-local context
+local tags def expl descr action mesgs nm="$compstack[nmatches]" subopts
 
-if [[ "$1" = -C?* ]]; then
-  context="${1[3,-1]}"
+if [[ "$1" = -O?* ]]; then
+  subopts=( "${(@P)1[3,-1]}" )
   shift
-elif [[ "$1" = -C ]]; then
-  context="$2"
+elif [[ "$1" = -O ]]; then
+  subopts=( "${(@P)2}" )
   shift 2
-fi
+else
+  subopts=()
+fi  
+
+[[ "$1" = -(|-) ]] && shift
 
 mesgs=()
 
-_tags -C "$context" "${(@)argv%%:*}"
+_tags "$1" "${(@)argv[2,-1]%%:*}"
 
 while _tags; do
   for def; do
@@ -35,12 +38,12 @@ while _tags; do
 
         eval ws\=\( "${action[3,-3]}" \)
 
-        _describe "$descr" ws -M 'r:|[_-]=* r:|=*'
+        _describe "$descr" ws -M 'r:|[_-]=* r:|=*' "$subopts[@]"
       elif [[ "$action" = \(*\) ]]; then
 
         # Anything inside `(...)' is added directly.
 
-        compadd "$expl[@]" - ${=action[2,-2]}
+        compadd "$subopts[@]" "$expl[@]" - ${=action[2,-2]}
       elif [[ "$action" = \{*\} ]]; then
 
         # A string in braces is evaluated.
@@ -56,7 +59,7 @@ while _tags; do
         # Otherwise we call it with the description-arguments built above.
 
         action=( $=action )
-        ${(e)action[1]} "$expl[@]" ${(e)~action[2,-1]}
+        ${(e)action[1]} "$subopts[@]" "$expl[@]" ${(e)~action[2,-1]}
       fi
     fi
   done
diff --git a/Completion/Core/_complete b/Completion/Core/_complete
index 073212d0f..f351c7349 100644
--- a/Completion/Core/_complete
+++ b/Completion/Core/_complete
@@ -4,7 +4,10 @@
 # a normal completion function, but as one possible value for the
 # compconfig[completer] parameter.
 
-local comp name
+local comp name _tag_context="$_tag_context"
+
+[[ "$compstate[context]" != command || CURRENT -eq 1 ]] && 
+    _tag_context="-${compstate[context]:s/_/-/}-"
 
 # If we have a user-supplied context name, use only that.
 
@@ -36,7 +39,7 @@ else
   # Let's see if we have a special completion definition for the other
   # possible contexts.
 
-  comp="$_comps[-${compstate[context]:s/_/-/}-]"
+  comp="$_comps[$_tag_context]"
 
   # If not, we use default completion, if any.
 
diff --git a/Completion/Core/_files b/Completion/Core/_files
index eb1ec3559..973eea69b 100644
--- a/Completion/Core/_files
+++ b/Completion/Core/_files
@@ -13,22 +13,22 @@ while getopts "P:S:qr:R:W:F:J:V:X:f/g:M:" opt; do
 done
 
 case "$type" in
-file) _tags file           ;;
-dir)  _tags path file      ;;
-*)    _tags glob path file ;;
+file) _tags any all-files                           ;;
+dir)  _tags any directories all-files               ;;
+*)    _tags any globbed-files directories all-files ;;
 esac
 
 while _tags; do
-  if _requested file; then
+  if _requested all-files; then
     _path_files "$opts[@]" -f
     return
-  elif _requested path; then
-    if _requested glob; then
+  elif _requested directories; then
+    if _requested globbed-files; then
       _path_files "$opts[@]" -/g "$type" && return 0
     else
-      _path_files "$opts[@]" -/g "$type" && return 0
+      _path_files "$opts[@]" -/ && return 0
     fi
-  elif _requested glob; then
+  elif _requested globbed-files; then
     _path_files "$opts[@]" -g "$type" && return 0
   fi
 done
diff --git a/Completion/Core/_main_complete b/Completion/Core/_main_complete
index e4ee2879b..f9a8a19ad 100644
--- a/Completion/Core/_main_complete
+++ b/Completion/Core/_main_complete
@@ -17,9 +17,10 @@
 # state than the global one for which you are completing.
 
 
-local comp post ret=1 _compskip _prio_num=1
+local comp post ret=1 _compskip _prio_num=1 _tag_context _cur_contexts
+local context state line opt_args val_args
 typeset -U _offered_tags _tried_tags _failed_tags _used_tags _unused_tags
-typeset -A _prio_names _cur_tags
+typeset -A _prio_names _prio_contexts _cur_tags _tag_contexts
 
 _offered_tags=()
 _tried_tags=()
diff --git a/Completion/Core/_message b/Completion/Core/_message
index ab1c67992..ee869d33b 100644
--- a/Completion/Core/_message
+++ b/Completion/Core/_message
@@ -2,6 +2,8 @@
 
 local format
 
+_tags any messages || return 1
+
 format="${compconfig[message_format]:-$compconfig[description_format]}"
 
 if [[ -n "$format" ]]; then
diff --git a/Completion/Core/_normal b/Completion/Core/_normal
index 79efaeb97..5d0a18406 100644
--- a/Completion/Core/_normal
+++ b/Completion/Core/_normal
@@ -1,6 +1,7 @@
 #autoload
 
 local comp command cmd1 cmd2 pat val name i ret=1 _compskip="$_compskip"
+local _sub_context
 
 # If we get the option `-s', we don't reset `_compskip'. This ensures
 # that a value set in the function for the `-first-' context is kept,
diff --git a/Completion/Core/_options b/Completion/Core/_options
index 0232db857..0dd92cf69 100644
--- a/Completion/Core/_options
+++ b/Completion/Core/_options
@@ -4,6 +4,8 @@
 
 local expl
 
+_tags any zsh-options || return 1
+
 _description expl 'zsh option'
 compadd "$expl[@]" "$@" -M 'L:|[nN][oO]= M:_= M:{A-Z}={a-z}' - \
     "${(@k)options}"
diff --git a/Completion/Core/_parameters b/Completion/Core/_parameters
index fdb786231..da479097e 100644
--- a/Completion/Core/_parameters
+++ b/Completion/Core/_parameters
@@ -5,6 +5,8 @@
 
 local pars expl
 
+_tags any parameters || return 1
+
 _description expl parameter
 
 pars=( ${(k)parameters[(R)^*local*]} )
diff --git a/Completion/Core/_requested b/Completion/Core/_requested
index 082c45820..09c57ee09 100644
--- a/Completion/Core/_requested
+++ b/Completion/Core/_requested
@@ -1,9 +1,9 @@
 #autoload
 
-local tag tname="$funcstack[2,-1]"
+# Reset the current context.
 
-for tag; do
-  [[ "${_cur_tags[${tname}]}" = *:${tag}(:|\[*\]:)* ]] && return 0
-done
+_cur_contexts="${_tag_contexts[$tname]}"
 
-return 1
+# Test if the tag given as argument was requested.
+
+[[ "${_cur_tags[${funcstack[2,-1]}]}" = *:${1}:* ]]
diff --git a/Completion/Core/_set_options b/Completion/Core/_set_options
index 947afdeae..55388d0c8 100644
--- a/Completion/Core/_set_options
+++ b/Completion/Core/_set_options
@@ -6,5 +6,7 @@
 
 local expl
 
+_tags any zsh-options || return 1
+
 _description expl 'set zsh option'
 compadd "$expl[@]" "$@" -M 'L:|[nN][oO]= M:_= M:{A-Z}={a-z}' - $=_set_options
diff --git a/Completion/Core/_sort_tags b/Completion/Core/_sort_tags
new file mode 100644
index 000000000..f1740511d
--- /dev/null
+++ b/Completion/Core/_sort_tags
@@ -0,0 +1,28 @@
+#autoload
+
+comptry arguments values
+comptry options
+
+case "$contexts" in
+# Some silly examples commented out:
+#
+# *p[bgpn]m*)           # change the order for file-completion
+#   comptry globbed-files directories
+#   comptry all-files
+#   ;;
+# *:dvips,-o*)          # automatic context set by _arguments
+#   comptry all-files
+#   return
+#   ;;
+# *:kill,*)
+#   comptry processes
+#   return              # this return ensures that we use only processes
+#   ;;
+*)
+  comptry globbed-files
+  comptry directories
+  comptry all-files
+  ;;
+esac
+
+comptry "$@"
diff --git a/Completion/Core/_style b/Completion/Core/_style
index b0cbd7b00..a3b54686f 100644
--- a/Completion/Core/_style
+++ b/Completion/Core/_style
@@ -1,45 +1,50 @@
 #autoload
 
-local tags get i
+local all get val i
+
+# Should we return the value?
 
 if [[ "$1" = -g ]]; then
   get=yes
   shift
 fi
 
-if (( ${+_cur_tags[${funcstack[2,-1]}]} )); then
-  tags="${_cur_tags[${funcstack[2,-1]}]}"
-else
-  tags="${_cur_tags[${funcstack[3,-1]}]}"
-fi
+# Get all styles defined for this context.
 
-if [[ "$tags" = *:${1}\[*\]:* ]]; then
+all=()
+for i in "${(s.:.)_cur_contexts}"; do
+  all=("$all[@]" "${(@)_compstyles[(K)${i},${1}]}" )
+done
+all=":${(j.:.)${(@o)all:#}##??}:"
 
-  tags="${${tags#*:${1}\[}%%\]*}"
+if [[ "$all" = *:${2}[:\=]* ]]; then
 
-  if [[ $# -eq 2 ]]; then
-    if [[ -n "$get" ]]; then
-      eval "${2}=\"$tags\""
-      return 0
-    fi
+  # We have a definition for the style.
 
-    [[ "$tags" = (|*,)${2}(|,*) ]]
-    return
-  fi
+  if [[ $# -eq 3 ]]; then
+    if [[ -n "$get" ]]; then
 
-  [[ "$tags" = (|*,)${2}(|(\=|,)*) ]] || return 1
+      # We have to return the value.
 
-  if [[ -n "$get" ]]; then
-    if [[ "$tags" = (|*,)${2}\=* ]]; then
-      eval "${3}=\"${${tags#(|*,)${2}\=}%%,*}\""
+      if [[ "$all" = *,${2}\=* ]]; then
+        eval "${3}=\"${${all#*:${2}\=}%%:*}\""
+      else
+        eval "${3}=''"
+      fi
     else
-      eval "${3}=''"
+
+      # We have to test the value.
+
+      if [[ "$all" = *:${2}\=* ]]; then
+        [[ "${${all#*:${2}\=}%%:*}" = ${~3} ]]
+      else
+        [[ '' -eq ${~3} ]]
+      fi
+
+      return
     fi
-    return 0
   fi
-
-  [[ "$tags" = (|*,)${2}\=(|[^,]#,)${3}(|,*) ]] 
-  return
+  return 0
 fi
 
 return 1
diff --git a/Completion/Core/_tags b/Completion/Core/_tags
index 7b1254325..5ed56df6e 100644
--- a/Completion/Core/_tags
+++ b/Completion/Core/_tags
@@ -1,84 +1,85 @@
 #autoload
 
+# We use the funcstack names to communicate to neighboring functions.
+
 local tname="$funcstack[2,-1]"
 
 if (( $# )); then
-  local cmd="$words[1]" defs i ttags tag pat style prio context opt
 
-  while getopts 'c:C:' opt; do
-    if [[ "$opt" = c ]]; then
-      cmd="$OPTARG"
-    else
-      context="$OPTARG"
-    fi
-  done
-  shift OPTIND-1
+  # We have arguments: the tags supported in this context.
+
+  local command="${_tag_context:-${words[1]}}" _tags contexts name
+
+  # We are given the `-c command-name' option.
+
+  if [[ "$1" = -c?* ]]; then
+    command="${1[3,-1]}"
+    shift
+  elif [[ "$1" = -c ]]; then
+    command="$2"
+    shift 2
+  fi
+
+  [[ "$1" = -(|-) ]] && shift
+
+  # Get the context names.
 
-  [[ -n "$context" ]] && context="/$context"
+  if [[ -n "$_sub_context" ]]; then
+    contexts="${1}:${_sub_context}"
+  else
+    contexts="${1}"
+  fi
+  contexts=":${command},${${contexts//::/:}//:/:${command},}:"
+  shift
 
-  defs=( "${(@M)argv:#${(kj:|:)~override_tags[(R)(|+*)]}}" )
-  (( $#defs )) && set -- "$defs[@]"
+  _tags=()
+
+  # Remember offered tags.
 
   _offered_tags=( "$_offered_tags[@]" "$@" )
   _last_tags=()
 
-  defs=()
-  for i; do
-    if [[ -n ${override_tags[$i]} && ${override_tags[$i]} != (\[|+\[)* ]]; then
-      if [[ ${override_tags[$i]} = *\[* ]]; then
-        prio=( "${i}:*=${override_tags[$i]#+}" )
-      else
-        prio=( "${i}:${(@v)^comptags[(I)(|*:)${i}(|:*)]}" )
-        (( $#prio )) || prio=( "${i}:${comptags[any]}" )
-        prio="${${${prio[(r)(|*:)\*=[^:]#\[*\](|:*)]}##(|*:)\*}%%:*}"
-        prio=( "${i}:*=${override_tags[$i]#+}${(M)prio%%\[*\]}" )
-      fi
-    else
-      prio=( "${i}:${(@v)^comptags[(I)(|*:)${i}(|:*)]}" )
-      (( $#prio )) || prio=( "${i}:${comptags[any]}" )
-    fi
-    defs=( "$defs[@]" "$prio[@]" )
-  done
-
-  ttags=()
-  for i in "$defs[@]"; do
-    tag="${i%%:*}"
-    for pat in "${(s.:.)i#*:}"; do
-      if [[ "$cmd$context" = ${~pat%%\=*} ]]; then
-        prio="${pat#*\=}"
-	[[ "$prio" = -* ]] && continue 2
-
-	if [[ "$prio" = *\[*\] ]]; then
-	  style="${(M)prio%%\[*}"
-	  prio="${prio%%\[*}"
-        else
-	  style=''
-        fi
-	[[ ${override_tags[$tag]} = (|+)\[* ]] &&
-	    style="${override_tags[$tag]#+}"
-
-	(( prio++ ))
-
-        ttags[$prio]="${ttags[$prio]}:${tag}${style}"
-        break
-      fi
-    done
-  done
-
-  prio="_prio_arr$(( _prio_num++ ))"
-  _prio_names[$tname]="$prio"
-  ttags=( "${(@)ttags:#}" )
-  eval "${prio}=( \"\$ttags[@]\" )"
-
-  return \!$#ttags
+  # Call the function that sorts the tags into sets.
+
+  "${_sort_tags:-_sort_tags}" "$@"
+
+  # The sets are reported in $_tags, one element per set. Remove 
+  # tags that weren't requested.
+
+  _tags=( "${(M@)_tags:#*:(${(j:|:)~argv}):*}" )
+
+  # Store the sets in a `hidden' array.
+
+  name="_prio_arr$(( _prio_num++ ))"
+  _prio_names[$tname]="$name"
+  eval "${name}=( \"\$_tags[@]\" )"
+
+  # Also store the context (used below and in _requested).
+
+  _cur_contexts="$contexts[2,-2]"
+  _tag_contexts[$tname]="$_cur_contexts"
+
+  # Return non-zero if at least one set of tags should be used.
+
+  return \!$#_tags
 fi
 
+# The other mode: switch to the next set of tags.
+
 local prios="$_prio_names[$tname]"
 
+# Reset the current context.
+
+_cur_contexts="${_tag_contexts[$tname]}"
+
 _failed_tags=( "$_failed_tags[@]" "$_last_tags" )
 
+# Return failure if no sets remaining.
+
 (( ${(P)#prios} )) || return 1
 
+# Otherwise get the next tags.
+
 _cur_tags[$tname]="${(@)${(@P)prios}[1]}:"
 
 _last_tags=( "${(@)${(@s.:.)${(@P)prios}[1]}:#}" )
diff --git a/Completion/Core/_unset_options b/Completion/Core/_unset_options
index f6a1c58f0..0c7b91b7a 100644
--- a/Completion/Core/_unset_options
+++ b/Completion/Core/_unset_options
@@ -6,5 +6,7 @@
 
 local expl
 
+_tags any zsh-options || return 1
+
 _description expl 'unset zsh option'
 compadd "$expl[@]" "$@" -M 'L:|[nN][oO]= M:_= M:{A-Z}={a-z}' - $=_unset_options
diff --git a/Completion/Core/compinit b/Completion/Core/compinit
index 1b88cc8f0..0f614f322 100644
--- a/Completion/Core/compinit
+++ b/Completion/Core/compinit
@@ -108,13 +108,9 @@ fi
   compconfig[correct_prompt]='correct to:'
 (( ${+compconfig[completer]} )) || compconfig[completer]=_complete
 
-# This holds the tag/priority definitions.
+# This holds the style definitions.
 
-typeset -gA comptags
-
-(( ${+comptags[any]} )) || comptags[any]='*=100'
-
-typeset -gA override_tags
+typeset -gA _compstyles
 
 # This can hold names of functions that are to be called after all
 # matches have been generated.
@@ -378,243 +374,65 @@ compconf() {
   fi
 }
 
-# Function to set tags and priorities.
-
-comptag() {
-  local i opt list tag val
-
-  while getopts "lL" opt; do
-    if [[ "$opt" = l ]]; then
-      [[ -z "$list" ]] && list=yes
-    else
-      list=long
-    fi
-  done
-  shift OPTIND-1
-
-  if (( $# )); then
-    if [[ -n $list ]]; then
-      for i; do
-        if [[ $list = long ]]; then
-	  (( ${+comptags[$i]} )) && print "comptag $i='$comptags[$i]'"
-	else
-          print $comptags[$i]
-	fi
-      done
-    else
-      for i; do
-        tag="${i%%([-+]|)\=*}"
-	val="${${i#*(|[-+])\=}#+}"
-        case "$i" in
-	*+\=*)
-	  if [[ -n "$comptags[$tag]" ]]; then
-	    comptags[$tag]="${val}:${comptags[$tag]}"
-	  else
-	    comptags[$tag]="$val"
-          fi
-	  ;;
-	*\=+*)
-	  if [[ -n "$comptags[$tag]" ]]; then
-	    comptags[$tag]="${comptags[$tag]}:${val}"
-	  else
-	    comptags[$tag]="$val"
-          fi
-	  ;;
-	*-\=*)
-	  if [[ -n "$comptags[$tag]" ]]; then
-	    comptags[$tag]="${${${comptags[$tag]//:${val}\=[^:]##}#${val}\=*:}%:${val}\=[^:]##}"
-	    [[ "$comptags[$tag]" = ${val}\=* ]] && unset "comptags[$tag]"
-          fi
-          ;;
-        *\=*)
-          comptags[${i%%\=*}]="${i#*\=}"
-	  ;;
-        *)
-          unset "compconfig[$i]"
-	  ;;
-        esac
-      done
-    fi
-  else
-    for i in ${(ok)comptags}; do
-      if [[ $list = long ]]; then
-	print "comptag $i='$comptags[$i]'"
-      else
-        print ${(r:25:)i} "$comptags[$i]"
-      fi
-    done
-  fi
-}
-
-# First suggested function for new configuration interface.
+# Very simple interface for setting styles:
 #
-# Example:
+#   compstyle context -styles... context -styles ...
 #
-#   conf1 \
-#     argument = 1 \
-#     value    = 1 with describe \
-#     option   = 2 with describe and hide \
-#     file     = 3 \
-#     path in   '*dvi*' = 1 \
-#          else         = 2 \
-#     glob     = 1 \
-#     job      = never
-
-conf1() {
-  local tag pat prio
-
-  while (( $# )); do
+# Where context is of the form cmd-pat:ctxt-pat:tag-pat.
+#
+# This will be improved if needed. Promised.
 
-    tag="$1"
-    shift
+compstyle() {
+  if (( ! $# )); then
+    local pat
 
-    while (( $# )); do
+    for pat in "${(@k)_compstyles}"; do
+      print -- "${(r:20:: :)pat} -- ${_compstyles[$pat]#??}"
+    done
 
-      if [[ "$1" = in ]]; then
-        pat="$2"
-	shift 2
-      else
-        pat='*'
-	[[ "$1" = else ]] && shift
-      fi
+    return 0
+  fi
 
-      style=''
+  local sep pat test
+  typeset -Z 2 num
 
-      if [[ "$1" = is ]]; then
-        prio=0
-	style="[${2}]"
-	shift 2
-      elif [[ "$1" = \= ]]; then
-        if [[ "$2" = n(o|ever) ]]; then
-          prio=-1
-	  shift 2
-        else
-          prio="$2"
-	  shift 2
-
-	  if [[ "$1" = with ]]; then
-	    while [[ "$1" = (with|and) ]]; do
-	      style="${style},${2}"
-	      shift 2
-            done
-            style="[${style[2,-1]}]"
-          fi
-        fi
-      else
-        echo "$0: missing priority: $1"
-	return 1
-      fi
-      if [[ -n "$comptags[$tag]" ]]; then
-        comptags[$tag]="${comptags[$tag]}:${pat}=${prio}${style}"
-      else
-        comptags[$tag]="${pat}=${prio}${style}"
+  while (( $# )); do
+    num=0
+    for pat in "${(s:,:)1}"; do
+      if [[ "$pat" = \* ]]; then
+        (( num += 3 ))
+      elif [[ "$pat" = any ]]; then
+        (( num += 2 ))
+      elif [[ "$pat" != "$pat:q" ]]; then
+        (( num++ ))
       fi
-
-      [[ "$1" = (in|else|\=) ]] || break
-
     done
-  done
 
-  return 0
-}
+    pat="$1"
+    shift
 
-# Second suggested function for new configuration interface.
-#
-# Example:
-#
-#   conf2 \
-#     for '*dvi*' do \
-#       glob and path or \
-#       file \
-#     else do \
-#       glob or \
-#       path or \
-#       file \
-#     for '*p[bgpn]m*' do \
-#       argument and option with describe and with hide \
-#     else do \
-#       argument or \
-#       value with describe or \
-#       option with describe \
-#     for 'kill' do \
-#       no job but \
-#       process \
-#     else do \
-#       process and job
-
-conf2() {
-  local pat prio tag style
+    sep=$argv[(I)[^-]*]
 
-  while (( $# )); do
-
-    if [[ "$1" = for ]]; then
-      pat="$2"
-      shift 2
-    elif [[ "$1" = (else|always) ]]; then
-      pat="*"
-      shift
+    if (( sep )); then
+      _compstyles[$pat]="${num}${(j.:.)${(@)argv[1,sep-1]#-}}"
+      shift sep-1
     else
-      echo "$0: missing context: $1"
-      return 1
+      _compstyles[$pat]="${num}${(j.:.)${(@)argv#-}}"
+      break
     fi
+  done
 
-    shift 1
-
-    prio=1
-
-    while (( $# )); do
-
-      if [[ "$1" = no ]]; then
-        while [[ "$1" != (but|for|else|always) ]]; do
-	  if [[ -n "$comptags[$2]" ]]; then
-	    comptags[$2]="${comptags[$2]}:${pat}=-1"
-          else
-	    comptags[$2]="${pat}=-1"
-	  fi
-
-	  shift 2
-	done
-
-	[[ "$1" != but ]] && break
-
-	shift
-      fi
-
-      while (( $# )); do
-
-        tag="$1"
-	shift
-
-	style=''
-	if [[ "$1" = with ]]; then
-	  shift
-	  while true; do
-	    style="${style},${1}"
-	    [[ "$2" != and || "$3" != with ]] && break
-	    shift 3
-          done
-	  shift
-        fi
-
-	[[ -n "$style" ]] && style="[${style[2,-1]}]"
-
-	if [[ -n "$comptags[$tag]" ]]; then
-	  comptags[$tag]="${comptags[$tag]}:${pat}=${prio}${style}"
-        else
-	  comptags[$tag]="${pat}=${prio}${style}"
-        fi
+  return 0
+}
 
-	[[ "$1" != and ]] && break
+# Default styles.
 
-	shift
-      done
+compstyle '*,*,*' -description=yes -prefix-needed=yes -prefix-hidden=no
 
-      [[ "$1" != or ]] && break
+# Helper function for `_tags'. Will be moved into C-code.
 
-      (( prio++ ))
-      shift
-    done
-  done
+comptry() {
+  _tags=( "$_tags[@]" ":${(j.:.)argv}:" )
 }
 
 # Utility function to call a function if it exists.