Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

PATCH: fix return status of completion functions



I went through the completion functions looking for cases where the
return status is not correctly being passed on to indicate whether
matches were added. This fixes nearly all the cases I found. An
incorrect return status mostly affects approximate completion.
There are still issues with _arguments when the prefix-needed
style is set to false; I use the following to allow approximate
completion to make corrections to mistakes in the prefix.
  zstyle ':completion::approximate*:*' prefix-needed false

_call_function usage seems to be wrong almost as often as not. It could
perhaps use an option to indicate that it should only set the return
parameter if status was 0 so we don't end up with things like
ret=$(( ret && fret )) following it. Perhaps -o for OR (which is perhaps
confusing given that in math evaluation, it'd be an AND).

We're not that consistent in the fallback handling either.
_call_function is often used for dispatching to functions for
subcommands. Traditionally we handled an unknown subcommand with a
message like:
  _message "unknown cvs command: $words[1]"
Experience has shown that it is perhaps better to call _default. I
rather like the idea in _git of checking a use-fallback style. Perhaps
this logic could go in _call_function itself to get wider use? Something
like:
  _call_function -e "unknown subcommand" _$service-$words[1]
This could check use-fallback and call either _default or _message and
then return a conventional status.

Inevitably these fixes resulted in my getting sidetracked into fixing
other issues in many instances. Bad handling of zstyle contexts
with _arguments/_values is also common.

Oliver

diff --git a/Completion/Debian/Command/_apt-move b/Completion/Debian/Command/_apt-move
index a72378e..6911ef6 100644
--- a/Completion/Debian/Command/_apt-move
+++ b/Completion/Debian/Command/_apt-move
@@ -1,6 +1,6 @@
 #compdef apt-move
 
-local curcontext="$curcontext" state line cmds ret=1
+local curcontext="$curcontext" state line expl cmds ret=1
 typeset -A opt_args
 
 _arguments -C \
@@ -45,7 +45,10 @@ case $state in
         _files -g "*.d(sc|eb)(-.)" && ret=0
       ;;
       listbin)
-        _wanted lists expl list compadd mirror sync repo
+        _wanted lists expl list compadd mirror sync repo && ret=0
+      ;;
+      *)
+	_default && ret=0
       ;;
     esac
   ;;
diff --git a/Completion/Debian/Command/_bts b/Completion/Debian/Command/_bts
index 4907d15..9f1f77b 100644
--- a/Completion/Debian/Command/_bts
+++ b/Completion/Debian/Command/_bts
@@ -40,10 +40,12 @@ case "$words[1]" in
   ;;
   (show|bugs)
     if [[ CURRENT -eq 2 ]]; then
-      _wanted package expl 'package' _deb_packages avail
-      _wanted maintainer expl 'package maintainer' compadd $DEBEMAIL
+      _alternative \
+	'packages:package:_deb_packages avail' \
+        "emails:package maintainer:compadd $DEBEMAIL"
+    else
+      _wanted sep expl 'separator' compadd -S ' ' , .
     fi
-    _wanted sep expl 'separator' compadd -S ' ' , .
   ;;
   reopen)
     if [[ CURRENT -eq 2 ]]; then
diff --git a/Completion/Linux/Command/_sysstat b/Completion/Linux/Command/_sysstat
index 60de9d8..2a7128c 100644
--- a/Completion/Linux/Command/_sysstat
+++ b/Completion/Linux/Command/_sysstat
@@ -4,80 +4,73 @@
 # sysstat-nfsiostat - there seems to be two nfsiostat(1)s. one from oracle and one by redhat.
 
 _mpstat() {
-  local ret=1
   _arguments : \
     '-A[equivalent to -u -I ALL -P ALL]' \
-    '-I[report interrupt statistics]:interrupts:(SUM CPU SCPU ALL)' \
-    '-P[specify processor number]:processor: _values -s "," processor ON ALL' \
+    '-I[report interrupt statistics]:interrupt:(SUM CPU SCPU ALL)' \
+    '-P[specify processor number]:processor: _values -s "," processor ON ALL {1..$(_call_program processors getconf _NPROCESSORS_ONLN)}' \
     '-u[report CPU utilization]' \
     '-V[print version number]' \
-    '1:interval:_guard "[0-9]#" "interval"' \
-    '2:count:_guard "[0-9]#" "count"' && ret=0
-  return ret
+    '1:interval' \
+    '2:count'
 }
 
 _iostat() {
-  local ret=1
   _arguments : \
     '-c[display CPU utilization report]' \
     '-d[display device utilization report]' \
     '-T[only display global statistics for group_name]' \
-    '-g[display statistics for a group of devices]:group name: _message "group name"' \
+    '-g[display statistics for a group of devices]:group name' \
     '-h[human readable device utilization report]' \
     '-j[display persistent device name]' \
     '(-m)-k[display statistics in kB/s]' \
     '(-k)-m[display statistics in MB/s]' \
     '-N[display registered device mapper names]' \
-    '1:interval:_guard "[0-9]#" "interval"' \
-    '2:count:_guard "[0-9]#" "count"' && ret=0
-  return ret
+    '::device:_files -W /dev -g "*(-%)"' \
+    ': :_guard "[0-9]#" "interval"' \
+    ':count'
 }
 
 _cifsiostat() {
-  local ret=1
   _arguments : \
     '-h[human readable]' \
     '(-m)-k[display statistics in kB/s]' \
     '(-k)-m[display statistics in MB/s]' \
     '-t[print timestamp for each report]' \
     '-V[print version number]' \
-    '1:interval:_guard "[0-9]#" "interval"' \
-    '2:count:_guard "[0-9]#" "count"' && ret=0
-  return ret
+    '1:interval' \
+    '2:count'
 }
 
 _isag() {
-  local ret=1 
   _arguments : \
-    '-p[Pathname to daily data files]:data files: _files -/' \
-    '-c[Specify configuration file]:configuration file: _files' \
-    '-ght[Specify height of the chart]:height: _message "height"' \
-    '-gwd[Specify width of the chart]:width: _message "width"' && ret=0
-  return ret
+    '-p[specify path to daily data files]:path:_files -/' \
+    '-c[specify configuration file]:configuration file:_files' \
+    '-ght[specify height of the chart]:height' \
+    '-gwd[specify width of the chart]:width'
 }
 
 _sadf() {
-  local ret=1 line state context expl
-  typeset -A opt_args
+  local ret=1
   # any options after `--' are for sar(1)
   if ! (( CURRENT > $words[(i)--] )); then
     _arguments : \
       '-C[display comments in file]' \
       '(-j -p -x)-d[output file in SQL format]' \
-      '-e[set ending time of report]:ending time: _message "ending time in localtime(HH\:MM\:SS 24-hour format)"' \
+      '-e[set ending time of report]:ending time (HH\:MM\:SS)' \
       '-H[display only the header of the report]' \
       '(-j -p -x)-h[print on a single line when used with -d]' \
       '(-d -p -x)-j[output file in JSON]' \
       '-P[restrict processor dependant statistics]:processor number(zero indexed) or ALL:(ALL)' \
       '(-j -x -d)-p[print in format parsable by tools like awk]' \
-      '-s[set starting time of report]:starting time: _message "starting time in localtime(HH\:MM\:SS 24-hour format)"' \
+      '-s[set starting time of report]:starting time (HH\:MM\:SS)"' \
       '(-t -U)-T[display timestamp in local time]' \
       '(-T -U)-t[display timestamp in file\''s original localtime]' \
-      '(-t -T)-U[display in seconds from epoch(UTC)]' \
+      '(-t -T)-U[display in seconds since epoch (UTC)]' \
       '-V[print version number]' \
       '(-j -d -p)-x[output file in XML]' \
-      '1:interval:_guard "[0-9]#" "interval"' \
-      '2:count:_guard "[0-9]#" "count"' && ret=0 
+      '1:interval' \
+      '2:count' \
+      '3:data file:_files' && ret=0
   else
     _arguments : '*::sar: _sar' && ret=0
   fi
