about summary refs log tree commit diff
path: root/Completion/User
diff options
context:
space:
mode:
authorSven Wischnowsky <wischnow@users.sourceforge.net>2000-05-31 09:38:25 +0000
committerSven Wischnowsky <wischnow@users.sourceforge.net>2000-05-31 09:38:25 +0000
commitfd25b24df6b4f098944c4994195d3894a27a8208 (patch)
tree53f7f940844ab34c7349506622fc8241c782f98c /Completion/User
parent4629133ad33dacef459ad9fa5ca438836a1be9fb (diff)
downloadzsh-fd25b24df6b4f098944c4994195d3894a27a8208.tar.gz
zsh-fd25b24df6b4f098944c4994195d3894a27a8208.tar.xz
zsh-fd25b24df6b4f098944c4994195d3894a27a8208.zip
use compadd -[ak] (11549)
Diffstat (limited to 'Completion/User')
-rw-r--r--Completion/User/_archie2
-rw-r--r--Completion/User/_cvs10
-rw-r--r--Completion/User/_domains8
-rw-r--r--Completion/User/_gprof2
-rw-r--r--Completion/User/_groups2
-rw-r--r--Completion/User/_hosts14
-rw-r--r--Completion/User/_lp4
-rw-r--r--Completion/User/_mailboxes174
-rw-r--r--Completion/User/_make2
-rw-r--r--Completion/User/_mount6
-rw-r--r--Completion/User/_mysql_utils6
-rw-r--r--Completion/User/_netscape4
-rw-r--r--Completion/User/_perl2
-rw-r--r--Completion/User/_perl_basepods2
-rw-r--r--Completion/User/_perl_builtin_funcs8
-rw-r--r--Completion/User/_perl_modules2
-rw-r--r--Completion/User/_ports12
-rw-r--r--Completion/User/_rcs2
-rw-r--r--Completion/User/_urls2
-rw-r--r--Completion/User/_users4
-rw-r--r--Completion/User/_yp6
21 files changed, 211 insertions, 63 deletions
diff --git a/Completion/User/_archie b/Completion/User/_archie
index 103fd881a..96e628189 100644
--- a/Completion/User/_archie
+++ b/Completion/User/_archie
@@ -26,7 +26,7 @@ case "$state" in
 serverhost)
   : ${(A)archie_servers:=${(M)$(_call hosts archie -L):#archie.*}}
 
-  _wanted hosts expl 'archie servers' compadd -  $archie_servers && return 0
+  _wanted hosts expl 'archie servers' compadd -a archie_servers && return 0
   ;;
 esac
 
diff --git a/Completion/User/_cvs b/Completion/User/_cvs
index 341bbcb54..476f2d755 100644
--- a/Completion/User/_cvs
+++ b/Completion/User/_cvs
@@ -49,7 +49,7 @@ _cvs_command () {
 	watchers "")
 
   if (( CURRENT == 1 )); then
-    _tags commands && { compadd "$@" ${(k)cmds} || compadd "$@" ${(kv)=cmds} }
+    _tags commands && { compadd "$@" -k cmds || compadd "$@" ${(kv)=cmds} }
   else
     local curcontext="$curcontext"
 
@@ -584,7 +584,7 @@ _cvs_root () {
   fi
 
   _tags files && {
-    compadd -M 'r:|[:@./]=** r:|=**' "$@" $_cvs_roots || _files "$@" -/
+    compadd -M 'r:|[:@./]=** r:|=**' "$@" -a _cvs_roots || _files "$@" -/
   }
 }
 
@@ -652,7 +652,7 @@ _cvs_modules () {
       fi
     fi
     if (( $#_cvs_modules_cache )); then
-      _wanted modules expl 'module name' compadd - $_cvs_modules_cache
+      _wanted modules expl 'module name' compadd -a _cvs_modules_cache
     else
       _message 'module name'
     fi
@@ -683,7 +683,7 @@ _cvs_revisions () {
   fi
 
   if (( $#_cvs_revisions_cache )); then
-    _wanted values expl revision compadd - $_cvs_revisions_cache
+    _wanted values expl revision compadd -a _cvs_revisions_cache
   else
     _message revision
   fi
@@ -813,7 +813,7 @@ _cvs_nonexisting_entries () {
       ${${${${(M)${(f)"$(<"$realdir"CVS/Entries)"}:#(D|)/*}#(D|)/}%%/*}:#${(j:|:)~${files//(#m)[][*?()<|^~#\\]/\\$MATCH}}}
     )
     compquote files
-    _wanted files expl file compadd -Qp "$linedir" $files
+    _wanted files expl file compadd -Qp -a linedir files
   }
 }
 
diff --git a/Completion/User/_domains b/Completion/User/_domains
index 9bd94a4fd..42a0966dd 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
@@ -10,11 +10,11 @@ if ! zstyle -a ":completion${curcontext}:domains" domains domains; then
         [[ "$tmp" = (domain|search)* ]] &&
             _cache_domains=( "$_cache_domains[@]" "${=${tmp%%[ 	]#}#*[ 	]}" )
       done < /etc/resolv.conf
-      _cache_domains=( "${(@)_nslookup_domains:#[ 	]#}" )
+      _cache_domains=( "${(@)_cache_domains:#[ 	]#}" )
     fi
   fi
   domains=( "$_cache_domains[@]" )
 fi
 
-_wanted domains expl domain &&
-    compadd -M 'm:{a-zA-Z}={A-Za-z} r:|.=* r:|=*' "$@" "$expl[@]" - "$domains[@]"
+_wanted domains expl domain \
+    compadd -M 'm:{a-zA-Z}={A-Za-z} r:|.=* r:|=*' "$@" -a domains
diff --git a/Completion/User/_gprof b/Completion/User/_gprof
index f261ff700..fe7f1fdac 100644
--- a/Completion/User/_gprof
+++ b/Completion/User/_gprof
@@ -49,7 +49,7 @@ if [[ -n "$state" ]]; then
       expl=function
     fi
     _wanted functions expl "$expl" \
-        compadd -M 'r:|_=* r:|=*' - "$_gprof_funcs[@]" && ret=0
+        compadd -M 'r:|_=* r:|=*' -a _gprof_funcs && ret=0
   else
     return 1
   fi
diff --git a/Completion/User/_groups b/Completion/User/_groups
index d1475b857..673c44688 100644
--- a/Completion/User/_groups
+++ b/Completion/User/_groups
@@ -16,4 +16,4 @@ if ! zstyle -a ":completion:${curcontext}:" groups groups; then
   groups=( "$_cache_groups[@]" )
 fi
 
-_wanted groups expl group compadd "$@" - "$groups[@]"
+_wanted groups expl group compadd "$@" -a groups
diff --git a/Completion/User/_hosts b/Completion/User/_hosts
index 3acc327ac..30c3b2357 100644
--- a/Completion/User/_hosts
+++ b/Completion/User/_hosts
@@ -1,3 +1,13 @@
-#defcomp ftp ncftp ping rwho rup xping traceroute nslookup
+#compdef ftp ncftp ping rwho rup xping traceroute host
 
-complist -k hosts
+local expl hosts
+
+if ! zstyle -a ":completion:${curcontext}:hosts" hosts hosts; then
+  (( $+_cache_hosts )) ||
+      : ${(A)_cache_hosts:=${(s: :)${(ps:\t:)${${(f)~~"$(</etc/hosts)"}%%\#*}##[:blank:]#[^[:blank:]]#}}}
+
+  hosts=( "$_cache_hosts[@]" )
+fi
+
+_wanted hosts expl host \
+    compadd -M 'm:{a-zA-Z}={A-Za-z} r:|.=* r:|=*' "$@" -a hosts
diff --git a/Completion/User/_lp b/Completion/User/_lp
index 844178169..a81d348bb 100644
--- a/Completion/User/_lp
+++ b/Completion/User/_lp
@@ -26,7 +26,7 @@ else
           else
   	  disp=()
           fi
-	  _all_labels users expl user compadd "$disp[@]" - "$strs[@]" ||
+	  _all_labels users expl user compadd "$disp[@]" -a strs ||
               _users && ret=0
         fi
         if _requested jobs; then
@@ -38,7 +38,7 @@ else
           else
   	  disp=()
           fi
-          _all_labels jobs expl job compadd "$disp[@]" - "$strs[@]" && ret=0
+          _all_labels jobs expl job compadd "$disp[@]" -a strs && ret=0
         fi
         (( ret )) || return 0
       done
diff --git a/Completion/User/_mailboxes b/Completion/User/_mailboxes
index c49aa8185..e2b4b5289 100644
--- a/Completion/User/_mailboxes
+++ b/Completion/User/_mailboxes
@@ -1,32 +1,164 @@
 #autoload
 
-# This is needlessly mutt-biased and should be fixed.
+_mailboxes() {
+  #emulate -L zsh
+  local expl ret=1
+  local pinedirectory="${pinedirectory:-~/mail}"
+  local maildirectory="${maildirectory:-~/Mail}"
 
-local expl muttboxes mboxes dirboxes MHboxes maildirboxes muttrc="~/.muttrc" maildirectory="~/Mail"
+  if (( ! $+_mailbox_cache )) then
+    _mailbox_cache "$@"
+  fi
 
-test -f "$compconfig[muttrc_path]" && muttrc=$compconfig[muttrc_path]
-test -f "$compconfig[maildirectory]" && maildirectory=$compconfig[maildirectory]
+  case "${curcontext}" in
+    (*:mail:*)
+      if [[ "$PREFIX" == +* ]]; then
+	_tags mailboxes
+      else
+        _tags mailboxes files
+      fi;;
+    (*:(mush|zmail|zmlite):*)
+      if [[ "$PREFIX" == [%+]* ]]; then
+	_tags mailboxes
+      else
+        _tags mailboxes files
+      fi;;
+    (*:pine:*)
+      # Files for pine must be absolute paths.
+      if [[ "$PREFIX" == (|-f)[/\~]* ]]; then
+        pinedirectory=''
+        _tags mailboxes files
+      else
+        _tags mailboxes
+      fi;;
+    (*)
+      if [[ "$PREFIX" == (|-f)+* ]]; then
+	_tags mailboxes
+      else
+        _tags mailboxes files
+      fi;;
+  esac
 
-if (( ! $+_mailbox_cache )) then
+  while _tags; do
+    _requested mailboxes expl 'mailbox specification' _mua_mailboxes && ret=0
 
-test ${muttrc} || test -f ${~muttrc} && muttboxes=( ${(@)$(grep mailboxes ${~muttrc})[2,-1]} )
+    if _requested files expl 'mailbox file'; then
+      [[ "${curcontext}" != *:(mail|mush|zmail|zmlite):* ]] &&
+	compset -P -f
+      _files "$expl[@]" && ret=0
+    fi
+    (( ret )) || return 0
+  done
 
-mboxes=(${~maildirectory}/*(^/))
-dirboxes=(${~maildirectory}/*(/))
+  return 1
+}
 
-for i in $dirboxes
-do 
-if test -d "${i}/cur"
-then
-maildirboxes=($maildirboxes $i)
-else
-MHboxes=($MHboxes $i)
-fi
-done
+_mailbox_cache () {
+  # Depends on $maildirectory and $pinedirectory from _mailboxes!
 
-_mailbox_cache=(\! \< \> $muttboxes $mboxes $maildirboxes $MHboxes)
+  local i j muttrc="${muttrc:-~/.muttrc}"
+  local -aU dirboxes
+  typeset -aU -g _mailbox_cache
+  typeset -aU -g _maildir_cache _mbox_cache _mh_cache _mutt_cache _pine_cache
 
-fi
+  setopt localoptions nullglob
 
-_description expl 'mailbox specification'
-compadd "$@" "$expl[@]" - "$_mailbox_cache[@]"
+
+  [[ -f ${~muttrc:-.} ]] &&
+    _mutt_cache=( ${$(grep mailboxes ${~muttrc})[2,-1]} )
+
+  _mbox_cache=( ${~maildirectory}/*(^/) )
+  _pine_cache=( ${~pinedirectory}/**/*(.) )
+
+  dirboxes=( ${~maildirectory}/*(/) )
+
+  while (( $#dirboxes )); do
+    i=${dirboxes[1]}
+    shift dirboxes
+    if [[ -d "$i/cur" ]]; then
+      _maildir_cache=( "${_maildir_cache[@]}" "$i" )
+    elif j=( "$i"/<1-> ) && [[ -n "$j" ]]; then
+      _mh_cache=( "${_mh_cache[@]}" "$i" )
+    else
+      _mbox_cache=( "${_mbox_cache[@]}" "$i"/*(.) )
+      dirboxes=( $dirboxes "$i"/*(/) )
+    fi
+  done
+
+  [[ -n "$mailpath" ]] &&
+      _mailbox_cache=( "${_mailbox_cache[@]}" "${(@)mailpath%%\?*}" )
+
+  [[ -n "$MAIL" ]] && _mailbox_cache=( "${_mailbox_cache[@]}" $MAIL )
+}
+
+_mua_mailboxes() {
+  # Depends on $maildirectory and $pinedirectory from _mailboxes!
+
+  local -a mbox_short
+  local -aU mbox_names
+  local ret=1
+
+  case "${curcontext}" in
+    (*:elm:*) # I've probably got this wrong, or at least incomplete
+      mbox_names=( "${_mbox_cache[@]}" "${_mailbox_cache[@]}" )
+      mbox_short=( \! \< \> )
+      ;;
+    (*:mail:*)
+      if compset -P +; then
+        mbox_names=( "${(@)_mbox_cache#$~maildirectory/}" )
+      else
+        mbox_names=( +"${(@)^_mbox_cache#$~maildirectory/}"
+		    "${_mailbox_cache[@]}" )
+      fi
+      ;;
+    (*:mh:*) # I've probably got this wrong, or at least incomplete
+      (( $#_mh_cache )) && _multi_parts "${expl[@]}" / _mh_cache && ret=0
+      ;;
+    (*:mush:*)
+      if compset -P %; then
+        mbox_short=( "${(@k)userdirs}" )
+      elif compset -P +; then
+        mbox_names=( "${(@)_mbox_cache#$~maildirectory/}" )
+      else
+        mbox_names=( +"${(@)^_mbox_cache#$~maildirectory/}"
+		     "${_mailbox_cache[@]}" )
+        mbox_short=( \& % %"${(@k)^userdirs}" )
+      fi
+      ;;
+    (*:mutt:*)
+      mbox_names=( "${_mutt_cache[@]}" "${_mailbox_cache[@]}"
+		   "${_maildir_cache[@]}" )
+      mbox_short=( \! \< \> );;
+    (*:pine:*)
+      # Pine is like mail but with no leading `+' to disambiguate;
+      # any files not in $pinedirectory must be absolute paths.
+      mbox_names=( "${(@)_pine_cache#$~pinedirectory/}" "${_mbox_cache[@]}"
+		   "${_mailbox_cache[@]}" "${_mh_cache[@]}" )
+      ;;
+    (*:tkrat:*) # Has a couple of custom formats I haven't programmed for.
+      mbox_names=( "${_mbox_cache[@]}"
+		   "${_mailbox_cache[@]}" "${_mh_cache[@]}" )
+      ;;
+    (*:(zmail|zmlite):*)
+      if compset -P %; then
+        mbox_short=( "${(@k)userdirs}" )
+      elif compset -P +; then
+        mbox_names=( "${(@)_mbox_cache#$~maildirectory/}" )
+      else
+        mbox_names=( +"${(@)^_mbox_cache#$~maildirectory/}"
+		     "${_mailbox_cache[@]}" "${_mh_cache[@]}" )
+        mbox_short=( \& % %"${(@k)^userdirs}" )
+      fi
+      ;;
+    (*) # Some other program wants mailbox names?  Use them all?
+       mbox_names=( "${_mailbox_cache[@]}" "${_mbox_cache[@]}"
+		    "${_mh_cache[@]}" "${_mutt_cache[@]}" "${_pine_cache[@]}" )
+       ;;
+  esac
+
+  (( $#mbox_names )) && _multi_parts "$@" / mbox_names && ret=0
+  (( $#mbox_short )) && compadd "$@" -a mbox_short && ret=0
+  return ret
+}
+
+[[ -o kshautoload ]] || _mailboxes "$@"
diff --git a/Completion/User/_make b/Completion/User/_make
index 09e4e4f89..b13224c06 100644
--- a/Completion/User/_make
+++ b/Completion/User/_make
@@ -42,7 +42,7 @@ else
  	     FS=: $file)
            )
     fi
-    _wanted targets expl 'make target' compadd "$tmp[@]" && return 0
+    _wanted targets expl 'make target' compadd -a tmp && return 0
   fi
   compset -P 1 '*='
   _files
diff --git a/Completion/User/_mount b/Completion/User/_mount
index b0d20ca98..50fa769b2 100644
--- a/Completion/User/_mount
+++ b/Completion/User/_mount
@@ -540,7 +540,7 @@ fstype)
   compset -P '*,'
 
   _wanted types expl 'file system type' \
-      compadd -qS, -M 'L:|no=' - "$fss[@]" && ret=0
+      compadd -qS, -M 'L:|no=' -a fss && ret=0
   ;;
 fsopt)
   _tags options || return 1
@@ -569,8 +569,8 @@ udevordir)
     mp_tmp=( "${(@)${(@)tmp#* }%% *}" )
 
     _alternative \
-        'devices:device:compadd - $dev_tmp[@]' \
-	'directories:mount point:compadd - $mp_tmp[@]' && ret=0
+        'devices:device:compadd -a dev_tmp' \
+	'directories:mount point:compadd -a mp_tmp' && ret=0
   fi
   ;;
 esac
diff --git a/Completion/User/_mysql_utils b/Completion/User/_mysql_utils
index c696f774b..c4648c818 100644
--- a/Completion/User/_mysql_utils
+++ b/Completion/User/_mysql_utils
@@ -64,7 +64,7 @@ _mysql_databases () {
                    )
   shift _mysql_databases
 
-  compadd "$expl[@]" - $_mysql_databases
+  compadd "$expl[@]" -a _mysql_databases
 }
 
 _mysql_tables () {
@@ -79,7 +79,7 @@ _mysql_tables () {
   # remove header
   shift _mysql_tables
 
-  compadd "$expl[@]" - $_mysql_tables
+  compadd "$expl[@]" -a _mysql_tables
 }
 
 _mysql_variables () {
@@ -205,7 +205,7 @@ _mysqladmin_commands () {
        )
 
   if (( CURRENT == 1 )); then
-    _wanted commands expl command compadd "$@" - $cmds
+    _wanted commands expl command compadd "$@" -a cmds
   else
     local curcontext="$curcontext"
 
diff --git a/Completion/User/_netscape b/Completion/User/_netscape
index c6fd084cc..2aba6750d 100644
--- a/Completion/User/_netscape
+++ b/Completion/User/_netscape
@@ -62,8 +62,8 @@ if [[ "$state" = "remote" ]]; then
     *)
       compset -S '(|\\)\(*' || suf="${${QIPREFIX:+(}:-\(}"
       _wanted commands expl 'remote commands' \
-          compadd -qS "$suf" -M 'm:{a-zA-Z}={A-Za-z}' - \
-                  $remote_commands && ret=0
+          compadd -qS "$suf" -M 'm:{a-zA-Z}={A-Za-z}' -a \
+                  remote_commands && ret=0
     ;;
   esac
 fi
diff --git a/Completion/User/_perl b/Completion/User/_perl
index 848118431..af94961cc 100644
--- a/Completion/User/_perl
+++ b/Completion/User/_perl
@@ -59,7 +59,7 @@ _perl_config_vars () {
   (( compstate[quoting] )) && delimiter=' '
 
   compset -P '* ' && compset -q
-  compadd "$expl[@]" $add_colon -S$delimiter -q - $_perl_config_vars
+  compadd "$expl[@]" $add_colon -S$delimiter -q -a _perl_config_vars
 }
 
 _perl "$@"
diff --git a/Completion/User/_perl_basepods b/Completion/User/_perl_basepods
index 4478c5263..5c8034a96 100644
--- a/Completion/User/_perl_basepods
+++ b/Completion/User/_perl_basepods
@@ -29,4 +29,4 @@ fi
 
 local expl
 
-_wanted pods expl 'Perl base pods' compadd - $_perl_basepods
+_wanted pods expl 'Perl base pods' compadd -a _perl_basepods
diff --git a/Completion/User/_perl_builtin_funcs b/Completion/User/_perl_builtin_funcs
index a8facda08..f5538c9e4 100644
--- a/Completion/User/_perl_builtin_funcs
+++ b/Completion/User/_perl_builtin_funcs
@@ -12,13 +12,13 @@ if [[ ${+_perl_builtin_funcs} -eq 0 ]]; then
   typeset -agU _perl_builtin_funcs
   local perlfunc
 
-  if perlfunc=`man -w perlfunc 2>&1`; then
+  if [[ -n "${perlfunc:=$(man -w perlfunc 2>/dev/null; print -l ${^manpath}/man1/perlfunc.1(N) {/usr/man,/usr/local/man}/man1/perlfunc.1(N))}" ]]; then
     _perl_builtin_funcs=( `perl -lne '
                              $in_funcs++, next if /Alphabetical/;     \
                              next unless $in_funcs;                   \
                              if (/^\.Ip "(\w+)/) {                    \
                                print $1 unless $func{$1}; $func{$1}++ \
-                             }' $perlfunc`
+                             }' $=perlfunc`
                )
   else
     echo "Couldn't find perlfunc man page; giving up."
@@ -26,4 +26,6 @@ if [[ ${+_perl_builtin_funcs} -eq 0 ]]; then
   fi
 fi
 
-compadd - $_perl_builtin_funcs
+local expl
+
+_wanted functions expl 'Perl built-in functions' compadd -a _perl_builtin_funcs
diff --git a/Completion/User/_perl_modules b/Completion/User/_perl_modules
index f28fc3ecc..88efdd395 100644
--- a/Completion/User/_perl_modules
+++ b/Completion/User/_perl_modules
@@ -62,4 +62,4 @@ fi
 
 local expl
 
-_wanted modules expl 'Perl modules' compadd "$opts[@]" - $_perl_modules
+_wanted modules expl 'Perl modules' compadd "$opts[@]" -a _perl_modules
diff --git a/Completion/User/_ports b/Completion/User/_ports
index 950212832..958917bd6 100644
--- a/Completion/User/_ports
+++ b/Completion/User/_ports
@@ -1,8 +1,12 @@
 #autoload
 
-local expl
+local expl ports
 
-: ${(A)ports:=${${(M)${${(f)"$(</etc/services)"}:#\#*}#*/tcp}%%[ 	]*}}
+if ! zstyle -a ":completion:${curcontext}:" ports ports; then
+  (( $+_cache_ports )) ||
+      : ${(A)_cache_ports:=${${(M)${${(f)"$(</etc/services)"}:#\#*}#*/tcp}%%[ 	]*}}
 
-_description expl port
-compadd "$@" "$expl[@]" - "$ports[@]"
+  ports=( "$_cache_ports[@]" )
+fi
+
+_wanted ports expl port compadd "$@" -a ports
diff --git a/Completion/User/_rcs b/Completion/User/_rcs
index 1792179d7..d9280b11f 100644
--- a/Completion/User/_rcs
+++ b/Completion/User/_rcs
@@ -8,5 +8,5 @@ if [[ $compstate[nmatches] -eq nm && -d RCS && $cmd != ci ]]; then
   local rep expl
 
   rep=(RCS/$PREFIX*$SUFFIX,v(:t:s/\,v//))
-  (( $#rep )) && _wanted files expl 'RCS file' compadd - $rep
+  (( $#rep )) && _wanted files expl 'RCS file' compadd -a rep
 fi
diff --git a/Completion/User/_urls b/Completion/User/_urls
index 7fa120d2c..0d1845754 100644
--- a/Completion/User/_urls
+++ b/Completion/User/_urls
@@ -124,7 +124,7 @@ if ! compset -P '(#b)([^/]#)/'; then
       compset -S '/*' || suf="/"
       (( $#uhosts )) || _hosts -S "$suf" "$expl[@]" && ret=0
       [[ "$scheme" = http ]] && uhosts=($uhosts $localhttp_servername)
-      compadd -S "$suf" "$expl[@]" - $uhosts && ret=0
+      compadd -S "$suf" "$expl[@]" -a uhosts && ret=0
     done
     (( ret )) || return 0
   done
diff --git a/Completion/User/_users b/Completion/User/_users
index dce0fd584..a7ea8b714 100644
--- a/Completion/User/_users
+++ b/Completion/User/_users
@@ -3,6 +3,6 @@
 local expl users
 
 zstyle -a ":completion:${curcontext}:" users users &&
-    _wanted users expl user compadd "$@" - "$users[@]" && return 0
+    _wanted users expl user compadd "$@" -a users && return 0
 
-_wanted users expl user compadd "$@" - "${(@k)userdirs}"
+_wanted users expl user compadd "$@" -k userdirs
diff --git a/Completion/User/_yp b/Completion/User/_yp
index 5b0c86143..d25533e35 100644
--- a/Completion/User/_yp
+++ b/Completion/User/_yp
@@ -96,10 +96,10 @@ if [[ "$state" = map* ]]; then
   while _tags; do
     # The `-M ...' allows `pa.n<TAB>' to complete to `passwd.byname'.
     _requested maps expl 'map name' \
-        compadd -M 'l:.|by=by l:.|=by r:|.=* r:|=*' - \
-                "$_yp_cache_maps[@]" && ret=0
+        compadd -M 'l:.|by=by l:.|=by r:|.=* r:|=*' -a \
+                _yp_cache_maps && ret=0
     _requested nicknames expl nicknames \
-        compadd - "$_yp_cache_nicks[@]" && ret=0
+        compadd -a _yp_cache_nicks && ret=0
     (( ret )) || return 0
   done
 elif [[ "$state" = servers ]]; then