@@ -85,20 +78,19 @@ _sadf() {
 }
 
 _sar() {
-  local ret=1 
   _arguments : \
     '-A[equivalent to -bBdFHqrRSuvwWy -I SUM -I XALL -m ALL -n ALL -u ALL -P ALL]' \
     '-B[report paging statistics]' \
     '-b[report I/O and transfer rate statistics]' \
     '-C[display comments from sadc]' \
     '-d[report activity for each block device]' \
-    '-e[set ending time of report]:ending time: _message "ending time (HH\:MM\:SS 24-hour format)"' \
+    '-e[set ending time of report]:ending time (HH\:MM\:SS)' \
     '-F[display statistics for mounted filesystems]' \
     '-f[extract records from file]:record:_files' \
     '-H[report hugepages utilization]' \
     '-h[display help]' \
     '*-I[report statistics for interrupts]:interrupts: _values -s "," interrupts 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 SUM ALL XALL' \
-    '-i[select records as close as possible to interval]:interval: _message "interval"' \
+    '-i[select records as close as possible to interval]:interval' \
     '-j[display persistent device names]:type:(ID LABEL PATH UUID)' \
     '-m[report power management statistics]:keywords: _values -s "," keywords CPU FAN FREQ IN TEMP USB ALL' \
     '-n[report network statistics]:keywords: _values -s "," keywords DEV EDEV NFS NFSD SOCK IP EIP ICMP EICMP TCP ETCP UDP SOCK6 IP6 EIP6 ICMP6 EICMP6 UDP6 ALL' \
@@ -108,27 +100,25 @@ _sar() {
     '-R[report memory statistics]' \
     '-r[report memory utilization statistics]' \
     '-S[report swap space utilization]' \
-    '-s[set starting time of report]:start time: _message "start time (HH\:MM\:SS 24-hour format)"' \
+    '-s[set starting time of report]:start time (HH\:MM\:SS)' \
     '-u[report CPU utilization]: :(ALL)' \
     '-V[print version number]' \
     '-v[report status of kernel tables]' \
     '-W[report swapping statistics]' \
     '-w[report task creation and system switching activity]' \
     '-y[report TTY device activity]' \
-    '1:interval:_guard "[0-9]#" "interval"' \
-    '2:count:_guard "[0-9]#" "count"' && ret=0
-  return ret
+    '1:interval' \
+    '2:count'
 }
 
 _pidstat() {
-  local ret=1
   _arguments : \
-    '-C[filter tasks by string]:task: _message "string or regex"' \
+    '-C[filter tasks by string]:task filter' \
     '-d[report I/O statistics]' \
     '-h[display on horizontally]' \
     '-I[divide CPU usage by number of processors]' \
     '-l[display process name along with arguments]' \
-    '-p[select pid]:pid: _pids' \
+    '-p[select pid]:pid: _sequence _pids' \
     '-r[report page faults and memory]' \
     '-s[report stack utilization]' \
     '-T[specifies what to monitor]:type:(TASK CHILD ALL)' \
@@ -137,14 +127,13 @@ _pidstat() {
     '-u[report cpu utilization]' \
     '-V[print version number]' \
     '-v[display values from kernel table]' \
-    '-w[report task switching activity]' && ret=0
-  return ret
+    '-w[report task switching activity]' \
+    ':interval' ':count'
 }
 
 _sysstat() {
-  local ret=1                 
-  _call_function ret _$service
-  return ret                  
-}                             
+  local ret
+  _call_function ret _$service && return ret
+}
 
 _sysstat "$@"
diff --git a/Completion/Mandriva/Command/_urpmi b/Completion/Mandriva/Command/_urpmi
index 2468b23..7951e6a 100644
--- a/Completion/Mandriva/Command/_urpmi
+++ b/Completion/Mandriva/Command/_urpmi
@@ -1,24 +1,8 @@
 #compdef urpme urpmi urpmi.addmedia urpmi.removemedia urpmi.update urpmq urpmf parsehdlist
 
 _urpmi_media() {
-  local ret=1  single=0
-  local -a all_sources opts
-
-  if [[ $1 = -s ]]; then
-    single=1
-    shift
-  fi
-
   # TODO should we probe for active media only?
-  all_sources=( ${(f)"$(urpmq --list-media 2> /dev/null)"} )
-  
-  if (( single )); then
-    compadd "$expl[@]" -a all_sources && ret=0
-  else
-    _values -s , 'urpmi media' "$all_sources[@]" && ret=0
-  fi
-
-  return $ret
+  compadd "$@" - ${(f)"$(urpmq --list-media 2> /dev/null)"}
 }
 
 _urpmi_rpms() {
@@ -40,7 +24,7 @@ _urpmi_rpms() {
 
     _requested files expl '(S)RPM file' \
       _files -g '*.(#i)rpm(-.)' && ret=0
-  
+
     (( ret )) || break
   done
 
@@ -65,12 +49,12 @@ _urpmi_media_url() {
     fi
   fi
 
-  return $ret
+  return ret
 }
 
 _urpme_package() {
   local -a _rpms
-  _rpms=( $(_call_program packages rpm -qa 2>/dev/null) )
+  _rpms=( $(_call_program packages rpm -qa) )
   compadd "$@" -a _rpms
 }
 
@@ -80,12 +64,11 @@ _urpmi_parallel_alias() {
 }
 
 _urpmi() {
-  local state context line ret=1 help="--help -h"
-
-  local -a opts_help  opts_net opts_verbose opts_inst_rem opts_search opts_media
+  local ret=1 help="--help -h"
+  local -a opts_help opts_net opts_verbose opts_inst_rem opts_search opts_media
 
   opts_help=(
-    "($help : -)"{--help,-h}"[print usage information]"
+    "(: -)"{--help,-h}"[print usage information]"
   )
 
   opts_net=(
@@ -116,10 +99,10 @@ _urpmi() {
   )
 
   opts_media=(
-    "($help)--excludemedia[do not use the given media]:urpmi media: _urpmi_media"
-    "($help --update --use-distrib)--media[use only the media listed by comma]:urpmi media: _urpmi_media"
-    "($help)--searchmedia[use only the given media to search requested (or updated) packages]:urpmi media: _urpmi_media -s"
-    "($help)--sortmedia[sort media according to substrings separated by comma]:urpmi media: _urpmi_media"
+    "($help)--excludemedia[do not use the given media]:urpmi media:_sequence _urpmi_media"
+    "($help --update --use-distrib)--media[use only the media listed by comma]:urpmi media:_sequence _urpmi_media"
+    "($help)--searchmedia[use only the given media to search requested (or updated) packages]:urpmi media:_urpmi_media"
+    "($help)--sortmedia[sort media according to substrings separated by comma]:urpmi media:_sequence _urpmi_media"
     "($help)--synthesis[use the given synthesis instead of urpmi db]:synthesis file:_url"
     "($help --media --use-distrib)--update[use only update media]"
     "($help --media --update)--use-distrib[configure urpmi on the fly from a distrib tree]:installation media:_urpmi_media_url"
@@ -132,7 +115,7 @@ _urpmi() {
         $opts_inst_rem \
 	"--auto[do not ask any question]" \
 	"-v[verbose]" \
-	": :_urpme_package"
+	": :_urpme_package" && ret=0
     ;;
     urpmi.addmedia )
       _arguments -A '-*' \
@@ -165,7 +148,7 @@ _urpmi() {
 	"($help :)-a[select all media]" \
 	"($help)-c[clean headers cache directory]" \
 	"($help)-y[fuzzy mathing on media names]" \
-	"(-a)"{,\*}": : _urpmi_media" \
+	"(-a)"{,\*}":media:_sequence _urpmi_media" \
        && ret=0
     ;;
     urpmi.update )
@@ -179,7 +162,7 @@ _urpmi() {
 	"($help --update :)-a[select all non-removable media]" \
 	"($help)-c[clean /var/cache/urpmi/headers on exit]" \
 	"($help)*-f[force generation of hdlist files]" \
-	"($help -a)"{,\*}": : _urpmi_media" \
+	"($help -a)"{,\*}":media:_sequence _urpmi_media" \
        && ret=0
     ;;
     urpmi )
@@ -308,7 +291,7 @@ _urpmi() {
     ;;
   esac
 
-  return $ret
+  return ret
 }
 
 _urpmi "$@"
diff --git a/Completion/Redhat/Command/_rpm b/Completion/Redhat/Command/_rpm
index 83922b6..696c12f 100644
--- a/Completion/Redhat/Command/_rpm
+++ b/Completion/Redhat/Command/_rpm
@@ -122,7 +122,7 @@ _rpm () {
     query)
       # --dump requires one of -{l,c,d}
       # --triggers requires --script
-      _arguments -s \
+      _arguments -s -C \
 	\!{-q,--query} "${commonopts[@]}" "${selectopts[@]}" "${pathopts[@]}" \
 	"($sopts)--specfile[query specified spec file as if it were a package]" \
 	'(-i --info)'{-i,--info}'[display package information]' \
@@ -140,10 +140,10 @@ _rpm () {
 	{--triggers,--triggerscripts}'[show trigger scripts]' && ret=0
       ;;
     setattrs)
-      _arguments -s --set{perm,ugids} "${selectopts[@]}" && ret = 0
+      _arguments -s -C --set{perm,ugids} "${selectopts[@]}" && ret=0
       ;;
     verify)
-      _arguments -s \!-{y,V} \
+      _arguments -s -C \!-{y,V} \
 	"${commonopts[@]}" "${selectopts[@]}" "${pathopts[@]}" \
 	--no{deps,files,scripts,digest,signature,linkto,md5,size,user,group,mtime,mode,rdev} && ret=0
       ;;
@@ -151,7 +151,7 @@ _rpm () {
       tmp=( '(--force)--oldpackage' )
       ;&
     install)
-      _arguments -s \!-{i,U} "$tmp[@]" \
+      _arguments -s -C \!-{i,U} "$tmp[@]" \
 	"${commonopts[@]}" "${pathopts[@]}" \
 	'--excludepath:file to exclude:_files -/' \
 	'--relocate:relocate:->relocate' \
@@ -165,7 +165,7 @@ _rpm () {
 	'*:pkg file:->package_file' && ret=0
       ;;
     uninstall)
-      _arguments -s \!-e \
+      _arguments -s -C \!-e \
 	"${commonopts[@]}" "${pathopts[@]}" \
 	--{allmatches,justdb,repackage,test} \
 	--no{deps,scripts,preun,postun,trigger{s,un,postun}} \
@@ -177,7 +177,7 @@ _rpm () {
     build_t)
       (( $#tmp )) || tmp=( '*:tar file:_files -g "*.(#i)tar(.*|)(-.)"' )
 
-      _arguments -s \
+      _arguments -s -C \
 	"${commonopts[@]}" "${pathopts[@]}" \
 	--{short-circuit,clean,nobuild,rmsource,sign,test} \
 	'--target:specify a build target:->target'\
@@ -187,13 +187,13 @@ _rpm () {
 	'--timecheck:time check (seconds):' "$tmp[1]" && ret=0
       ;;
     sigcheck)
-      _arguments -s \!-K \
+      _arguments -s -C \!-K \
 	"${commonopts[@]}" \
 	--no{gpg,pgp,md5,signature,digest} \
 	'*:package file:->package_file' && ret=0
       ;;
     rebuild)
-      _arguments -s \
+      _arguments -s -C \
 	"${commonopts[@]}" "${pathopts[@]}" \
 	'*:source package file:->package_file' && ret=0
       ;;
@@ -286,7 +286,7 @@ _rpm () {
       ;;
     capabilities)
       _wanted capabilities expl capability compadd \
-	  ${(f)"$(_call_program capabilities rpm -qa --queryformat '%\{requirename}\\n' 2>/dev/null)"}
+	  ${(f)"$(_call_program capabilities rpm -qa --queryformat '%\{requirename}\\n' 2>/dev/null)"} && ret=0
       ;;
     relocate)
       if compset -P '*='; then
diff --git a/Completion/Solaris/Command/_ptree b/Completion/Solaris/Command/_ptree
index 035614b..754979c 100644
--- a/Completion/Solaris/Command/_ptree
+++ b/Completion/Solaris/Command/_ptree
@@ -1,23 +1,7 @@
 #compdef ptree
 
-_ptree() {
-	local curcontext="$curcontext" context state line ret=1
-	typeset -A opt_args
-
-	_arguments -s \
-		'-a[all processes]' \
-		'-c[show contract memberships]' \
-		'-z[show processes in zone]:zone:($(zoneadm list))' \
-		'*:pid or user:->pidoruser' && ret=0
-
-	if [[ $ret -ne 0 ]]; then
-		_alternative \
-			'users:logged-in user:compadd ${$(who -q)\:#(users=*|\#)}' \
-			'pids:pid:_pids'
-		ret=$?
-	fi
-
-	return $ret
-}
-
-_ptree "$@"
+_arguments -s \
+  '-a[all processes]' \
+  '-c[show contract memberships]' \
+  '-z[show processes in zone]:zone:_zones' \
+  '*: : _alternative "users:logged-in user:_users_on" "pids:pid:_pids"'
diff --git a/Completion/Unix/Command/_arp b/Completion/Unix/Command/_arp
index 64a8b80..f340e97 100644
--- a/Completion/Unix/Command/_arp
+++ b/Completion/Unix/Command/_arp
@@ -1,6 +1,6 @@
 #compdef arp
 
-local state line expl curcontext="$curcontext"
+local state line expl curcontext="$curcontext" ret=1
 local -a cmds
 
 cmds=(-a --display -d --delete -s --set -f --file)
@@ -15,7 +15,9 @@ _arguments -C \
   '(-H --hw-type -d --delete)'{-H,--hw-type}'[class of entries to check for]:class:(ether arcnet pronet ax25 netrom)' \
   '(-n --numeric -d --delete -s --set -f --file)'{-n,--numeric}'[shows numerical addresses]' \
   '(-v --verbose)'{-v,--verbose}'[be verbose]' \
-  '(-a)1:host:->hostintable'
+  '(-a)1:host:->hostintable' && ret=0
 
 [[ "$state" = hostintable ]] &&
-  _wanted hosts expl 'host' compadd ${${${(f)"$(${words[1]} -an)"}##[ ?(]#}%%[ )]*}
+  _wanted hosts expl 'host' compadd ${${${(f)"$(${words[1]} -an)"}##[ ?(]#}%%[ )]*} && ret=0
+
+return ret
diff --git a/Completion/Unix/Command/_at b/Completion/Unix/Command/_at
index 8734e6b..b225890 100644
--- a/Completion/Unix/Command/_at
+++ b/Completion/Unix/Command/_at
@@ -1,6 +1,6 @@
 #compdef atrm atq at batch
 
-local context state line expl
+local context state line expl ret=1
 typeset -A opt_args
 
 #todo (when extremely bored) make -l and -d do the atq and atrm completions
@@ -8,12 +8,12 @@ case $service in
 atrm)
   _arguments \
     '-V[print version number]' \
-    '*:job number:->jobs'
+    '*:job number:->jobs' && ret=0
   ;;
 atq)
   _arguments \
     '-V[print version number]' \
-    '-q[uses specified queue]:a-z+A-Z'
+    '-q[uses specified queue]:a-z+A-Z' && ret=0
   ;;
 at|batch)
   _arguments \
@@ -29,11 +29,13 @@ at|batch)
     - atrm \
       '-d[alias for atrm]' \
     - show-job \
-      '-c[cat specified jobs to stdout]:*:job number:->jobs'
+      '-c[cat specified jobs to stdout]:*:job number:->jobs' && ret=0
 esac
 
 case $state in
 jobs)
-  _wanted job expl 'job number' compadd ${(M)${(f)"$(_call_program job atq)"}##<->}
+  _wanted -C $context jobs expl 'job number' compadd ${(M)${(f)"$(_call_program job atq)"}##<->} && ret=0
   ;;
 esac
+
+return ret
diff --git a/Completion/Unix/Command/_bittorrent b/Completion/Unix/Command/_bittorrent
index f7da204..1f305a1 100644
--- a/Completion/Unix/Command/_bittorrent
+++ b/Completion/Unix/Command/_bittorrent
@@ -21,7 +21,7 @@ case $service in
    ;&
  btlaunchmanycurses)
   _arguments -s -S \
-      '(--responsefile)--responsefile+[specify file for server response]:file:_files -g "*"'\
+      '(--responsefile)--responsefile+[specify file for server response]:file:_files'\
       "--url+[specify URL of torrent file]:URL:_urls"\
       '(-i --ip)'{-i+,--ip+}'[specify ip address to report as]:ip address'\
       "--bind+[specify ip to bind to instead of default]:ip:_bind_addresses"\
@@ -50,18 +50,18 @@ case $service in
       "--max_initiate+[specify peers needed before stopping initiating new connections]:peers:"\
       "--report_hash_failures+[report hash failures to user]:enable:(0 1)"\
       "--rarest_first_priority_cutoff+[specify peers which need to have a piece before other partials take priority over rarest first]:peers:"\
-      ':torrent file:_files -g "*.torrent(-.)"' \
-      && return 0
+      ':torrent file:_files -g "*.torrent(-.)"'
+    return
   ;;
 
 # Next up are the torrent file manipulation programs.
 
   btshowmetainfo)
-   _files -g "*.torrent(-.)" && return 0
-   ;;
+    _files -g "*.torrent(-.)" && return
+  ;;
 
   btrename)
-   _files -g '*.torrent(-.)' && return 0
+    _files -g '*.torrent(-.)' && return
   ;;
 
   btmakemetafile)
@@ -69,12 +69,12 @@ case $service in
       '--piece_size_pow2+[specify power of 2 to set the piece size to]:power:' \
       "--comment+[specify human-readable comment to put in .torrent]:comment:"\
       "--target+[specify target file for the torrent]:file:_files"\
-      ':file:_files -g "*"' \
-      && return 0;
+      ':file:_files -g "*"'
+    return
   ;;
 
   btreannounce)
-   _files -g '*.torrent(-.)' && return 0
+    _files -g '*.torrent(-.)' && return
   ;;
 
 # Lastly the tracker.
@@ -94,7 +94,7 @@ case $service in
       "--min_time_between_log_flushes+[specify minimum time between log flushes]:time (s):" \
       "--allowed_dir+[specify directory having downloadable torrents]:directory:_files -/" \
       "--parse_allowed_interval+[specify interval between reloading allowed_dir]:time (min):" \
-      "--show_names+[display names from allowed dir]:enable:(0 1)"\
-      && return 0
-    ;;
+      "--show_names+[display names from allowed dir]:enable:(0 1)"
+    return
+  ;;
 esac
diff --git a/Completion/Unix/Command/_bogofilter b/Completion/Unix/Command/_bogofilter
index 44953cc..ff36e83 100644
--- a/Completion/Unix/Command/_bogofilter
+++ b/Completion/Unix/Command/_bogofilter
@@ -1,7 +1,5 @@
 #compdef bogoutil bogotune bogofilter
 
-local expl ret bogotokens
-
 _bogoutil_caching_policy () {
   local -a oldp
 
@@ -14,6 +12,7 @@ _bogoutil_caching_policy () {
 
 _bogoutil() {
 
+  local bogotokens expl ret=1
 	typeset -a _bogoutil_actions
 	_bogoutil_actions=(-h --help -V --version -d --dump -l --load -u
 		--upgrade -m -w -p -H --db-verify -r -R --db-prune --db-recover
@@ -46,30 +45,27 @@ _bogoutil() {
 	"($_bogoutil_actions)"'--db-remove-environment:database:_files -/' \
 	'--db_lk_max_locks[set max lock count]' \
 	'--db_lk_max_objects[set max object count]' \
-  	"($_bogoutil_actions)"'-h[help]' \
-  	"($_bogoutil_actions)"'--help' \
-  	"($_bogoutil_actions)"'-V[version]' \
-  	"($_bogoutil_actions)"'--version' \
+	"($_bogoutil_actions)"{-h,--help}'[help]' \
+	"($_bogoutil_actions)"{-V,--version}'[version]' \
   	'*:tokens:->tokens' && ret=0
 
   zstyle -s ":completion:${curcontext}:" cache-policy update_policy
   if [[ -z "$update_policy" ]]; then
     zstyle ":completion:${curcontext}:" cache-policy _bogoutil_caching_policy
   fi
-  
+
   case $state in
   	(tokens)
   	if ( [[ -z "$bogotokens" ]] || _cache_invalid bogotokens ) &&
   	  ! _retrieve_cache bogotokens; then
-  	  bogotokens=(${${(f)"$(_call_program bogoutil bogoutil -d ~/.bogofilter/wordlist.db -c 50)"}%% *})
+          bogotokens=(${${(f)"$(_call_program bogotokens bogoutil -d ~/.bogofilter/wordlist.db -c 50)"}%% *})
   	  _store_cache bogotokens bogotokens
-  	else
-  	  :
   	fi
-  	  _wanted tokens expl "token" \
-  	     compadd -a bogotokens
+          _wanted tokens expl "token" compadd -a bogotokens && ret=0
   	;;
   esac
+
+  return ret
 }
 
 case $service in
diff --git a/Completion/Unix/Command/_bpython b/Completion/Unix/Command/_bpython
index c51cc8c..233e032 100644
--- a/Completion/Unix/Command/_bpython
+++ b/Completion/Unix/Command/_bpython
@@ -13,10 +13,10 @@ all_opts=(
 )
 
 urwid_opts=(
-  '(-r --reactor)'{-r,--reactor}'[use Twisted reactor instead of the event loop]:reactor:'
+  '(-r --reactor)'{-r,--reactor}'[use twisted reactor instead of the event loop]:reactor'
   '--help-reactors[display list of available Twisted reactors]'
-  '(-p --plugin)'{-p,--plugin}'[exectue a twistd plugin]:plugin:'
-  '(-s --server)'{-s,--server}'[run an eval server on the given port]:port:'
+  '(-p --plugin)'{-p,--plugin}'[execute a twisted plugin]:plugin'
+  '(-s --server)'{-s,--server}'[run an eval server on the given port]:port:_ports'
 )
 
 gtk_opts=(
@@ -26,19 +26,19 @@ gtk_opts=(
 case "$service" in
   bpython|bpython2|bpython3)
     _arguments \
-      "$all_opts[@]" && return 0
+      "$all_opts[@]"
   ;;
 
   bpython-urwid|bpython2-urwid|bpython3-urwid)
     _arguments \
       "$all_opts[@]" \
-      "$urwid_opts[@]" && return 0
+      "$urwid_opts[@]"
   ;;
 
   bpython-gtk|bpython2-gtk|bpython3-gtk)
     _arguments \
       "$all_opts[@]" \
-      "$gtk_opts[@]" && return 0
+      "$gtk_opts[@]"
   ;;
 esac
 
diff --git a/Completion/Unix/Command/_bzr b/Completion/Unix/Command/_bzr
index c28c214..4a4e5ab 100644
--- a/Completion/Unix/Command/_bzr
+++ b/Completion/Unix/Command/_bzr
@@ -11,12 +11,12 @@ _arguments -C \
 
 if (( ! $+_bzr_cmds )); then
     typeset -gH _bzr_cmds
-    _bzr_cmds=(${(f)"$(_call_program bzr bzr shell-complete)"})
+    _bzr_cmds=(${(f)"$(_call_program subcommands bzr shell-complete)"})
 fi
 
 if [[ $state != 'args' ]]; then
-    _describe -t subcommand 'subcommand' _bzr_cmds
-    return 0
+    _describe -t subcommands 'subcommand' _bzr_cmds
+    return
 fi
 
 cmd="$words[1]"
@@ -25,39 +25,35 @@ curcontext="${curcontext%:*:*}:bzr-$cmd:"
 (( $+functions[_bzr_unknownFiles] )) ||
 _bzr_unknownFiles() {
     local fileList
-    fileList=(${(ps:\0:)"$(bzr ls --null --unknown -R)"})
+    fileList=(${(ps:\0:)"$(_call_program files bzr ls --null --unknown -R)"})
     compadd -af fileList
-    return 0
 }
 
 (( $+functions[_bzr_unknownRoot] )) ||
 _bzr_unknownRoot() {
-    local fileList
-    fileList=(${(ps:\0:)"$(bzr ls --null --from-root --unknown)"})
+    local -a fileList
+    fileList=(${(ps:\0:)"$(_call_program files bzr ls --null --from-root --unknown)"})
     compadd -af fileList
-    return 0
 }
 
 (( $+functions[_bzr_versionedFiles] )) ||
 _bzr_versionedFiles() {
     local fileList
-    fileList=(${(ps:\0:)"$(bzr ls --null --versioned -R)"})
+    fileList=(${(ps:\0:)"$(_call_program files bzr ls --null --versioned -R)"})
     compadd -af fileList
-    return 0
 }
 
 (( $+functions[_bzr_modifiedFiles] )) ||
 _bzr_modifiedFiles() {
     local fileList
-    fileList=(${(ps:\0:)"$(bzr status . --versioned --short | cut -b 5- | tr '\n' '\0')"})
+    fileList=(${(ps:\0:)"$(_call_program files bzr status . --versioned --short | cut -b 5- | tr '\n' '\0')"})
     compadd -af fileList
-    return 0
 }
 
 (( $+functions[_bzr_completeParents] )) ||
 _bzr_completeParents() {
-    local parentFile=$(bzr root 2>/dev/null)/.bzr/branch/parent
-    [[ -r $parentFile ]] && compadd -X "Completing parents" $(cat $parentFile)
+    local parentFile=$(_call_program parents bzr root)/.bzr/branch/parent
+    [[ -r $parentFile ]] && _wanted parents expl parent compadd -- $(<$parentFile)
 }
 
 args=( '(-)'{--help,-h}'[show help message]' )
@@ -99,7 +95,7 @@ case $cmd in
 	'--lightweight[perform a lightweight checkout]'
 	'(-r --revision)'{--revision=,-r}'[the revision to get]:rev:'
 	)
-    _bzr_completeParents
+    _bzr_completeParents && ret=0
     ;;
 
 (rename|move|mv)
@@ -194,7 +190,7 @@ case $cmd in
 	'(-v --verbose)'{--verbose,-v}'[display more information]'
 	'*:local repository:_files -/'
 	)
-    _bzr_completeParents
+    _bzr_completeParents && ret=0
     ;;
 
 (missing)
@@ -210,7 +206,7 @@ case $cmd in
 	'(-v --verbose)'{--verbose,-v}'[display more information]'
 	'*:local repository:_files -/'
 	)
-    _bzr_completeParents
+    _bzr_completeParents && ret=0
     ;;
 
 (commit|checkin|ci)
@@ -227,7 +223,7 @@ case $cmd in
     ;;
 
 (bind|break-lock|reconcile)
-    _bzr_completeParents
+    _bzr_completeParents && ret=0
     ;;
 
 (register-branch)
@@ -240,7 +236,7 @@ case $cmd in
 	'--link-bug=[the bug this branch fixes]:bug-ID:'
 	'--product=[launchpad product short name to associate with the branch]:product:'
 	)
-    _bzr_completeParents
+    _bzr_completeParents && ret=0
     ;;
 
 (remerge)
@@ -249,7 +245,7 @@ case $cmd in
 	'--reprocess[reprocess to reduce spurious conflicts]'
 	'--show-base[show base revision text in conflicts]'
 	)
-    _bzr_completeParents
+    _bzr_completeParents && ret=0
     ;;
 
 (conflicts|added|deleted|modified|unknowns|directories|ignored|unbind|nick|revno|version)
@@ -322,7 +318,7 @@ case $cmd in
 	'--show-base[show base revision text in conflicts]'
 	'*:local repository:_files -/'
 	)
-    _bzr_completeParents
+    _bzr_completeParents && ret=0
     ;;
 
 (ls)
@@ -346,7 +342,7 @@ case $cmd in
 	'(-v --verbose -q --quiet)'{--verbose,-v}'[display more information]'
 	'*:local repository:_files -/'
 	)
-    _bzr_completeParents
+    _bzr_completeParents && ret=0
     ;;
 
 (help)
@@ -355,8 +351,8 @@ case $cmd in
 	'*:subcmds:->cmds'
 	)
     _arguments -s "$args[@]" && ret=0
-    _describe -t subcommand 'subcommand' _bzr_cmds
-    return 0
+    _describe -t subcommands 'subcommand' _bzr_cmds && ret=0
+    return ret
     ;;
 
     # Plugins
@@ -380,7 +376,7 @@ case $cmd in
 	'--remember[remember the specified location as a default]'
 	'*:local repository:_files -/'
 	)
-    _bzr_completeParents
+    _bzr_completeParents && ret=0
     ;;
 
 (clean-tree)
@@ -409,10 +405,11 @@ case $cmd in
     ;;
 
 (*)
-    _message "unknown bzr command completion: $cmd"
-    return 1
+    _default
+    return
     ;;
 esac
 
 _arguments -s "$args[@]" && ret=0
-return $ret
+
+return ret
diff --git a/Completion/Unix/Command/_cdrdao b/Completion/Unix/Command/_cdrdao
index 06b47c9..ad1bf40 100644
--- a/Completion/Unix/Command/_cdrdao
+++ b/Completion/Unix/Command/_cdrdao
@@ -4,108 +4,85 @@
 
 # Command completion and main loop {{{1
 
-_cdrdao_commands () {
-  local -a commands
-
-  commands=(
-    'show-toc:print out a summary of a TOC'
-    'read-toc:create a TOC file based on a CD'
-    'read-cd:create a TOC file and image file based on a CD'
-    'read-cddb:add CD-TEXT data from a CDDB server to a TOC'
-    'show-data:print out samples that would be written to CD'
-    'read-test:check if data described in a TOC can be read from a CD'
-    'disk-info:show information about a CD'
-    'msinfo:generate mkisofs command for creating multi-session CD'
-    'unlock:try to unlock a recorder after a failed run'
-    'blank:blank a CD-RW'
-    'simulate:simulate a write'
-    'write:write a CD based on a TOC'
-    'copy:copy a CD'
-  )
-
-  _describe -t commands 'cdrdao command' commands && ret=0
-}
-
 _cdrdao () {
-  local curcontext=$curcontext ret=1
-
-  local context state line
-  typeset -A opt_args
-  _arguments \
-    ':command:->command' \
-    '*::options:->options' && ret=0
-  case $state in
-    (command)
-      _cdrdao_commands
-      ;;
-    (options)
-      curcontext="${curcontext%:*:*}:cdrdao-$words[1]:"
-      _call_function ret _cdrdao-$words[1]
-      ;;
-  esac
+  local ret=1
+  local -a commands
+  if (( CURRENT == 2 )); then
+    commands=( ${${${(M)${(f)"$(_call_program subcommands cdrdao 2>&1)"}:#  *}// #- /:}#??} )
+    _describe -t subcommands 'cdrdao command' commands && ret=0
+  else
+    local cmd="${words[2]}"
+    local curcontext="${curcontext%:*:*}:cdrdao-$cmd:"
+    shift words
+    (( CURRENT-- ))
+    if ! _call_function ret _cdrdao-$cmd; then
+      _default && ret=0
+    fi
+  fi
 
+  return ret
 }
 
 # Common arguments {{{1
 
-declare -ga tmpfile_args
-tmpfile_args=(
+declare -ga _cdrdao_tmpfile_args
+_cdrdao_tmpfile_args=(
   '--tmpdir[directory to store temporary data in]:directory:_directories'
-  '--keep[do not remove temporary data when done]')
-
-declare -ga device_args
-device_args=(
-  '--device[set SCSI address of the CD recorder]:device:__cdrdao-device'
-  '--driver[use given driver for the CD recorder]:driver:__cdrdao-drivers')
+  '--keep[do not remove temporary data when done]'
+)
 
 # TODO: Gah!  Fix a cddb server spec matcher
-declare -ga cddb_args
-cddb_args=(
+declare -ga _cdrdao_cddb_args
+_cdrdao_cddb_args=(
   '--cddb-servers[specify list of CDDB servers to use]:CDDB servers:'
   '--cddb-timeout[specify timeout in seconds for connections to CDDB servers]: :_guard "[[\:digit\:]]" timeout'
-  '--cddb-directory[directory where fetched CDDB records will be stored]:directory:_directories')
+  '--cddb-directory[directory where fetched CDDB records will be stored]:directory:_directories'
+)
 
-declare -g paranoiamode_arg=
-paranoiamode_arg='--paranoia-mode[set correction mode for digital audio extraction]:mode:(("0\:no checking" "1\:perform overlapped reading to avoid jitter" "2\:like 1 but with checks of read audio data" "3\:like 2 but with scratch detection/repair (default)"))'
+declare -g _cdrdao_paranoiamode_arg
+_cdrdao_paranoiamode_arg='--paranoia-mode[set correction mode for digital audio extraction]:mode:(("0\:no checking" "1\:perform overlapped reading to avoid jitter" "2\:like 1 but with checks of read audio data" "3\:like 2 but with scratch detection/repair (default)"))'
 
-declare -g fasttoc_arg=
-fasttoc_arg='--fast-toc[skip pre-gap-length and index-mark extraction]'
+declare -g _cdrdao_fasttoc_arg
+_cdrdao_fasttoc_arg='--fast-toc[skip pre-gap-length and index-mark extraction]'
 
-declare -g swap_arg=
-swap_arg='--swap[swap the byte order of samples]'
+declare -g _cdrdao_swap_arg
+_cdrdao_swap_arg='--swap[swap the byte order of samples]'
 
-declare -g reload_arg=
-reload_arg='--reload[reload the disk if necessary]'
+declare -g _cdrdao_reload_arg
+_cdrdao_reload_arg='--reload[reload the disk if necessary]'
 
-declare -g eject_arg=
-eject_arg='--eject[eject CD after completed operation]'
+declare -g _cdrdao_eject_arg
+_cdrdao_eject_arg='--eject[eject CD after completed operation]'
 
-declare -g speed_arg=
-speed_arg='-speed[set writing speed]: :_guard "[[\:digit\:]]##" speed'
+declare -g _cdrdao_speed_arg
+_cdrdao_speed_arg='-speed[set writing speed]: :_guard "[[\:digit\:]]##" speed'
 
-declare -ga common_args
-common_args=(
+declare -ga _cdrdao_common_args
+_cdrdao_common_args=(
   '(*)'{-h,--help}'[display command/option summary]'
   '-v[set verbosity level]: :_guard "[[\:digit\:]]##" verbosity')
 
-declare -ga common_toc_args
-common_toc_args=(
-  $common_args
+declare -ga _cdrdao_common_toc_args
+_cdrdao_common_toc_args=(
+  $_cdrdao_common_args
   ':TOC file:_files -g "*.toc(-.)"')
 
-declare -ga common_device_args
-common_device_args=(
-  $common_args
-  $device_args)
-
-declare -ga common_toc_device_args
-common_toc_device_args=(
-  $common_toc_args
-  $common_device_args
-  $force_arg)
-
-declare -ga common_read_args
-common_read_args=(
+declare -ga _cdrdao_common_device_args
+_cdrdao_common_device_args=(
+  $_cdrdao_common_args
+  '--device[set SCSI address of the CD recorder]:device:__cdrdao-device'
+  '--driver[use given driver for the CD recorder]:driver:__cdrdao-drivers'
+)
+
+declare -ga _cdrdao_common_toc_device_args
+_cdrdao_common_toc_device_args=(
+  $_cdrdao_common_toc_args
+  $_cdrdao_common_device_args
+  '--force[force execution of operation]'
+)
+
+declare -ga _cdrdao_common_read_args
+_cdrdao_common_read_args=(
   '--rspeed[set reading speed]: :_guard "[[\:digit\:]]##" speed'
   '--session[specify what session to process on multi-session CDs]: :_guard "[[\:digit\:]]##" "session number"'
   '--read-subchan[set sub-channel reading-mode]:mode:(("rw\:de-interleaved and error corrected" "rw_raw\:not de-interleaved, not error-corrected, and L-EC data included"))'
@@ -128,18 +105,18 @@ _cdrdao-toc-size () {
 
 __cdrdao-show-toc-or-toc-info-or-toc-size () {
   _arguments \
-    $common_toc_args \
-    $tmpfile_args && ret=0
+    $_cdrdao_common_toc_args \
+    $_cdrdao_tmpfile_args
 }
 
 _cdrdao-read-toc () {
-  __cdrdao-read-toc-or-read-cd \
-    $fasttoc_arg
+  __cdrdao-read-toc-or-read-cd $_cdrdao_cddb_args
 }
 
 _cdrdao-read-cd () {
   __cdrdao-read-toc-or-read-cd \
-    $paranoiamode_arg
+    $_cdrdao_paranoiamode_arg \
+    $_cdrdao_cddb_args
 }
 
 __cdrdao-read-toc-or-read-cd () {
@@ -148,30 +125,31 @@ __cdrdao-read-toc-or-read-cd () {
   __cdrdao-read-toc-or-read-cd-or-copy-dependent-args
 
   _arguments \
-    $common_toc_device_args \
-    $common_read_args \
-    $dependent_args
+    $_cdrdao_common_toc_device_args \
+    $_cdrdao_common_read_args \
+    $dependent_args \
+    $_cdrdao_fasttoc_arg \
     '--datafile[set name of data file placed in TOC file]:file:_files' \
     '--read-raw[read data in raw format from CD]' \
     '--no-mode2-mixed[if MODE2_FORM1 or MODE2_FORM2, do not extract as MODE2_FORM_MIX]' \
-    $* && ret=0
+    "$@" && ret=0
 }
 
 _cdrdao-read-cddb () {
   _arguments \
-    $common_toc_args \
-    $cddb_args && ret=0
+    $_cdrdao_common_toc_args \
+    $_cdrdao_cddb_args
 }
 
 _cdrdao-show-data () {
   _arguments \
-    $common_toc_args \
-    $swap_arg && ret=0
+    $_cdrdao_common_toc_args \
+    $_cdrdao_swap_arg
 }
 
 _cdrdao-read-test () {
   _arguments \
-    $common_toc_args && ret=0
+    $_cdrdao_common_toc_args
 }
 
 _cdrdao-disk-info () {
@@ -180,13 +158,18 @@ _cdrdao-disk-info () {
 
 __cdrdao-disk-info-or-drive-info () {
   _arguments \
-    $common_device_args && ret=0
+    $_cdrdao_common_device_args
+}
+
+_cdrdao-discid() {
+  _arguments $_cdrdao_common_device_args $_cdrdao_cddb_args \
+    '--query-string[print out CDDB query only]'
 }
 
 _cdrdao-msinfo () {
   _arguments \
-    $common_device_args \
-    $reload_arg && ret=0
+    $_cdrdao_common_device_args \
+    $_cdrdao_reload_arg
 }
 
 _cdrdao-drive-info () {
@@ -195,22 +178,22 @@ _cdrdao-drive-info () {
 
 _cdrdao-unlock () {
   _arguments \
-    $common_device_args \
-    $reload_arg \
-    $eject_arg && ret=0
+    $_cdrdao_common_device_args \
+    $_cdrdao_reload_arg \
+    $_cdrdao_eject_arg
 }
 
 _cdrdao-blank () {
   _arguments \
-    $common_device_args \
-    $speed_arg \
+    $_cdrdao_common_device_args \
+    $_cdrdao_speed_arg \
     '--blank-mode[set the blanking mode]:blanking mode:(("full\:completely erase data" "minimal\:only dereference data"))' \
-    $eject_arg && ret=0
+    $_cdrdao_eject_arg
 }
 
 _cdrdao-scanbus () {
   _arguments \
-    $common_args && ret=0
+    $_cdrdao_common_args
 }
 
 _cdrdao-simulate () {
@@ -218,26 +201,26 @@ _cdrdao-simulate () {
 }
 
 __cdrdao-simulate-or-write () {
-  local capacity_arg=
-  
+  local _cdrdao_capacity_arg=
+
   if (( $words[(I)--full-burn] )); then
-    capacity_arg='--capacity[set disk capacity for --full-burn]: :_guard "[[\:digit\:]]" minutes'
+    _cdrdao_capacity_arg='--capacity[set disk capacity for --full-burn]: :_guard "[[\:digit\:]]" minutes'
   fi
 
   _arguments \
-    $common_toc_device_args \
-    $speed_arg \
+    $_cdrdao_common_toc_device_args \
+    $_cdrdao_speed_arg \
     '--multi[do not close the session after successful write]' \
     '--overburn[allow overburing of medium]' \
     '--full-burn[force burning to the outer disk edge]' \
-    $capacity_arg \
-    $eject_arg \
-    $swap_arg \
+    $_cdrdao_capacity_arg \
+    $_cdrdao_eject_arg \
+    $_cdrdao_swap_arg \
     '--buffers[set fifo buffer size]: :_guard "[[\:digit\:]]" size' \
-    $reload_arg \
-    $tmpfile_args \
+    $_cdrdao_reload_arg \
+    $_cdrdao_tmpfile_args \
     '-n[do not pause before writing]' \
-    $* && ret=0
+    $*
 }
 
 _cdrdao-write () {
@@ -254,24 +237,24 @@ __cdrdao-read-toc-or-read-cd-or-copy-dependent-args () {
   fi
 
   if (( words[(I)--with-cddb] )); then
-    dependent_args+=$cddb_args
+    dependent_args+=$_cdrdao_cddb_args
   fi
 }
 
 _cdrdao-copy () {
-  local -ga dependent_args
+  local -a dependent_args
 
   __cdrdao-read-toc-or-read-cd-or-copy-dependent-args
 
   _cdrdao-write \
-    $dependent_args
-    $common_read_args
+    $dependent_args \
+    $_cdrdao_common_read_args \
     '--source-device[set SCSI address of the CD reader]:device:__cdrdao-device' \
     '--source-driver[use given driver for the CD reader]:driver:__cdrdao-drivers' \
     '--on-the-fly[perform on-the-fly copy of CD (no image created)]' \
-    $fasttoc_arg \
+    $_cdrdao_fasttoc_arg \
     '--keepimage[do not remove generated image when done]' \
-    $paranoiamode_arg && ret=0
+    $_cdrdao_paranoiamode_arg
 }
 
 # Type completion {{{1
@@ -280,24 +263,21 @@ __cdrdao-device () {
   # Use cdrdao scanbus and also check what OS we're running under and provide
   # additional stuff, like devices (/dev/sg0)
   local -a devices
+  devices=(${${(f)"$(_call_program devices cdrdao scanbus -v 0 2>&1)"}%% :*})
 
-  devices=(${(f)"$(_call_program devices cdrdao scanbus -v 0 2>/dev/null)"})
-  if (( ${#pipestatus:#0} > 0 )); then
-    return 1
-  fi
-
-  _wanted devices expl 'device' compadd - $devices
+  _wanted devices expl 'device' compadd -a devices
 }
 
 __cdrdao-drivers () {
-  local -a drivers
-
-  drivers=(${(f)"$(_call_program drivers cut -d'|' -f4 /usr/share/cdrdao/drivers -s 2>/dev/null | sort -u)"})
-  if (( ${#pipestatus:#0} > 0 )); then
-    return 1
+  local suf
+  local -Ua drivers
+  drivers=(${(f)"$(_call_program drivers cut -d'\|' -f4 /usr/share/cdrdao/drivers -s)"})
+  if compset -P \*:; then
+    _message -e options option
+  else
+    compset -S :\* || suf=-qS:
+    _wanted drivers expl 'driver' compadd $suf -a drivers
   fi
-
-  _wanted drivers expl 'driver' compadd -qS: - $drivers
 }
 
 # }}}1
diff --git a/Completion/Unix/Command/_chmod b/Completion/Unix/Command/_chmod
index 5d3cb2c..48ce050 100644
--- a/Completion/Unix/Command/_chmod
+++ b/Completion/Unix/Command/_chmod
@@ -49,7 +49,7 @@ case "$state" in
       compset -P '*'
       _alternative -O suf \
 	'who:who:((u\:user g\:group a\:all o\:others))' \
-	'operators:operator:(+ - =)'
+	'operators:operator:(+ - =)' && ret=0
     fi
   ;;
   files)
diff --git a/Completion/Unix/Command/_cpio b/Completion/Unix/Command/_cpio
index 280a893..6b07a21 100644
--- a/Completion/Unix/Command/_cpio
+++ b/Completion/Unix/Command/_cpio
@@ -1,17 +1,17 @@
 #compdef cpio
 
 local args ig curcontext="$curcontext" state line
-local expl ret
+local expl ret=1
 local fmts='(bar bin odc newc crc tar ustar hpbin hpodc)'
 
 _pick_variant -r ig gnu=GNU unix --version
 
 if (( CURRENT == 2 )); then
-   # Complete arguments 
+   # Complete arguments
    args=('-o[create archive]' '-i[extract from archive]'
    '-p[run as filter on directory tree]')
    [[ $ig = gnu ]] && args=($args '--create[create archive]'
-   '--extract[extract from archive]' 
+   '--extract[extract from archive]'
    '--pass-through[run as filter on directory tree]'
    '--help[show help text]' '--version[show version information]')
 else
@@ -23,13 +23,13 @@ else
 	   "--format=:format type:$fmts"
 	   '--message=:message at end of volume:'
 	   '--null' '--reset-access-time'
-	   '--verbose' '--dot' '--append' 
+	   '--verbose' '--dot' '--append'
 	   '--block-size=:block size in 512 byte units:'
 	   '--dereference'
 	   '--io-size=:block size in bytes'
 	   '--quiet' '--force-local'  '--help'   '--version')
     fi
-    args=($args
+    args+=(
 	  '-A[append files to archive]'
 	  '-B[block size 5120 bytes with special file]'
 	  '-C[set block size per record]:block size in bytes:(8192)'
@@ -44,10 +44,10 @@ else
     if [[ $ig = gnu ]]; then
       args=('--file=:archive file:->afile'
 	    "--format=:format type:$fmts"
-	    '--make-directories' '--nonmatching' 
+	    '--make-directories' '--nonmatching'
             '--preserve-modification-time' '--numeric'
 	    '--rename' '--list' '--swap-bytes' '--swap-halfwords'
-	    '--dot' '--unconditional' '--verbose' 
+	    '--dot' '--unconditional' '--verbose'
 	    '--block-size=:block size in 512 byte units:'
 	    '--swap-halfwords'
 	    '--io-size=:block size in bytes:'
@@ -58,7 +58,7 @@ else
 	    '--no-absolute-filenames' '--sparse' '--only-verify-crc'
 	    '--quiet' '--help' '--version')
     fi
-    args=($args
+    args+=(
 	  '-b[reverse bytes in word]'
 	  '-B[block size 5120 bytes with special file]'
 	  '-d[create directories as needed]'
@@ -87,7 +87,7 @@ else
 	    '--owner=:user (and group) for files:->user'
 	    '--no-preserve-owner' '--sparse'  '--help'  '--version')
     fi
-    args=($args
+    args+=(
 	  '-d[create directories as needed]'
 	  '-l[link files instead of copying]'
 	  '-L[follow symbolic links]'
@@ -98,12 +98,11 @@ else
   else
     return 1
   fi
-  args=($args
+  args+=(
 	'-a[reset access time of input files]'
 	)
-fi 
+fi
 
-ret=1
 _arguments -C -s "$args[@]" && ret=0
 
 if [[ $state = afile ]]; then
@@ -121,12 +120,12 @@ if [[ $state = afile ]]; then
   fi
 elif [[ $state = user ]]; then
   if compset -P '*[:.]'; then
-    _groups
+    _groups && ret=0
   else
     local suf=.
     [[ $OSTYPE = (solaris|hpux)* ]] && suf=:
     compset -S '.*' && unset suf
-    _users -S "$suf" -q
+    _users -S "$suf" -q && ret=0
   fi
 fi
 
diff --git a/Completion/Unix/Command/_df b/Completion/Unix/Command/_df
index 892f91f..a98180a 100644
--- a/Completion/Unix/Command/_df
+++ b/Completion/Unix/Command/_df
@@ -1,6 +1,6 @@
 #compdef df
 
-local context state state_descr line args spec
+local curcontext="$curcontext" state state_descr line args spec ret=1
 local -A opt_args
 
 if _pick_variant gnu=GNU unix --version; then
@@ -34,6 +34,7 @@ elif [[ "$OSTYPE" == (darwin|freebsd|dragonfly)* ]]; then
     '(-b -g -H -h -k -m)-m[use 1024*1024-byte blocks]'
     '-P[POSIX compliant output]'
     '-a[show all mount points]'
+    '-c[display a grand total]'
     '-i[include inode usage statistics (default)]'
     '-l[only display locally-mounted file systems]'
     '-n[use previously obtained statistics]'
@@ -44,7 +45,7 @@ elif [[ "$OSTYPE" == (darwin|freebsd|dragonfly)* ]]; then
     (darwin*)
       args+=(
         "-T+$spec"
-#       '-t[same as -T (obsolete)]:file system type:->fslist'
+        "!-t+$spec" # obsolete
       )
       ;;
     (freebsd*|dragonfly*)
@@ -61,19 +62,15 @@ else
   )
 fi
 
-_arguments -s -S : $args && return 0
+_arguments -C -s -S : $args && ret=0
 
 case "$state" in
   (fslist)
-    local -a fsys used pre disp expl
-    _file_systems -U -O fsys
-    pre=$IPREFIX
-    # offer 'no' only if at the beginning of the list
-    if ! compset -P '*,' && ! compset -P 'no'; then
-      disp=( 'no  -- exclude file system types in the list' )
-      _wanted list-prefix expl 'prefix to list' compadd -d disp 'no'
-    fi
-    used=( ${(s:,:)${${IPREFIX#$pre}#no}} )
-    _wanted fsys-types expl "$state_descr" compadd -qS , -F used -a fsys
+    [[ ! -prefix *, ]] && ! compset -P 'no' &&
+        _describe -t list-prefixes 'prefix to list' \
+        '( no:exclude\ file\ system\ types\ in\ the\ list )' && ret=0
+    _sequence -s , _file_systems && ret=0
     ;;
 esac
+
+return ret
diff --git a/Completion/Unix/Command/_django b/Completion/Unix/Command/_django
index ac20409..0296876 100644
--- a/Completion/Unix/Command/_django
+++ b/Completion/Unix/Command/_django
@@ -1,26 +1,23 @@
 #compdef django-admin.py django-admin manage.py
 
-local ret=1 state
+local curcontext="$curcontext" state line expl ret=1
 
-if [ "$service" = "manage.py" ] && [ ! -x ./manage.py ]; then
-  return 0
+if [[ "$service" = "manage.py" && ! -x ./manage.py ]]; then
+  _default
+  return
 fi
 
 declare -ga common_args
 common_args=(
   '--help[display help information]'
   '--version[display version information]'
-  '--pythonpath=[directory to add to the Python path]:directory:_directories'
-  '--settings=[Python path to settings module]:settings'
+  '--pythonpath=[directory to add to the Python path]:directory:_directories -W / -P /'
+  '--settings=[python path to settings module]:settings'
   '--traceback[print traceback on exception]'
 )
 
-_directories () {
-  _wanted directories expl directory _path_files -/ "$@" -
-}
-
 typeset -A opt_args
-_arguments \
+_arguments -C \
   $common_args \
   ':subcommand:->subcommand' \
   '*::options:->options' && ret=0
@@ -66,7 +63,7 @@ case $state in
             subcommands+=($cmd)
         fi
     done
-    
+
     _describe -t subcommands 'django admin subcommand' subcommands && ret=0
     ;;
 
@@ -101,8 +98,8 @@ case $state in
           settings="${DJANGO_SETTINGS_MODULE}"
       else
         return 0
-      fi 
-     
+      fi
+
       _wanted appname expl appname compadd - $(command \
         sed -n "/INSTALLED_APPS\s*=\s*(/,/)/p" ${settings} | \
         sed -n "s/^\s*'\(.*\.\)*\(.*\)'.*$/\2 /pg")
@@ -205,7 +202,7 @@ case $state in
         ;;
     esac
 
-    _arguments $args && ret=0
+    _arguments -C $args && ret=0
     ;;
 esac
 
diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git
index c4e386b..38bd729 100644
--- a/Completion/Unix/Command/_git
+++ b/Completion/Unix/Command/_git
@@ -5262,12 +5262,10 @@ __git_gpg_secret_keys () {
 (( $+functions[__git_merge_strategies] )) ||
 __git_merge_strategies () {
   local expl
-  local -a merge_strategies
 
-  merge_strategies=(${=${${(M)${(f)"$(_call_program merge-strategies "git merge -s '' 2>&1")"}:#[Aa]vailable (custom )#strategies are: *}#[Aa]vailable (custom )#strategies are: }%.})
-  __git_command_successful $pipestatus || return 1
-
-  _wanted merge-strategies expl 'merge strategy' compadd $* - $merge_strategies
+  _wanted merge-strategies expl 'merge strategy' compadd "$@" - \
+      ${=${${${(M)${(f)"$(_call_program merge-strategies \
+      "git merge -s '' 2>&1")"}:#[Aa]vailable (custom )#strategies are: *}#[Aa]vailable (custom )#strategies are: }%.}:-octopus ours recursive resolve subtree}
 }
 
 (( $+functions[__git_encodings] )) ||
@@ -5299,8 +5297,9 @@ __git_remotes () {
   local remotes expl
 
   remotes=(${(f)"$(_call_program remotes git remote 2>/dev/null)"})
+  __git_command_successful $pipestatus || return 1
 
-  _wanted remotes expl remote compadd $* - $remotes
+  _wanted remotes expl remote compadd "$@" -a - remotes
 }
 
 (( $+functions[__git_ref_specs] )) ||
@@ -5431,13 +5430,7 @@ __git_reflog_entries () {
   reflog_entries=(${${${(f)"$(_call_program reflog-entries git reflog 2>/dev/null)"}#* }%%:*})
   __git_command_successful $pipestatus || return 1
 
-  if compset -P '*@'; then
-    reflog_entries=(${${(M)reflog_entries:#$IPREFIX*}#$IPREFIX})
-    _wanted reflog-entries expl 'reflog entry' compadd $* - $reflog_entries
-  else
-    reflog_entries=(${reflog_entries%@*})
-    _wanted reflog-entries expl 'reflog entry' compadd -qS @ $* - $reflog_entries
-  fi
+  _wanted reflog-entries expl 'reflog entry' _multi_parts @ reflog_entries
 }
 
 (( $+functions[__git_ref_sort_keys] )) ||
@@ -5492,7 +5485,7 @@ __git_stashes () {
   stashes=(${${(f)"$(_call_program stashes git stash list 2>/dev/null)"}/: */})
   __git_command_successful $pipestatus || return 1
 
-  _wanted stashes expl stash compadd $* - $stashes
+  _wanted stashes expl stash compadd "$@" -a - stashes
 }
 
 (( $+functions[__git_svn_revisions] )) ||
@@ -5531,7 +5524,7 @@ __git_branch_names () {
   branch_names=(${${(f)"$(_call_program branchrefs git for-each-ref --format='"%(refname)"' refs/heads 2>/dev/null)"}#refs/heads/})
   __git_command_successful $pipestatus || return 1
 
-  _wanted branch-names expl branch-name compadd $* - $branch_names
+  _wanted branch-names expl branch-name compadd "$@" -a - branch_names
 }
 
 (( $+functions[__git_remote_branch_names] )) ||
@@ -5542,7 +5535,7 @@ __git_remote_branch_names () {
   branch_names=(${${(f)"$(_call_program remote-branch-refs git for-each-ref --format='"%(refname)"' refs/remotes 2>/dev/null)"}#refs/remotes/})
   __git_command_successful $pipestatus || return 1
 
-  _wanted remote-branch-names expl 'remote branch name' compadd $* - $branch_names
+  _wanted remote-branch-names expl 'remote branch name' compadd "$@" -a - branch_names
 }
 
 (( $+functions[__git_remote_branch_names_noprefix] )) ||
@@ -5553,7 +5546,7 @@ __git_remote_branch_names_noprefix () {
   branch_names=(${${${(f)"$(_call_program remote-branch-refs-noprefix git for-each-ref --format='"%(refname)"' refs/remotes 2>/dev/null)"}##*/}:#HEAD})
   __git_command_successful $pipestatus || return 1
 
-  _wanted remote-branch-names-noprefix expl 'remote branch name' compadd $* - $branch_names
+  _wanted remote-branch-names-noprefix expl 'remote branch name' compadd "$@" -a - branch_names
 }
 
 (( $+functions[__git_commits] )) ||
@@ -5582,7 +5575,7 @@ __git_heads () {
     done
   fi
 
-  _wanted heads expl head compadd $* - $heads
+  _wanted heads expl head compadd "$@" -a - heads
 }
 
 (( $+functions[__git_commit_objects] )) ||
@@ -5678,7 +5671,7 @@ __git_submodules () {
   submodules=(${${${(f)"$(_call_program submodules git submodule 2>/dev/null)"}#?* }%% *})
   __git_command_successful $pipestatus || return 1
 
-  _wanted submodules expl submodule compadd $* - $submodules
+  _wanted submodules expl submodule compadd "$@" -a - submodules
 }
 
 # Tag Argument Types
@@ -5691,7 +5684,7 @@ __git_tags () {
   tags=(${${(f)"$(_call_program tagrefs git for-each-ref --format='"%(refname)"' refs/tags 2>/dev/null)"}#refs/tags/})
   __git_command_successful $pipestatus || return 1
 
-  _wanted tags expl tag compadd $* - $tags
+  _wanted tags expl tag compadd "$@" -a - tags
 }
 
 (( $+functions[__git_commit_tags] )) ||
@@ -5714,7 +5707,7 @@ __git_tags_of_type () {
   tags=(${${(M)${(f)"$(_call_program $type-tag-refs "git for-each-ref --format='%(*objecttype)%(objecttype) %(refname)' refs/tags 2>/dev/null")"}:#$type(tag|) *}#$type(tag|) refs/tags/})
   __git_command_successful $pipestatus || return 1
 
-  _wanted $type-tags expl "$type tag" compadd $* - $tags
+  _wanted $type-tags expl "$type tag" compadd "$@" -a - tags
 }
 
 # Reference Argument Types
@@ -5737,7 +5730,7 @@ __git_references () {
     _git_refs_cache_pwd=$PWD
   fi
 
-  _wanted references expl 'references' compadd - $_git_refs_cache
+  _wanted references expl 'reference' compadd -a - _git_refs_cache
 }
 
 (( $+functions[__git_local_references] )) ||
@@ -5750,7 +5743,7 @@ __git_local_references () {
     _git_local_refs_cache_pwd=$PWD
   fi
 
-  _wanted references expl 'references' compadd - $_git_local_refs_cache
+  _wanted references expl 'reference' compadd -a - _git_local_refs_cache
 }
 
 (( $+functions[__git_remote_references] )) ||
@@ -5766,7 +5759,7 @@ __git_notes_refs () {
   notes_refs=(${${(f)"$(_call_program notes-refs git for-each-ref --format='"%(refname)"' refs/notes 2>/dev/null)"}#$type refs/notes/})
   __git_command_successful $pipestatus || return 1
 
-  _wanted notes-refs expl 'notes ref' compadd $* - $notes_refs
+  _wanted notes-refs expl 'notes ref' compadd "$@" -a - notes_refs
 }
 
 # File Argument Types
@@ -6406,7 +6399,6 @@ __git_config_values () {
 # Git Config Sections and Types
 (( $+functions[__git_browsers] )) ||
 __git_browsers () {
-  integer ret=1
   local expl
   declare -a userbrowsers builtinbrowsers
 
@@ -6431,16 +6423,9 @@ __git_browsers () {
     cygstart
     xdg-open)
 
-  _tags user-browsers builtin-browsers
-
-  while _tags; do
-    _requested user-browsers expl 'user-defined browser' compadd $* - $userbrowsers && ret=0
-    _requested builtin-browsers expl 'builtin browser' compadd $* - $builtinbrowsers && ret=0
-
-    (( ret )) || break
-  done
-
-  return ret
+  _alternative \
+    'user-browsers:user-defined browser:compadd -a - userbrowsers' \
+    'builtin-browsers:builtin browser:compadd -a - builtinbrowsers'
 }
 
 (( $+functions[__git_difftools] )) ||
@@ -6483,10 +6468,10 @@ __git_diff-or-merge-tools () {
   esac
 
   while _tags; do
-    _requested user-difftools expl 'user-defined difftool' compadd $* - $userdifftools && ret=0
-    _requested user-mergetools expl 'user-defined mergetool' compadd $* - $usermergetools && ret=0
-    _requested builtin-difftools expl 'builtin difftool' compadd $* - $builtindifftools && ret=0
-    _requested builtin-mergetools expl 'builtin mergetool' compadd $* - $builtinmergetools && ret=0
+    _requested user-difftools expl 'user-defined difftool' compadd "$@" -a - userdifftools && ret=0
+    _requested user-mergetools expl 'user-defined mergetool' compadd "$@" -a - usermergetools && ret=0
+    _requested builtin-difftools expl 'builtin difftool' compadd "$@" -a - builtindifftools && ret=0
+    _requested builtin-mergetools expl 'builtin mergetool' compadd "$@" -a - builtinmergetools && ret=0
 
     (( ret )) || break
   done
@@ -6577,20 +6562,18 @@ __git_sendemail_suppresscc_values () {
 
 (( $+functions[__git_colors] )) ||
 __git_colors () {
-  declare -a colors
+  declare -a expl
 
-  colors=(black red green yellow blue magenta cyan white)
-
-  _describe -t colors color colors $*
+  _wanted colors expl color compadd "$@" - \
+      black red green yellow blue magenta cyan white
 }
 
 (( $+functions[__git_color_attributes] )) ||
 __git_color_attributes () {
-  declare -a attributes
-
-  attributes=(bold dim ul blink reverse)
+  declare -a expl
 
-  _describe -t attributes attribute attributes $*
+  _wanted attributes expl attribute compadd "$@" - \
+      bold dim ul blink reverse
 }
 
 # Now, for the main drive...
@@ -6657,12 +6640,12 @@ _git() {
       (option-or-argument)
         curcontext=${curcontext%:*:*}:git-$words[1]:
 
-        if (( $+functions[_git-$words[1]] )); then
-          _call_function ret _git-$words[1]
-        elif zstyle -T :completion:$curcontext: use-fallback; then
-          _files && ret=0
-        else
-          _message 'unknown sub-command'
+	if ! _call_function ret _git-$words[1]; then
+	  if zstyle -T :completion:$curcontext: use-fallback; then
+	    _default && ret=0
+	  else
+	    _message "unknown sub-command: $words[1]"
+	  fi
         fi
         ;;
     esac
diff --git a/Completion/Unix/Command/_less b/Completion/Unix/Command/_less
index ede54a4..a3ba8f6 100644
--- a/Completion/Unix/Command/_less
+++ b/Completion/Unix/Command/_less
@@ -24,8 +24,8 @@ if compset -P '+[-0-9]#'; then
     g:goto\ line
     F:scroll\ to\ end\ and\ keep\ reading\ file
     G:go\ to\ end\ of\ file
-    %:go\ to\ position\ in\ file 
-    p:go\ to\ position\ in\ file 
+    %:go\ to\ position\ in\ file
+    p:go\ to\ position\ in\ file
   )'
   return
 fi
@@ -101,9 +101,9 @@ if [[ -n "$state" ]]; then
     ;;
     tags)
       if (( $+LESSGLOBALTAGS )); then
-        _global_tags
+        _global_tags && ret=0
       else
-        _ctags_tags
+        _ctags_tags && ret=0
       fi
     ;;
   esac
diff --git a/Completion/Unix/Command/_lha b/Completion/Unix/Command/_lha
index 5a238d8..c2d5e7d 100644
--- a/Completion/Unix/Command/_lha
+++ b/Completion/Unix/Command/_lha
@@ -5,16 +5,16 @@ if (( CURRENT == 2 )); then
 
     local lhacmds
     lhacmds=(
-	'(  x l v u d m c p t)a[Add \(Or replace\) to archive]'
-	'(a   l v u d m c p t)x[EXtract from archive]'
-	'(a x   v u d m c p t)l[List]'
-	'(a x l   u d m c p t)v[Verbose List]'
-	'(a x l v   d m c p t)u[Update newer files to archive]'
-	'(a x l v u   m c p t)d[Delete from archive]'
-	'(a x l v u d   c p t)m[Move to archive]'
-	'(a x l v u d m   p t)c[re-Construct new archive]'
-	'(a x l v u d m c   t)p[Print to STDOUT from archive]'
-	'(a x l v u d m c p  )t[Test file CRC in archive]'
+	'(  x l v u d m c p t)a[add \(or replace\) to archive]'
+	'(a   l v u d m c p t)x[extract from archive]'
+	'(a x   v u d m c p t)l[list]'
+	'(a x l   u d m c p t)v[verbose List]'
+	'(a x l v   d m c p t)u[update newer files to archive]'
+	'(a x l v u   m c p t)d[delete from archive]'
+	'(a x l v u d   c p t)m[move to archive]'
+	'(a x l v u d m   p t)c[re-construct new archive]'
+	'(a x l v u d m c   t)p[print to stdout from archive]'
+	'(a x l v u d m c p  )t[test file CRC in archive]'
     )
 
     if [ "${words[2]#-}" != "" ]; then
@@ -23,22 +23,22 @@ if (( CURRENT == 2 )); then
 	    'q[quiet]'
 	    'n[not execute]'
 	    'f[force\(over write at extract\)]'
-	    't[FILES are TEXT file]'
-	    'e[TEXT code convert from/to EUC]'
-	    'g[Generic format \(for compatibility\)]'
+	    't[files are text files]'
+	    'e[text code convert from/to EUC]'
+	    'g[use generic format \(for compatibility\)]'
 	)
 	case ${words[2]#-} in
 	    a*|u*)
 		lhacmds=($lhacmds
-		    'd[delete FILES after]'
-		    'z[files not compress]'
+		    'd[delete files after]'
+		    "z[don't compress files]"
 		    '(  1 2)0[header level 0]'
 		    '(0   2)1[header level 1]'
 		    '(0 1  )2[header level 2]'
 		)
 		;;
 	    c*)
-		lhacmds=($lhacmds 'd[delete FILES after]')
+		lhacmds=($lhacmds 'd[delete files after]')
 		;;
 	    x*)
 		lhacmds=($lhacmds 'i[ignore directory path]')
@@ -46,32 +46,25 @@ if (( CURRENT == 2 )); then
 	esac
     fi
 
-    _values -s '' 'lha command' \
-	$lhacmds \
-	&& return 0
+    _values -s '' 'lha command' $lhacmds
 elif (( CURRENT == 3 )); then
-    _arguments -C \
-	'*:LHA file:_files -g \*.lzh' && return 0
+    _wanted files expl 'lha file' _files -g '*.lzh(-.)'
 else
     case ${words[2]#-} in
 	l*|x*|d*)
 	    if [ -f "$words[3]" ]; then
-		_lzh_cache_list=`$words[1] lq $words[3] | awk '{print $8}'`
+		_lzh_cache_list=`$words[1] lq $words[3] | awk '{print $NF}'`
 		_lzh_cache_list=("${(@f)${_lzh_cache_list}}")
 		
 		_wanted files expl 'file from archive' _multi_parts / _lzh_cache_list
-
-		return 0
 	    else
-		_message -r "Archive file is not found : ${words[3]}"
+		_message -r "archive file is not found : ${words[3]}"
 		return 1
 	    fi
 		
 	    ;;
 	*)
-	    _arguments -C \
-		'*:file:_files' && return 0
+	    _files
+	;;
     esac
 fi
-
-return 0
diff --git a/Completion/Unix/Command/_metaflac b/Completion/Unix/Command/_metaflac
index 14095e9..65b9eb2 100644
--- a/Completion/Unix/Command/_metaflac
+++ b/Completion/Unix/Command/_metaflac
@@ -1,16 +1,13 @@
 #compdef metaflac
 
 local _metaflac_opts _metaflac_shorts _metaflac_opers
-typeset -A opt_args
-function _metaflac_tags () {
-    echo "\n\nBEEP - $line - BEEP\n\n"
-}
-_metaflac_opts=( 
-    '--preserve-modtime' 
-    '--with-filename[prefix output with filename]' 
-    '--no-filename' 
+
+_metaflac_opts=(
+    '--preserve-modtime'
+    '--with-filename[prefix output with filename]'
+    '--no-filename'
     '--no-utf8-convert'
-    '--dont-use-padding[always rewrite the file]' 
+    '--dont-use-padding[always rewrite the file]'
 )
 _metaflac_shorts=(
     '--show-md5sum'
@@ -23,7 +20,7 @@ _metaflac_shorts=(
     '--show-bps'
     '--show-total-samples'
     '--show-vendor-tag'
-    '--show-tag=:FLAC tags:_metaflac_tags'
+    '--show-tag=:FLAC tags'
     '--remove-tag=:FLAC tags: '
     '--remove-first-tag=:FLAC tags: '
     '--remove-all-tags'
@@ -51,9 +48,7 @@ _metaflac_opers=(
 
 _arguments "$_metaflac_opts[@]" \
     "*:FLAC file:_files -g \*.flac\(-.\)" \
-    - "shortcuts" \
+  - "shortcuts" \
     "$_metaflac_shorts[@]" \
-    - "(operations)" \
-    "$_metaflac_opers[@]" \
-    && return 0
-
+  - "(operations)" \
+    "$_metaflac_opers[@]"
diff --git a/Completion/Unix/Command/_module b/Completion/Unix/Command/_module
index c1c9f5c..060f05b 100644
--- a/Completion/Unix/Command/_module
+++ b/Completion/Unix/Command/_module
@@ -52,9 +52,9 @@ _module()
   )
 
   if (( CURRENT == 1 )); then
-    _describe -t commands 'module command' _module_cmds || compadd "$@"
+    _describe -t commands 'module command' _module_cmds
   else
-    local curcontext="$curcontext"
+    local curcontext="$curcontext" ret
 
     cmd="${${_module_cmds[(r)$words[1]:*]%%:*}}"
     # Deal with any aliases
@@ -65,7 +65,7 @@ _module()
       show) cmd="display";;
       keyword) cmd="apropos";;
     esac
-                
+
     if (( $#cmd ));
     then
       local update_policy
@@ -132,7 +132,7 @@ _module_available_modules()
 {
   _arguments -s \
     '(-a --append)'{--append,-a}'[append the directories instead of prepending]' \
-    '*:directory:_files -/'    
+    '*:directory:_files -/'
 }
 
 # Completion function for unuse
diff --git a/Completion/Unix/Command/_monotone b/Completion/Unix/Command/_monotone
index 83e18e3..bcaab87 100644
--- a/Completion/Unix/Command/_monotone
+++ b/Completion/Unix/Command/_monotone
@@ -1,8 +1,22 @@
 #compdef mtn
 
-local context state line ret
-typeset -a cmds
-typeset -A opt_args
+local -a cmds
+cmds=(
+  automate:automation db:database fdiff:debug fload:debug fmerge:debug
+  get_roster:debug identify:debug rcs_import:debug annotate:informative
+  cat:informative complete:informative diff:informative help:informative
+  list:informative log:informative ls:informative show_conflicts:informative
+  status:informative cert:key+cert chkeypass:key+cert dropkey:key+cert
+  genkey:key+cert trusted:key+cert pull:network push:network serve:network
+  sync:network privkey:packet\ i/o pubkey:packet\ i/o read:packet\ i/o
+  cvs_import:rcs approve:review comment:review disapprove:review tag:review
+  testresult:review checkout:tree co:tree explicit_merge:tree heads:tree
+  merge:tree merge_into_dir:tree migrate_workspace:tree propagate:tree
+  refresh_inodeprints:tree setup:tree set:vars unset:vars add:workspace
+  attr:workspace ci:workspace commit:workspace drop:workspace mv:workspace
+  pivot_root:workspace pluck:workspace rename:workspace revert:workspace
+  rm:workspace update:workspace
+)
 
 _arguments \
   '--brief[print a brief version of the normal output]' \
@@ -25,17 +39,5 @@ _arguments \
   '--ticker[set ticker style]:ticker style:(count dot none)' \
   '--version[print version number, then exit]' \
   '(-@ --xargs)'{-@,--xargs}'[insert command line arguments taken from the given file]:file:_files' \
-  '*:command:->cmd' && return 0
-
-case "$state" in
-  (cmd)
-  if (( CURRENT == 2 )); then
-    cmds=(automate:automation db:database fdiff:debug fload:debug fmerge:debug get_roster:debug identify:debug rcs_import:debug annotate:informative cat:informative complete:informative diff:informative help:informative list:informative log:informative ls:informative show_conflicts:informative status:informative cert:key+cert chkeypass:key+cert dropkey:key+cert genkey:key+cert trusted:key+cert pull:network push:network serve:network sync:network privkey:packet\ i/o pubkey:packet\ i/o read:packet\ i/o cvs_import:rcs approve:review comment:review disapprove:review tag:review testresult:review checkout:tree co:tree explicit_merge:tree heads:tree merge:tree merge_into_dir:tree migrate_workspace:tree propagate:tree refresh_inodeprints:tree setup:tree set:vars unset:vars add:workspace attr:workspace ci:workspace commit:workspace drop:workspace mv:workspace pivot_root:workspace pluck:workspace rename:workspace revert:workspace rm:workspace update:workspace)
-    _describe -t commands 'cmds' cmds && ret=0
-  else
-    _files
-  fi
-  ;;
-esac
-
-return ret
+  '1:command: _describe -t commands command cmds' \
+  '*:file:_files'
diff --git a/Completion/Unix/Command/_mpc b/Completion/Unix/Command/_mpc
index 1270767..11eab84 100644
--- a/Completion/Unix/Command/_mpc
+++ b/Completion/Unix/Command/_mpc
@@ -68,21 +68,21 @@ _mpc_command() {
   )
 
   if (( CURRENT == 1 )); then
-    _describe -t command "mpc commands" mpc_cmds
+    _describe -t commands "mpc command" mpc_cmds
   else
-    local curcontext="$curcontext"
+    local cmd=$words[1]
+    local curcontext="${curcontext%:*}:mpc-${cmd}" ret=1
+    if ! _call_function ret _mpc_$cmd; then
+      _default && ret=0
+    fi
+    return ret
   fi
-
-  local cmd=$words[1]
-
-  local curcontext="${curcontext%:*}:mpc-${cmd}"
-  _call_function ret _mpc_$cmd
 }
 
 _mpc_helper_bool() {
   local expl states
   states=(on off yes no 1 0 true false)
-  _wanted states expl boolean compadd $expl -a states
+  _wanted states expl boolean compadd -a states
 }
 
 (( $+functions[_mpc_helper_songnumbers] )) ||
@@ -100,7 +100,7 @@ _mpc_helper_songnumbers() {
     NM="$compstate[nmatches]"
   fi
 
-  out=("${(@f)$(_call_program song-numbers mpc $foo playlist 2>/dev/null)}")
+  out=("${(@f)$(_call_program song-numbers mpc $foo playlist)}")
   out=("${(@M)out[@]:#${~MATCH}}")
 
   sn=("${(@)${(@M)out}//(#b)(#s)(\#|[ >]#)([0-9]#)*/$match[2]}")
diff --git a/Completion/Unix/Command/_netcat b/Completion/Unix/Command/_netcat
index 396fc8e..4e4006b 100644
--- a/Completion/Unix/Command/_netcat
+++ b/Completion/Unix/Command/_netcat
@@ -1,11 +1,10 @@
 #compdef nc netcat
 
-local curcontext="$curcontext" state line expl
-typeset -A opt_args
-
 # handle name clash with the nedit client
-[[ $service = nc ]] && ! _pick_variant netcat=connect nedit -h &&
-    _nedit && return
+if [[ $service = nc ]] && ! _pick_variant netcat=connect nedit -h; then
+  _nedit
+  return
+fi
 
 if (( ! $+_nc_args )); then
   local help="$(_call_program options $words[1] -h < /dev/null 2>&1)"
@@ -14,17 +13,17 @@ if (( ! $+_nc_args )); then
     '*-e prog*' '-e+[program to exec after connect]:prog:_command_names -e'
      '*-g gateway*' '-g+[source-routing hop point]:gateway:_hosts'
      '*-G num*' '-G[source-routing pointer: 4, 8, 12]'
-     '*-i secs*' '-i+[delay interval for lines sent or ports scanned]:secs:'
+     '*-i secs*' '-i+[delay interval for lines sent or ports scanned]:delay (secs)'
      '*-l*' '-l[listen mode]'
      '*-n*' '-n[numeric-only IP addresses, no DNS]'
      '*-o file*' '-o+[hex dump of traffic]:file:_files'
      '*-p port*' '-p+[local port number]:port:_ports'
      '*-r*' '-r[randomize local and remote ports]'
-     '*-q secs*' '-q+[quit after EOF on stdin and delay of secs]:secs:'
+     '*-q secs*' '-q+[quit after EOF on stdin and delay of secs]:delay (secs)'
      '*-t*' '-t[answer TELNET negotiation]'
      '*-u*' '-u[UDP mode]'
      '*-v*' '-v[verbose]'
-     '*-w secs*' '-w+[timeout for connects and final net reads]:secs:'
+     '*-w secs*' '-w+[timeout for connects and final net reads]:timeout (secs)'
      '*-z*' '-z[zero-I/O mode]'
      '*-x*' '-x'
      '*-b*' '-b[allow broadcasts]'
@@ -32,7 +31,7 @@ if (( ! $+_nc_args )); then
   _nc_args=($optionmap[(K)"$help"])
 fi
 
-_arguments -C -s \
+_arguments -s \
   "$_nc_args[@]" \
   ':host:_hosts' \
-  ':port:_ports' && return 0
+  ':port:_ports'
diff --git a/Completion/Unix/Command/_notmuch b/Completion/Unix/Command/_notmuch
index b576d2b..d6cc58d 100644
--- a/Completion/Unix/Command/_notmuch
+++ b/Completion/Unix/Command/_notmuch
@@ -57,12 +57,15 @@ _notmuch_search()
 
 _notmuch()
 {
+  local ret=1
   if (( CURRENT > 2 )) ; then
     local cmd=${words[2]}
     curcontext="${curcontext%:*:*}:notmuch-$cmd"
     (( CURRENT-- ))
     shift words
-    _call_function ret _notmuch_$cmd
+    if ! _call_function ret _notmuch_$cmd; then
+      _default && ret=0
+    fi
     return ret
   else
     _notmuch_commands
diff --git a/Completion/Unix/Command/_pkg-config b/Completion/Unix/Command/_pkg-config
index 48b788a..e44b368 100644
--- a/Completion/Unix/Command/_pkg-config
+++ b/Completion/Unix/Command/_pkg-config
@@ -1,6 +1,6 @@
 #compdef pkg-config
 
-local arguments packages curcontext="$curcontext" stat line
+local arguments packages curcontext="$curcontext" state line ret=1
 declare -A opt_args
 
 arguments=(
@@ -11,31 +11,33 @@ arguments=(
       "--print-errors[cause errors to be printed]"
       "--silence-errors[prevent the printing of errors]"
       "--errors-to-stdout[print errors to stdout rather than stderr]"
-      "--cflags[prints the preprocessor and compile flags]"
+      "--cflags[print the preprocessor and compiler flags]"
       "--cflags-only-I[output -I flags only]"
       "--cflags-only-other[output cflags not covered by the cflags-only-I option]"
       "--debug[show verbose debug information]"
-      "--libs[prints the link flags]"
-      "--libs-only-L[prints the -L and -R parts of \"--libs\"]"
-      "--libs-only-l[prints the -l part of \"--libs\"]"
+      "--libs[print the link flags]"
+      "--libs-only-L[print the -L and -R parts of \"--libs\"]"
+      "--libs-only-l[print the -l part of \"--libs\"]"
       "--libs-only-other[output other libs]"
       "--list-all[list all known packages]"
       "--variable=[return the value of the specified variable]:variable"
       "--define-variable=[set the global value for a variable]:name value pair"
-      "--uninstalled[return successfully if any \"-uninstalled\" packages are being used and fails otherwise]"
-      "--exists[tests whether the package exists or not]"
+      "--uninstalled[return success if any \"-uninstalled\" packages are being used]"
+      "--exists[test whether the package exists or not]"
       "--atleast-version=[test whether the version is at least that of the specified value]:least value"
       "--exact-version=[test whether the version is exactly that of the specified value]:exact value"
       "--max-version=[test whether the version is no greater than some specific value]:max version"
 #      "--msvc-syntax[output linker flags in a form compatible with MSVC++ (Windows only)]"
 #      "--dont-define-prefix[disables automatic overiding of the variable \"prefix\" (Windows only)]"
 #      "--prefix-variable=[set the name of the variable \"prefix\" (Windows only)]:prefix value"
-      "*:package name:->package"
+      "*: :->packages"
 )
 
-_arguments -C $arguments
+_arguments -C $arguments && ret=0
 
 if [[ -n $state ]] ; then
-    packages=( ${(f)"$((pkg-config --list-all | cut -d' ' -f1) 2>/dev/null)"} )
-    compadd -a - packages
+  packages=( ${${(f)"$(_call_program packages pkg-config --list-all)"}%% *} )
+  _wanted packages expl 'package' compadd -a - packages && ret=0
 fi
+
+return ret
diff --git a/Completion/Unix/Command/_prove b/Completion/Unix/Command/_prove
index 75e83c3..1f21423 100644
--- a/Completion/Unix/Command/_prove
+++ b/Completion/Unix/Command/_prove
@@ -45,7 +45,7 @@ _arguments \
   '--source=[load or configure a SourceHandler]:source:' \
   {-a,--archive}'[store output in archive file]:file:_files' \
   {-j,--jobs}'[run N jobs in parallel]:jobs:' \
-  '*--state=[control persistent state]:state:' \
+  '*--state=[control persistent state]: :_values -s , state last failed passed all hot todo slow fast new old fresh save' \
   '--rc=[custom rcfile]:file:_files' \
-  '*:file or directory:_files' \
-  && return 0
+  '*--rules=[limit tests run (or not) in parallel]:rules' \
+  '*:file or directory:_files'
diff --git a/Completion/Unix/Command/_rar b/Completion/Unix/Command/_rar
index 1e3a261..e2081f6 100644
--- a/Completion/Unix/Command/_rar
+++ b/Completion/Unix/Command/_rar
@@ -38,7 +38,7 @@ common=(
 case $service in
   unrar)
     if (( CURRENT == 2 )); then
-       _values 'rar command' \
+      _values 'rar command' \
 	'e[extract files to current directory]' \
 	'l[list archive]' \
 	'lt[list archive (technical format)]' \
@@ -48,7 +48,7 @@ case $service in
 	'v[verbosely list archive]' \
 	'vt[verbosely list archive (technical format)]' \
 	'vb[verbosely list archive (bare format)]' \
-	'x[extract files with full path]' && return
+	'x[extract files with full path]'
     else
       _arguments -S \
 	'-ep3[expand paths to full including the drive letter]' \
@@ -58,7 +58,7 @@ case $service in
 	'-n+:file to include:_files' \
 	'-n@+:file of files to include:_files' \
         "$common[@]" \
-        '*:RAR files:_files -g \*.rar\(-.\)' && return
+        '*:RAR files:_files -g \*.rar\(-.\)'
     fi
   ;;
   rar)
@@ -89,7 +89,7 @@ case $service in
 	'v[verbosely list archive]' \
 	'vt[verbosely list archive (technical format)]' \
 	'vb[verbosely list archive (bare format)]' \
-	'x[extract files with full path]' && return
+	'x[extract files with full path]'
     else
       _arguments -S \
 	'-ag[generate archive name using the current date]' \
@@ -126,7 +126,7 @@ case $service in
 	'-w+[assign work directory]:work directory:_files -/' \
 	"$common[@]" \
 	'-z+[read archive comment from file]:comment file:_files' \
-	'*:files:_files' && return
+	'*:files:_files'
     fi
   ;;
 esac
diff --git a/Completion/Unix/Command/_rsync b/Completion/Unix/Command/_rsync
index 7bad03a..79d8243 100644
--- a/Completion/Unix/Command/_rsync
+++ b/Completion/Unix/Command/_rsync
@@ -35,10 +35,10 @@ if compset -P '*::*/' || compset -P 'rsync://*/*/'; then
   # attrs  size  date  time  name
 
   _wanted files expl 'remote file or directory' \
-      compadd -d remdispf ${${${${remdispf##[^ ]## ##}##[^ ]## ##}##[^ ]## ##}##[^ ]## ##}
+      compadd -d remdispf ${${${${remdispf##[^ ]## ##}##[^ ]## ##}##[^ ]## ##}##[^ ]## ##} && ret=0
 
   _wanted files expl 'remote file or directory' \
-      compadd -S/ -d remdispd ${${${${remdispd##[^ ]## ##}##[^ ]## ##}##[^ ]## ##}##[^ ]## ##}
+      compadd -S/ -d remdispd ${${${${remdispd##[^ ]## ##}##[^ ]## ##}##[^ ]## ##}##[^ ]## ##} || (( ! ret ))
 
 elif compset -P 1 '*::' || compset -P 1 'rsync://*/'; then
 
diff --git a/Completion/Unix/Command/_rubber b/Completion/Unix/Command/_rubber
index 09e289a..f66540a 100644
--- a/Completion/Unix/Command/_rubber
+++ b/Completion/Unix/Command/_rubber
@@ -15,24 +15,24 @@ else
 fi
 
 _rubber_args=(
-      \*{-c,--command}'=[run the directive CMD before parsing]:command'
-      \*{-e,--epilogue}'=[run the directive CMD after parsing]:command'
-      {-z,--gzip}'[compress the final document]'
-      '(- *)'{-h,--help}'[show help]'
-      '--into=[go to directory DIR before compiling]:directory:_files -/'
-      {-l,--landscape}'[change paper orientation (if relevant)]'
-      {-n,--maxerr}'=[display at most NUM errors]:num'
-      \*{-m,--module}'=[use module]:module:($_rubber_modules)'
-      '--only=[only include the specified SOURCES]:sources'
-      \*{-o,--post}'=[postprocess with module]:postprocessor:($_rubber_modules)'
-      {-d,--pdf}'[produce PDF output instead of DVI]'
-      {-p,--ps}'[produce a PostScript document]'
-      {-q,--quiet}'[suppress messages]'
-      \*{-r,--read}'[read additional directives from a file]:directives files:_files'
-      {-s,--short}'[display errors in a compact form]'
-      \*{-I,--texpath}'=[add DIR to the search path for LaTeX]:tex path:_files -/'
-      \*{-v,--verbose}'[increase verbosity]'
-      '--version[print version information and exit]'
+  \*{-c,--command}'=[run specified directive command before parsing]:command'
+  \*{-e,--epilogue}'=[run specified directive command after parsing]:command'
+  '(-z --gzip)'{-z,--gzip}'[compress the final document]'
+  '(- *)'{-h,--help}'[show help information]'
+  '--into=[go to specified directory before compiling]:directory:_files -/'
+  '(-l --landscape)'{-l,--landscape}'[change paper orientation (if relevant)]'
+  '(-n --maxerr)'{-n,--maxerr}'=[display at most specified number of errors]:number'
+  \*{-m,--module}'=[use module]:module:($_rubber_modules)'
+  '--only=[only include the specified sources]:sources'
+  \*{-o,--post}'=[postprocess with module]:postprocessor:($_rubber_modules)'
+  '(-d --pdf -p -ps)'{-d,--pdf}'[produce PDF output instead of DVI]'
+  '(-p -ps -d --pdf)'{-p,--ps}'[produce a PostScript document]'
+  {-q,--quiet}'[suppress messages]'
+  \*{-r,--read}'[read additional directives from a file]:directives files:_files'
+  {-s,--short}'[display errors in compact form]'
+  \*{-I,--texpath}'=[add directory to the search path for LaTeX]:tex path:_files -/'
+  \*{-v,--verbose}'[increase verbosity]'
+  '--version[print version information and exit]'
 )
 
 case "$service" in
@@ -42,17 +42,15 @@ case "$service" in
       '--clean[remove produced files instead of compiling]' \
       {-f,--force}'[force at least one compilation]' \
       '--inplace[compile the documents from their source directory]' \
-      \*{-W,--warn}'=[report warnings of the given TYPE]:warnings:(all boxes misc refs)' \
+      \*{-W,--warn}'=[report warnings of the given type]:warnings:(all boxes misc refs)' \
       '*:LaTeX files:_files -g "*.(tex|dtx|lhs|w)(-.)"'
-      return 0
 	;;
 	
   rubber-pipe)
     _arguments -s \
       "$_rubber_args[@]" \
       {-k,--keep}'[keep the temporary files after compiling]' \
-      \*{-W,--warn}'=[report warnings of the given TYPE]:warnings:(all boxes misc refs)'
-      return 0
+      \*{-W,--warn}'=[report warnings of the given type]:warnings:(all boxes misc refs)'
 	;;
 	
   rubber-info)
@@ -65,8 +63,5 @@ case "$service" in
       '--refs[show the list of undefined references]' \
       '--warnings[show all LaTeX warnings]' \
       ':LaTeX file:_files -g "*.(tex|dtx|lhs|w)(-.)"'
-      return 0
   ;;
 esac
-
-return 1
diff --git a/Completion/Unix/Command/_screen b/Completion/Unix/Command/_screen
index 931946c..510fd71 100644
--- a/Completion/Unix/Command/_screen
+++ b/Completion/Unix/Command/_screen
@@ -1,20 +1,8 @@
 #compdef screen
 
-local curcontext="$curcontext" state line expl
+local curcontext="$curcontext" state line expl ret=1
 local scr_cmds sessions
 
-function __screen_normal() {
-    if (( CURRENT == 1 )) && [[ $PREFIX == /dev/* ]]; then
-        _path_files -g '*(%)'
-    elif (( CURRENT == 2 )) && [[ ${words[1]} == /dev/* ]]; then
-        _message "baud rate"
-    elif (( CURRENT > 2 )) && [[ ${words[1]} == /dev/* ]]; then
-        _message "no more parameters"
-    else
-        _normal "$@"
-    fi
-}
-
 scr_cmds=(
   acladd            aclchg            acldel            aclgrp
   aclumask          activity          addacl            allpartial
@@ -103,10 +91,21 @@ _arguments -C \
   '-Dx: :->any-sessions' \
   '-dx: :->any-sessions' \
   '-X[execute command as a screen command in the specified session]:screencmd:(${scr_cmds[@]})' \
-  '*::arguments: __screen_normal'
+  '*:: :->normal' && ret=0
 
 if [[ -n $state ]]; then
   case $state in
+    normal)
+      if (( CURRENT == 1 )) && [[ $PREFIX == /dev/* ]]; then
+	  _path_files -g '*(%)'
+      elif (( CURRENT == 2 )) && [[ ${words[1]} == /dev/* ]]; then
+	  _message "baud rate"
+      elif (( CURRENT > 2 )) && [[ ${words[1]} == /dev/* ]]; then
+	  _message "no more parameters"
+      else
+	  _normal
+      fi
+    ;;
     attached-sessions)
       sessions=(
         ${${${(M)${(f)"$(_call_program screen-sessions $words[1] \
@@ -134,4 +133,6 @@ if [[ -n $state ]]; then
     _wanted screen-sessions expl "${state%-*} screen process" \
 	compadd ${sessions#*.}
   fi
-fi
+fi && ret=0
+
+return ret
diff --git a/Completion/Unix/Command/_stgit b/Completion/Unix/Command/_stgit
index 6248267..f313f65 100644
--- a/Completion/Unix/Command/_stgit
+++ b/Completion/Unix/Command/_stgit
@@ -40,11 +40,11 @@ else
 	  compadd ${${(M)${(f)"$(stg series 2> /dev/null)"}##[+>] *}#[+>] } \
 		  && ret=0
       else
-	_files
+	_files && ret=0
       fi
     ;;
     (*)
-      _files
+      _files && ret=0
     ;;
   esac
 fi
diff --git a/Completion/Unix/Command/_strip b/Completion/Unix/Command/_strip
index 06f7243..726d87c 100644
--- a/Completion/Unix/Command/_strip
+++ b/Completion/Unix/Command/_strip
@@ -1,6 +1,6 @@
 #compdef strip
 
-local curcontext=$curcontext state line ret=0
+local curcontext=$curcontext state line ret=1
 declare -A opt_args
 declare -a args
 
@@ -11,8 +11,8 @@ if _pick_variant gnu=GNU solaris --version; then
     local expl
 
     _description files expl 'command-line-options file'
-    _files $expl && ret=0
-    return $ret
+    _files "$expl[@]"
+    return
   fi
   args=(
     '(-F --target)'{-F+,--target=}'[object code format to use]:bfd name:->bfdnames'
@@ -52,9 +52,9 @@ case $state in
     local expl
     declare -a bfdnames
 
-    bfdnames=(${=${(M)${(f)"$(_call_program bfdnames strip --help 2>/dev/null)"}:#strip: supported targets: *}#strip: supported targets: })
+    bfdnames=(${=${(M)${(f)"$(_call_program bfdnames strip --help)"}:#strip: supported targets: *}#strip: supported targets: })
     _describe -t bfdnames 'bfd name' bfdnames && ret=0
     ;;
 esac
 
-return $ret
+return ret
diff --git a/Completion/Unix/Command/_systemd b/Completion/Unix/Command/_systemd
index d2a7895..028ecdd 100644
--- a/Completion/Unix/Command/_systemd
+++ b/Completion/Unix/Command/_systemd
@@ -132,9 +132,9 @@ _hosts_or_user_at_host()
   )
 
   if (( CURRENT == 1 )); then
-    _describe -t commands 'systemctl command' _systemctl_cmds || compadd "$@"
+    _describe -t commands 'systemctl command' _systemctl_cmds
   else
-    local curcontext="$curcontext"
+    local curcontext="$curcontext" ret
 
     cmd="${${_systemctl_cmds[(r)$words[1]:*]%%:*}}"
     # Deal with any aliases
diff --git a/Completion/Unix/Command/_telnet b/Completion/Unix/Command/_telnet
index c7ab34f..1674eed 100644
--- a/Completion/Unix/Command/_telnet
+++ b/Completion/Unix/Command/_telnet
@@ -12,8 +12,8 @@ if (( ! $+_telnet_args )); then
   local help="$(_call_program options 'telnet -\?' < /dev/null 2>&1)"
   local -A optionmap
   optionmap=(
-    '*\[-4\]*' '-4[Force IPv4 address resolution]'
-    '*\[-6\]*' '-6[Force IPv6 address resolution]'
+    '*\[-4\]*' '-4[force IPv4 address resolution]'
+    '*\[-6\]*' '-6[force IPv6 address resolution]'
     '*\[-8\]*' '-8[allow 8-Bit data]'
     '*\[-E\]*' '-E[disable an escape character]'
     '*\[-K\]*' '-K[no automatic login]'
@@ -52,16 +52,16 @@ _arguments -C -s \
 case "$state" in
 ssl)
   _values -w 'SSL parameter' \
-    'debug[Send SSL debugging info to stderr]' \
-    '(nossl)ssl[Negotiate SSL connection]' \
-    '(ssl)nossl[Switch off SSL negotiation]' \
-    'certrequired[Require server certificate]' \
-    'secure[No fallback to unencrypted mode]' \
-    'verbose[Be verbose about certificates, etc.]' \
-    'verify[Set SSL verify flags]:int:' \
-    'cert[Specify certificate file]:certificate file:_path_files' \
-    'key[Specify key file]:key file:_path_files' \
-    'cipher[Set preferred cipher list]:ciphers:'
+    'debug[send SSL debugging info to stderr]' \
+    '(nossl)ssl[negotiate SSL connection]' \
+    '(ssl)nossl[switch off SSL negotiation]' \
+    'certrequired[require server certificate]' \
+    'secure[no fallback to unencrypted mode]' \
+    'verbose[be verbose about certificates, etc.]' \
+    'verify[set SSL verify flags]:int' \
+    'cert[specify certificate file]:certificate file:_path_files' \
+    'key[specify key file]:key file:_path_files' \
+    'cipher[set preferred cipher list]:cipher' && ret=0
   ;;
 
 hosts)
diff --git a/Completion/Unix/Command/_tidy b/Completion/Unix/Command/_tidy
index fce7190..ec2d742 100644
--- a/Completion/Unix/Command/_tidy
+++ b/Completion/Unix/Command/_tidy
@@ -123,6 +123,4 @@ _arguments \
   '--css-prefix:CSS class name:' \
   '--accessibility-check:priority level:(${access[@]})' \
   '--newline:newline character:(LF CRLF CR)' \
-  '*:file:_files' && return
-
-return 1
+  '*:file:_files'
diff --git a/Completion/Unix/Command/_tmux b/Completion/Unix/Command/_tmux
index 5a4a2d7..f0cc4be 100644
--- a/Completion/Unix/Command/_tmux
+++ b/Completion/Unix/Command/_tmux
@@ -1490,7 +1490,7 @@ function __tmux-windows() {
 # And here is the actual _tmux(), that puts it all together:
 function _tmux() {
     local curcontext="${curcontext}"
-    local mode state ret
+    local mode state ret=1
     local -a args
     local -x tmuxcommand
     unset tmux_describe
@@ -1508,22 +1508,22 @@ function _tmux() {
         '-v[request verbose logging]'
         '*:: :->subcommand_or_options'
     )
-    _arguments -C -s -w ${args} && return
+    _arguments -C -s -w ${args} && ret=0
 
     if [[ ${state} == "subcommand_or_options" ]]; then
         if (( CURRENT == 1 )) ; then
             zstyle -s ":completion:${curcontext}:subcommands" mode mode || mode='both'
             if [[ ${mode} == 'commands' ]]; then
-                _describe -t subcommands 'tmux commands' _tmux_commands
+                _describe -t subcommands 'tmux commands' _tmux_commands && ret=0
             elif [[ ${mode} == 'aliases' ]]; then
-                _describe -t subcommands 'tmux aliases' _tmux_aliases
+                _describe -t subcommands 'tmux aliases' _tmux_aliases && ret=0
             else
-                _describe -t subcommands 'tmux commands and aliases' _tmux_commands -- _tmux_aliases
+                _describe -t subcommands 'tmux commands and aliases' _tmux_commands -- _tmux_aliases && ret=0
             fi
         else
             if (( ${+commands[tmux]} == 0 )); then
                 _message '`tmux'\'' not found in $path; sub-cmd completions disabled.'
-                return 0
+                return
             fi
             tmuxcommand="${words[1]}"
             if [[ -n ${_tmux_aliasmap[$tmuxcommand]} ]] ; then
@@ -1545,6 +1545,7 @@ function _tmux() {
             _call_function ret _tmux-${tmuxcommand}
         fi
     fi
+    return ret
 }
 
 # description generation follows; only done on 1st _tmux call.
diff --git a/Completion/Unix/Command/_vcsh b/Completion/Unix/Command/_vcsh
index 47dbd9e..ddce876 100644
--- a/Completion/Unix/Command/_vcsh
+++ b/Completion/Unix/Command/_vcsh
@@ -1,18 +1,13 @@
 #compdef vcsh
 
 function __vcsh_repositories () {
-	local expl
 	local -a repos
-	repos=( ${(f)"$(command vcsh list)"} )
-	_describe -t repos 'repositories' repos
-}
-
-function __vcsh_not_implemented_yet () {
-	_message "Subcommand completion '${1#*-}': not implemented yet"
+	repos=( ${(f)"$(_call_program repositories vcsh list)"} )
+	_describe -t repositories 'repository' repos
 }
 
 function _vcsh-clone () {
-	__vcsh_not_implemented_yet "$0" #TODO
+	_default #TODO
 }
 
 function _vcsh-delete () {
@@ -52,9 +47,11 @@ function _vcsh-push () {
 }
 
 function _vcsh-rename () {
-	(( CURRENT == 2 )) && __vcsh_repositories
-	(( CURRENT == 3 )) && _message "new repository name"
-	(( CURRENT > 3 )) && _nothing
+  case $CURRENT in
+    2) __vcsh_repositories ;;
+    3) _message "new repository name" ;;
+    *) _nothing ;;
+  esac
 }
 
 function _vcsh-run () {
@@ -83,7 +80,7 @@ function _vcsh-write-gitignore () {
 }
 
 function _vcsh () {
-	local curcontext="${curcontext}"
+	local curcontext="${curcontext}" ret=1
 	local state vcshcommand
 	local -a args subcommands
 
@@ -112,24 +109,25 @@ function _vcsh () {
 		'*:: :->subcommand_or_options_or_repo'
 	)
 
-	_arguments -C ${args} && return
+	_arguments -C ${args} && ret=0
 
 	if [[ ${state} == "subcommand_or_options_or_repo" ]]; then
 		if (( CURRENT == 1 )); then
-			_describe -t subcommands 'vcsh sub-commands' subcommands
-			__vcsh_repositories
+			_describe -t subcommands 'vcsh sub-commands' subcommands && ret=0
+			__vcsh_repositories && ret=0
 		else
 			vcshcommand="${words[1]}"
 			if ! (( ${+functions[_vcsh-$vcshcommand]} )); then
 				# There is no handler function, so this is probably the name
 				# of a repository. Act accordingly.
-				_dispatch git git
+				_dispatch git git && ret=0
 			else
 				curcontext="${curcontext%:*:*}:vcsh-${vcshcommand}:"
 				_call_function ret _vcsh-${vcshcommand}
 			fi
 		fi
 	fi
+	return ret
 }
 
 _vcsh "$@"
diff --git a/Completion/Unix/Command/_zpool b/Completion/Unix/Command/_zpool
index 0f18eef..03ebd06 100644
--- a/Completion/Unix/Command/_zpool
+++ b/Completion/Unix/Command/_zpool
@@ -12,7 +12,7 @@ _zpool() {
 	)
 
 	versions=(
-		${${${(M)"${(f)$(zpool upgrade -v)}":#[[:space:]]#<->*}##[[:space:]]}%%[[:space:]]*}
+		${${${(M)"${(f)$(_call_program versions zpool upgrade -v)}":#[[:space:]]#<->*}##[[:space:]]}%%[[:space:]]*}
 	)
 
 	ro_props=(
@@ -87,15 +87,12 @@ _zpool() {
 
 	if [[ $service == "zpool" ]]; then
 		_arguments -C -A "-*" \
-			'-\?[Help]' \
-			'*::command:->subcmd' && return 0
+			'-\?[show help information]' \
+			'1:subcommand:compadd -a subcmds' \
+			'*:: :->subcmd' && return
 
-		if (( CURRENT == 1 )); then
-			_wanted commands expl "zpool subcommand" compadd -a subcmds
-			return
-		fi
 		service="$words[1]"
-		curcontext="${curcontext%:*}=$service:"
+		curcontext="${curcontext%:*}-$service:"
 	fi
 
 	case $service in
diff --git a/Completion/Unix/Type/_users b/Completion/Unix/Type/_users
index 3c8c702..2ea3b14 100644
--- a/Completion/Unix/Type/_users
+++ b/Completion/Unix/Type/_users
@@ -3,8 +3,8 @@
 local expl users
 
 if zstyle -a ":completion:${curcontext}:users" users users; then
-    _wanted users expl user compadd "$@" -a - users
-    return 0
+  _wanted users expl user compadd "$@" -a - users
+  return
 fi
 
 _wanted users expl user compadd "$@" -k - userdirs
diff --git a/Completion/X/Command/_urxvt b/Completion/X/Command/_urxvt
index b7ea06b..661897c 100644
--- a/Completion/X/Command/_urxvt
+++ b/Completion/X/Command/_urxvt
@@ -1,6 +1,6 @@
-#compdef rxvt urxvt urxvtc
+#compdef rxvt urxvt urxvtc urxvt256c urxvt256cc urxvt256c-ml urxvt256c-mlc
 
-local curcontext="$curcontext" state line expl
+local curcontext="$curcontext" state line expl ret=1
 local -a suf long_args
 typeset -A opt_args
 typeset -U extensions
diff --git a/Completion/X/Command/_x_utils b/Completion/X/Command/_x_utils
index 9448fd3..05a899b 100644
--- a/Completion/X/Command/_x_utils
+++ b/Completion/X/Command/_x_utils
@@ -1,12 +1,13 @@
 #compdef xdpyinfo xwininfo xkill xfontsel xfd xev xhost xon xsetroot xwd xwud xrdb xprop xlsatoms
 
-local ret=1 oret expl
+local curcontext="$curcontext" state line expl ret=1
 
 case "$service" in
 xdpyinfo)
   _x_arguments \
     -queryExtensions \
-    '-ext:extension: _x_extension -a'
+    '-ext:extension: _x_extension -a' \
+    -version
   ;;
 xwininfo)
   _x_arguments \
@@ -16,7 +17,7 @@ xwininfo)
     '(-name -root)-id:id: _x_window'
   ;;
 xprop)
-  _x_arguments \
+  _x_arguments -C \
     -{help,frame,notype,spy} \
     '-grammar[show grammar for command line options]' \
     '(-id -name)-root[use the root window as the target window]' \
@@ -28,16 +29,17 @@ xprop)
     '*-remove[specify an atom to remove from the target window]:atoms:->atoms' \
     '*-set[specify an atom and a value to set on the target window]:atoms:->atoms:value' \
     '*-f:atoms:->atoms:format: ::dformat' \
-    '*:atoms:->atoms' && ret=0
+    '*:atoms:->atoms'
   ;;
 xlsatoms)
-  _x_arguments \
+  _x_arguments -C \
     '*-format[printf-style format to use]:format' \
     '*-range[atom values to list]:[num]-[num]' \
     '*-name[name of single atom to print]:atom:->atoms'
   ;;
 xkill)
   _x_arguments \
+    -version \
     -frame \
     '(-id)-all' \
     '(-all)-id:window: _x_window' \
@@ -45,14 +47,16 @@ xkill)
   ;;
 xfontsel)
   _xt_arguments \
-    -{print,noscaled} \
+    -{print,scaled} \
     '-pattern:font pattern:_x_font' \
     '-sample:sample text' \
-    '-sample16:16-bit sample text'
+    '-sample16:16-bit sample text' \
+    '-sampleUCS:ISO10646 sample text'
   ;;
 xfd)
   _xt_arguments \
     '-fn:font: _x_font' \
+    '-fa:font: _xft_fonts' \
     -{box,center} \
     '-start:first character number' \
     '-bc:box border color:_x_color' \
@@ -66,7 +70,8 @@ xev)
     '-id:id:_x_window' \
     '-s[use save-under]' \
     '-name:window name' \
-    '-rv'
+    '-rv' \
+    '*-event:event mask:(keyboard mouse expose visibility structure substructure focus property colormap owner_grab_button randr)'
   ;;
 xhost)
   local type tmp match
@@ -120,8 +125,8 @@ xhost)
           'types:name family:compadd -S: - inet dnet nis krb' \
 	  'hosts:: _hosts' && ret=0
     fi
-    return ret
   fi
+  return ret
   ;;
 xon)
   _arguments \
@@ -165,7 +170,7 @@ xwud)
   ;;
 xrdb)
   _x_arguments \
-    -{help,quiet,symbols,retain} \
+    -{help,quiet,symbols,retain,version} \
     '(-all -screen -screens)-global' \
     '(-global -screen -screens)-all' \
     '(-global -all -screens)-screen' \
@@ -185,12 +190,10 @@ xrdb)
     '*-I-:include directory:_files -/' \
     '*:defaults file:_files'
   ;;
-esac
+esac && ret=0
 
-oret=$?
 if [[ $state == atoms ]]; then
   _wanted atoms expl atoms compadd ${${(f)"$(_call_program atoms xlsatoms 2> /dev/null)"}#*$'\t'} && ret=0
-else
-  ret=$oret
 fi
+
 return ret



Messages sorted by: Reverse Date, Date, Thread, Author