zsh-workers
 help / color / mirror / code / Atom feed
* PATCH: returning early breaks prefix-needed
@ 2003-06-25  8:44 Oliver Kiddle
  0 siblings, 0 replies; only message in thread
From: Oliver Kiddle @ 2003-06-25  8:44 UTC (permalink / raw)
  To: Zsh workers

There's quite a few places in the completion system where we do
something like:

  _arguments '-a' '-b' '*:param:->params' && return 0

This stops a prefix-needed style set to false from working. The options
are added so it returns and the state never gets a chance. With
prefix-needed set to false, both options and the state should be
completed.

_arguments itself has a similar problem but I've not done anything to
it yet.

Oliver

Index: Completion/AIX/Command/_smit
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/AIX/Command/_smit,v
retrieving revision 1.1
diff -u -r1.1 _smit
--- Completion/AIX/Command/_smit	2 Apr 2001 12:20:13 -0000	1.1
+++ Completion/AIX/Command/_smit	25 Jun 2003 08:29:11 -0000
@@ -18,10 +18,8 @@
   '-v[verbose]' \
   '-x[do not run any execute commands]' \
   '-X[do not run any commands]' \
-  '1:fastpath:->fastpath' && return 0
+  '1:fast path:->fastpath'
 
-[[ "$state" = fastpath ]] &&
+[[ "$state" = fastpath ]] && (( $+commands[odmget] )) &&
   _wanted fastpaths expl 'fast path' compadd \
       $(odmget sm_cmd_hdr sm_name_hdr|sed -n 's/^	id = \"\(.*\)\"/\1/p')
-
-  
Index: Completion/Linux/Command/_modutils
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Linux/Command/_modutils,v
retrieving revision 1.2
diff -u -r1.2 _modutils
--- Completion/Linux/Command/_modutils	16 Apr 2003 13:30:29 -0000	1.2
+++ Completion/Linux/Command/_modutils	25 Jun 2003 08:29:11 -0000
@@ -1,6 +1,6 @@
 #compdef lsmod modinfo modprobe rmmod
 
-local curcontext="$curcontext" expl state line modules ign args
+local curcontext="$curcontext" expl state line modules ign args ret=1
 
 args=(
   '(-)'{-V,--version}'[print version]'
@@ -18,7 +18,7 @@
       '(-)'{-l,--license}"[display the module's license]" \
       '(-)'{-n,--filename}"[display the module's filename]" \
       '(-)'{-p,--parameters}'[display the typed parameters that a module may support]' \
-      '1:module file:->all_modules' && return
+      '1:module file:->all_modules' && ret=0
   ;;
 
   modprobe)
@@ -37,7 +37,7 @@
       "(-r --remove -l --list -t --type -a --all $ign)"{-r,--remove}'[remove module (stacks)]' \
       "(* -l --list -r --remove $ign)"{-l,--list}'[list matching modules]' \
       "(-c $ign)1:modules:->all_modules" \
-      "(-c -l --list -t --type $ign)*:params:->params" && return
+      "(-c -l --list -t --type $ign)*:params:->params" && ret=0
       
       [[ -n $state ]] && (( $+opt_args[-r] )) && state=loaded_modules        
   ;;
@@ -49,7 +49,7 @@
       '(-r --stacks)'{-r,--stacks}'[remove a module stack]' \
       '(-s --syslog)'{-s,--syslog}'[output to syslog]' \
       '(-v --verbose)'{-v,--verbose}'[be verbose]' \
-      '*:loaded module:->loaded_modules' && return
+      '*:loaded module:->loaded_modules' && ret=0
   ;;
 esac 
 
@@ -80,4 +80,4 @@
   ;;
 esac
 
-return 1
+return ret
Index: Completion/Linux/Command/_uml
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Linux/Command/_uml,v
retrieving revision 1.2
diff -u -r1.2 _uml
--- Completion/Linux/Command/_uml	25 Apr 2003 11:19:08 -0000	1.2
+++ Completion/Linux/Command/_uml	25 Jun 2003 08:29:12 -0000
@@ -12,6 +12,7 @@
     _arguments \
       '-unix[listen on specified pair of sockets]:control socket: :data socket' \
       '-hub[act like a hub]'
+    return
   ;;
   uml_mconsole)
     if (( CURRENT == 2 )); then
@@ -46,7 +47,7 @@
       '(* -)--version[display kernel version number]' \
       '(* -)--help[print usage information]' \
       '(* -)--showconfig[show kernel configuration]' \
-      '(-)*:option:->option' && return
+      '(-)*:option:->option' && ret=0
   ;;
   tunctl)
     _arguments \
@@ -55,6 +56,7 @@
       '(-d)-u[specify owner]:owner:_users' \
       '(-b -u -t)-d[specify devicename to delete]:device name:(tap{0..9})' \
       '(-d)-t[specify devicename]:device name:(tap{0..9})'
+    return
   ;;
 esac
 
Index: Completion/Unix/Command/_ant
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Unix/Command/_ant,v
retrieving revision 1.5
diff -u -r1.5 _ant
--- Completion/Unix/Command/_ant	17 Feb 2003 10:20:32 -0000	1.5
+++ Completion/Unix/Command/_ant	25 Jun 2003 08:29:12 -0000
@@ -1,7 +1,7 @@
 #compdef ant -value-,ANT_ARGS,-default-
 
 typeset -A opt_args
-local buildfile tmp state line curcontext="$curcontext"
+local buildfile tmp state line curcontext="$curcontext" ret=1
 local c target='*:target:->target'
 
 c=( $ANT_HOME/lib/*.jar )
@@ -30,7 +30,7 @@
   '-propertyfile[load properties from specified file]:property file:_files' \
   '-inputhandler[specify class which will handle input requests]:class:_java_class -cp ${(j.\:.)c}' \
   '(-f -file -buildfile)-find[search for build file towards the root of filesystem]:build file:(build.xml)' \
-  $target && return
+  $target && ret=0
 
 case $state in
   property)
@@ -78,7 +78,7 @@
           esac
 	done
       )//$'\015'}"
-      _describe 'target' tmp
+      _describe 'target' tmp && ret=0
     else
       if [[ -n $opt_args[-find] ]]; then
 	buildfile=( (../)#${opt_args[-find]:-build.xml}(N[-1]) )
@@ -87,10 +87,12 @@
       fi
       if [[ -f $buildfile ]]; then
 	targets=( $(sed -n 's/ *<target name="\([^"]*\)".*/\1/p' < $buildfile) )
-	_wanted targets expl target compadd -a targets
+	_wanted targets expl target compadd -a targets && ret=0
       else
 	_message -e targets target
       fi
     fi
   ;;
 esac
+
+return ret
Index: Completion/Unix/Command/_arp
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Unix/Command/_arp,v
retrieving revision 1.1
diff -u -r1.1 _arp
--- Completion/Unix/Command/_arp	2 Apr 2001 11:45:27 -0000	1.1
+++ Completion/Unix/Command/_arp	25 Jun 2003 08:29:12 -0000
@@ -7,7 +7,7 @@
  '(-a -s -f 1)-d[delete entry from table]:host:->hostintable' \
  '(-a -d -f 1)-s[create an arp entry]:host:_hosts:ethernet address::*:option:(temp trail pub)' \
  '(-a -d -s 1)-f[read multiple entries from file]:file:_files' \
- '(-a)1:host:->hostintable' && return 0
+ '(-a)1:host:->hostintable'
 
 [[ "$state" = hostintable ]] &&
   _wanted hosts expl 'host' compadd ${${${(f)"$(${words[1]} -a)"}##[ ?(]#}%%[ )]*}
Index: Completion/Unix/Command/_bzip2
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Unix/Command/_bzip2,v
retrieving revision 1.3
diff -u -r1.3 _bzip2
--- Completion/Unix/Command/_bzip2	26 Sep 2002 10:30:01 -0000	1.3
+++ Completion/Unix/Command/_bzip2	25 Jun 2003 08:29:12 -0000
@@ -1,6 +1,6 @@
 #compdef bzip2 bunzip2 bzcat=bunzip2 bzip2recover -redirect-,<,bunzip2=bunzip2 -redirect-,>,bzip2=bunzip2 -redirect-,<,bzip2=bzip2
 
-local decompress expl state line curcontext="$curcontext"
+local decompress expl state line curcontext="$curcontext" ret=1
 typeset -A opt_args
 
 case "$service" in
@@ -39,7 +39,7 @@
     '(-1 -2 -3 -4 -5 -6    -8 -9)-7' \
     '(-1 -2 -3 -4 -5 -6 -7    -9)-8' \
     '(-1 -2 -3 -4 -5 -6 -7 -8	)-9' \
-    '*:files:->files' && return 0
+    '*:files:->files' && ret=0
   ;;
 esac
 
@@ -49,11 +49,11 @@
       $+opt_args[--test] )) && unset decompress
   if [[ -z "$decompress" ]]; then
     _description files expl 'compressed file'
-    _files "$expl[@]" -g '*.(bz2|tbz|tbz2)' && return 0
+    _files "$expl[@]" -g '*.(bz2|tbz|tbz2)' && return
   else
     _description files expl 'file to compress'
-    _files "$expl[@]" -g '*~*.(bz2|tbz|tbz2)' && return 0
+    _files "$expl[@]" -g '*~*.(bz2|tbz|tbz2)' && return
   fi
 fi
 
-return 1
+return ret
Index: Completion/Unix/Command/_compress
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Unix/Command/_compress,v
retrieving revision 1.2
diff -u -r1.2 _compress
--- Completion/Unix/Command/_compress	14 Mar 2002 14:38:53 -0000	1.2
+++ Completion/Unix/Command/_compress	25 Jun 2003 08:29:12 -0000
@@ -1,6 +1,6 @@
 #compdef compress uncompress -redirect-,<,uncompress=uncompress -redirect-,>,compress=uncompress -redirect-,<,compress=compress
 
-local expl state line bits common_args1 common_args2 decompress
+local expl state line bits common_args1 common_args2 decompress ret=1
 local curcontext="$curcontext"
 typeset -A opt_args
 bits=( {9..16} )
@@ -23,14 +23,14 @@
       "-b[specify maximum number of bits used to replace common substring]:bits:(${bits[*]})" \
       '-C[produce output compatible with BSD 2.0]' \
       '(-b -C)-d[decompress]' \
-      "${common_args2[@]}" && return 0
+      "${common_args2[@]}" && ret=0
   ;;
   uncompress)
-    _arguments -C -s "${common_args2[@]}" && return 0
+    _arguments -C -s "${common_args2[@]}" && ret=0
     decompress=yes
   ;;
   zcat)
-    _arguments -C -s "${common_args1[@]}" && return 0
+    _arguments -C -s "${common_args1[@]}" && ret=0
     decompress=yes
   ;;
 esac
@@ -38,11 +38,11 @@
 if [[ "$state" = files ]]; then
   if [[ -z "$decompress" ]] || (( $+opt_args[-d] )); then
     _description files expl 'file to compress'
-    _files "$expl[@]" -g '*~*.Z' && return 0
+    _files "$expl[@]" -g '*~*.Z' && return
   else
     _description files expl 'compressed file'
-    _files "$expl[@]" -g '*.Z' && return 0
+    _files "$expl[@]" -g '*.Z' && return
   fi
 fi
 
-return 1
+return ret
Index: Completion/Unix/Command/_elinks
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Unix/Command/_elinks,v
retrieving revision 1.3
diff -u -r1.3 _elinks
--- Completion/Unix/Command/_elinks	17 Feb 2003 10:24:55 -0000	1.3
+++ Completion/Unix/Command/_elinks	25 Jun 2003 08:29:12 -0000
@@ -25,7 +25,7 @@
   '(1)*-stdin[read document from stdin]::boolean:(0 1)' \
   '*-touch-files[touch files in ~/.elinks when running with -no-connect/-session-ring]::boolean:(0 1)' \
   '(- 1)-version[print version information and exit]' \
-  '1:url:->url' && return
+  '1:url:->url' && ret=0
 
 if [[ "$state" = url ]]; then
   local elinks_bookmarks
@@ -40,4 +40,4 @@
     'urls:url:_urls' && return
 fi
 
-return 1
+return ret
Index: Completion/Unix/Command/_finger
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Unix/Command/_finger,v
retrieving revision 1.1
diff -u -r1.1 _finger
--- Completion/Unix/Command/_finger	2 Apr 2001 11:50:18 -0000	1.1
+++ Completion/Unix/Command/_finger	25 Jun 2003 08:29:12 -0000
@@ -1,10 +1,10 @@
 #compdef finger
 
-local curcontext="$curcontext" state line match
+local curcontext="$curcontext" state line match ret=1
 typeset -A opt_args
 
 if (( ! $+_finger_args )); then
-  local help="$(_call_program options finger -\? 2>&1)"
+  local help="$(_call_program options finger -\\\? 2>&1)"
   local -A optionmap
 
 ## `finger -\?':
@@ -69,10 +69,12 @@
   fi
 fi
 
-_arguments -C -s $_finger_args '*:finger targets:->finger-targets' && return 0
+_arguments -C -s $_finger_args '*:finger targets:->finger-targets' && ret=0
 
 case "$state" in
 finger-targets)
-  _user_at_host -t other-accounts "$@"
+  _user_at_host -t other-accounts "$@" && return
   ;;
 esac
+
+return ret
Index: Completion/Unix/Command/_gpg
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Unix/Command/_gpg,v
retrieving revision 1.1
diff -u -r1.1 _gpg
--- Completion/Unix/Command/_gpg	12 May 2003 10:37:54 -0000	1.1
+++ Completion/Unix/Command/_gpg	25 Jun 2003 08:29:12 -0000
@@ -1,6 +1,6 @@
 #compdef gpg gpgv
 
-local curcontext="$curcontext" state line expl
+local curcontext="$curcontext" state line expl ret=1
 typeset -A opt_args
 
 _arguments -C -s -S -A "-*" \
@@ -127,7 +127,7 @@
   --enable-special-filenames --no-expensive-trust-checks --group:name=value \
   --preserve-permissions --personal-{cipher,digest,compress}-preferences:string \
   --default-preference-list:string \
-  '*:args:->args' && return
+  '*:args:->args' && ret=0
 
 if [[ $state = args ]]; then
   if (( ${+opt_args[--export]} || ${+opt_args[--list-keys]} )); then
@@ -154,4 +154,4 @@
   ;;
 esac
 
-return 1
+return ret
Index: Completion/Unix/Command/_gzip
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Unix/Command/_gzip,v
retrieving revision 1.4
diff -u -r1.4 _gzip
--- Completion/Unix/Command/_gzip	14 Mar 2002 15:54:41 -0000	1.4
+++ Completion/Unix/Command/_gzip	25 Jun 2003 08:29:12 -0000
@@ -1,6 +1,6 @@
 #compdef gzip gunzip gzcat=gunzip -redirect-,<,gunzip=gunzip -redirect-,>,gzip=gunzip -redirect-,<,gzip=gzip -value-,GZIP,-default-
 
-local decompress files expl curcontext="$curcontext" state line
+local decompress files expl curcontext="$curcontext" state line ret=1
 typeset -A opt_args
 
 files=( '*:files:->files' )
@@ -58,7 +58,7 @@
     '(--fast -1 -2 -3 -4 -5 -6 -7    -9 --best)-8' \
     '(--fast -1 -2 -3 -4 -5 -6 -7 -8    --best)-9' \
     '(--fast -1 -2 -3 -4 -5 -6 -7 -8 -9       )--best' \
-    "$files[@]" && return 0
+    "$files[@]" && ret=0
   ;;
 esac
 
@@ -71,19 +71,21 @@
   if (( $+opt_args[-r] || $+opt_args[--recursive] )); then
     if [[ -z "$decompress" ]]; then
       _description directories expl 'directory to compress'
-      _files "$expl[@]" -/
+      _files "$expl[@]" -/ && return
     else
       _description directories expl 'compressed directory'
-      _files "$expl[@]" -/
+      _files "$expl[@]" -/ && return
     fi
   else
     if [[ -z "$decompress" ]]; then
       _description files expl 'file to compress'
-      _files "$expl[@]" -g '*~*.(([tT]|)[gG]|)[zZ]'
+      _files "$expl[@]" -g '*~*.(([tT]|)[gG]|)[zZ]' && return
     else
       _description files expl 'compressed file'
-      _files "$expl[@]" -g '*.(([tT]|)[gG]|)[zZ]'
+      _files "$expl[@]" -g '*.(([tT]|)[gG]|)[zZ]' && return
     fi
   fi
   ;;
 esac
+
+return ret
Index: Completion/Unix/Command/_java
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Unix/Command/_java,v
retrieving revision 1.10
diff -u -r1.10 _java
--- Completion/Unix/Command/_java	12 Mar 2003 18:55:38 -0000	1.10
+++ Completion/Unix/Command/_java	25 Jun 2003 08:29:12 -0000
@@ -1,6 +1,6 @@
 #compdef javac java javadoc appletviewer jar jdb javah javap extcheck rmic rmiregistry rmid serialvar native2ascii keytool jarsigner policytool
 
-local expl tmp jdb_args jar_cmd match basedir
+local expl tmp jdb_args jar_cmd match basedir ret=1
 local curcontext="$curcontext" state line jf
 typeset -A opt_args tmpassoc
 
@@ -89,7 +89,7 @@
     '-helpfile[specify alternative help link]:helpfile path/filename:' \
     '-stylesheet[specify alternative HTML style sheet]:stylesheet path/filename:' \
     '-docencoding[specify character encoding for output HTML files]:encoding:->encoding' \
-    '*:package name, source file or @list:->docsrc' && return 0
+    '*:package name, source file or @list:->docsrc' && ret=0
   ;;
 
 appletviewer)
@@ -112,7 +112,7 @@
       'v[verbose mode]' \
       'm[specify manifest file]' \
       '0[store only without using ZIP compression]' \
-      'M[do not create manifest file]'
+      'M[do not create manifest file]' && return
   else
     jar_cmd="${words[2]#-}"
     tmpassoc=(
@@ -186,7 +186,7 @@
 
 rmiregistry)
   if (( CURRENT == 2 )); then
-    _wanted ports expl 'port to listen' _ports
+    _wanted ports expl 'port to listen' _ports && return
   else
     _message 'no more arguments'
   fi
@@ -359,11 +359,11 @@
 debug)
   if [[ -prefix :*, ]]; then
     compset -P :
-    _values -s , "debug info" lines vars source
+    _values -s , "debug info" lines vars source && return
   else
     _description debuginfo expl "debug info"
-    compadd -P: "$expl[@]" none
-    compadd -P: -qS, "$expl[@]" lines vars source
+    compadd -P: "$expl[@]" none && ret=0
+    compadd -P: -qS, "$expl[@]" lines vars source && ret=0
   fi
   ;;
 
@@ -372,12 +372,12 @@
   compset -S ':*'
   _alternative \
     "classpath:$state:_path_files -qS: -g '*.(jar|zip)'" \
-    "classpath:$state:_path_files -r': ' -/"
+    "classpath:$state:_path_files -r': ' -/" && return
   ;;
 
 extdirs)
   compset -P '*:'
-  _path_files -/
+  _path_files -/ && return
   ;;
 
 encoding)
@@ -540,7 +540,7 @@
 
 property)
   if compset -P '*='; then
-    _default
+    _default && return
   else
     _message -e property-names 'property name'
   fi
@@ -548,30 +548,30 @@
 
 docsrc)
   if compset -P @; then
-    _wanted files expl 'package/source list file' _files
+    _wanted files expl 'package/source list file' _files && return
   else
-    _wanted files expl 'package or source' _files -g '*.java'
+    _wanted files expl 'package or source' _files -g '*.java' && return
   fi
   ;;
 
 jararg)
   if [[ -prefix - ]]; then
     tmp=('-C:chdir')
-    _describe -o 'option' tmp --
+    _describe -o 'option' tmp -- && return
   elif [[ "$words[CURRENT - 2]" == -C ]]; then
-    _wanted file expl 'input file' _files -W "($words[CURRENT - 1])"
+    _wanted file expl 'input file' _files -W "($words[CURRENT - 1])" && return
   elif [[ "$words[CURRENT - 1]" == -C ]]; then
-    _wanted directories expl 'chdir to' _files -/
+    _wanted directories expl 'chdir to' _files -/ && return
   elif [[ $words[2] = *x* ]]; then
-        jf="$words[3]"
-        if [[ $jf != $_jar_cache_name && -f $jf ]]; then
-            _jar_cache_list=("${(@f)$($words[1] tf $jf)}")
-            _jar_cache_name=$jf
-        fi
+    jf="$words[3]"
+    if [[ $jf != $_jar_cache_name && -f $jf ]]; then
+      _jar_cache_list=("${(@f)$($words[1] tf $jf)}")
+      _jar_cache_name=$jf
+    fi
 
-        _wanted files expl 'file from archive' _multi_parts / _jar_cache_list
+    _wanted files expl 'file from archive' _multi_parts / _jar_cache_list && return
   else
-    _wanted files expl 'input file' _files
+    _wanted files expl 'input file' _files && return
   fi
   ;;
 
@@ -579,3 +579,5 @@
   _message "unknown state: $state"
   ;;
 esac
+
+return ret
Index: Completion/Unix/Command/_links
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Unix/Command/_links,v
retrieving revision 1.4
diff -u -r1.4 _links
--- Completion/Unix/Command/_links	12 Nov 2002 11:53:39 -0000	1.4
+++ Completion/Unix/Command/_links	25 Jun 2003 08:29:12 -0000
@@ -1,6 +1,6 @@
 #compdef links
 
-local curcontext="$curcontext" state line
+local curcontext="$curcontext" state line ret=1
 typeset -A opt_args
 
 _arguments -C \
@@ -25,8 +25,10 @@
   '(-help)-source[dump the source page]' \
   '(-help)-unrestartable-receive-timeout[timeout on non restartable connections]:secs:' \
   '(-help)-version[prints the links version number and exit]' \
-  ':url:->html' && return 0
+  ':url:->html' && ret=0
   
 if [[ "$state" = html ]]; then
-  _alternative 'files:file:_files -g "*.x#html"' 'urls:url:_urls'
+  _alternative 'files:file:_files -g "*.x#html"' 'urls:url:_urls' && ret=0
 fi
+
+return ret
Index: Completion/Unix/Command/_look
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Unix/Command/_look,v
retrieving revision 1.2
diff -u -r1.2 _look
--- Completion/Unix/Command/_look	16 Apr 2002 07:48:46 -0000	1.2
+++ Completion/Unix/Command/_look	25 Jun 2003 08:29:12 -0000
@@ -1,6 +1,6 @@
 #compdef look
 
-local curcontext="$curcontext" state line
+local curcontext="$curcontext" state line ret=1
 typeset -A opt_args
 
 _arguments -C -s \
@@ -8,14 +8,9 @@
   '-f[case insensitive]' \
   '-d[dictionary order]' \
   ':string:->string' \
-  ':dictionary file:_files' && return 0
+  ':dictionary file:_files' && ret=0
 
-case "$state" in
-string)
-  if [[ -n "$PREFIX" ]]; then
-    _wanted values expl 'word prefix' compadd - $(_call_program values $words[1] $PREFIX)
-  else
-    _message -e prefixes 'word prefix'
-  fi
-  ;;
-esac
+[[ -n "$state" && ! -prefix - ]] && _wanted values expl 'word prefix' \
+    compadd - $(_call_program words $words[1] '"$PREFIX"') && return
+
+return ret
Index: Completion/Unix/Command/_lynx
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Unix/Command/_lynx,v
retrieving revision 1.6
diff -u -r1.6 _lynx
--- Completion/Unix/Command/_lynx	4 Sep 2002 19:10:23 -0000	1.6
+++ Completion/Unix/Command/_lynx	25 Jun 2003 08:29:12 -0000
@@ -1,6 +1,6 @@
 #compdef lynx
 
-local curcontext="$curcontext" state line
+local curcontext="$curcontext" state line ret=1
 typeset -A opt_args
 
 _arguments -C \
@@ -128,7 +128,7 @@
   '-vikeys' \
   '-width=:NUMBER:' \
   '-with_backspaces' \
-  ':url:->html' && return 0
+  ':url:->html' && ret=0
 
 case "$state" in
 restrictions)
@@ -137,9 +137,11 @@
     disk_save dotfiles download editor exec exec_frozen externals file_url \
     goto inside_ftp inside_news inside_rlogin inside_telnet jump mail \
     multibook news_post options_save outside_ftp outside_news outside_rlogin \
-    outside_telnet print shell suspend telnet_port useragent
+    outside_telnet print shell suspend telnet_port useragent && return
   ;;
 html)
-  _alternative 'files:file:_files -g "*.x#html"' 'urls:url:_urls'
+  _alternative 'files:file:_files -g "*.x#html"' 'urls:url:_urls' && return
   ;;
 esac
+
+return ret
Index: Completion/Unix/Command/_lzop
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Unix/Command/_lzop,v
retrieving revision 1.2
diff -u -r1.2 _lzop
--- Completion/Unix/Command/_lzop	25 Jul 2001 12:36:34 -0000	1.2
+++ Completion/Unix/Command/_lzop	25 Jun 2003 08:29:12 -0000
@@ -1,6 +1,6 @@
 #compdef lzop
 
-local expl state line decompress disp curcontext="$curcontext" sep
+local expl state line decompress disp curcontext="$curcontext" sep ret=1
 typeset -A opt_args
 
 _arguments -C -s \
@@ -74,7 +74,7 @@
   '--color[assume a color ANSI terminal]' \
   '--intro[display intro sequence]' \
   '--filter=[preprocess data with a special multimedia filter]:number' \
-  '*:files:->files' && return 0
+  '*:files:->files' && ret=0
 
 case "$state" in
   files)
@@ -83,10 +83,10 @@
 	$+opt_args[--test] || $+opt_args[-t] || $+opt_args[--list] ||
 	$+opt_args[-l] || $+opt_args[--ls] || $+opt_args[--info] )); then
       _description files expl 'compressed file'
-      _files "$expl[@]" -g '*.[tl]zo'
+      _files "$expl[@]" -g '*.[tl]zo' && ret=0
     else
       _description files expl 'file to compress'
-      _files "$expl[@]" -g '*~*.[tl]zo'
+      _files "$expl[@]" -g '*~*.[tl]zo' && ret=0
 
     fi
   ;;
@@ -98,6 +98,8 @@
       "Q $sep Enclose file names in double quotes" )
     disp=( ${disp[@]:#[Z$PREFIX]*} )
     compset -P '[FGQ]*'
-    compadd -d disp - ${disp[@]%% *}
+    compadd -d disp - ${disp[@]%% *} && ret=0
   ;;
 esac
+
+return ret
Index: Completion/Unix/Command/_mt
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Unix/Command/_mt,v
retrieving revision 1.1
diff -u -r1.1 _mt
--- Completion/Unix/Command/_mt	7 Jan 2003 08:48:32 -0000	1.1
+++ Completion/Unix/Command/_mt	25 Jun 2003 08:29:12 -0000
@@ -1,7 +1,7 @@
 #compdef mt
 
 local -a args cmds
-local state line curcontext="$curcontext"
+local state line curcontext="$curcontext" ret=1
 
 args=( '(-)-f[specify raw tape device]:tape device:_files' )
 cmds=(
@@ -73,6 +73,8 @@
 fi
 
 _arguments -C "$args[@]" '(--help --version -V)1:operation:->operation' \
-    '2:count:' && return
+    '2:count:' && ret=0
 
-[[ -n "$state" ]] && _describe -t operations 'operation' cmds
+[[ -n "$state" ]] && _describe -t operations 'operation' cmds && ret=0
+
+return ret
Index: Completion/Unix/Command/_prcs
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Unix/Command/_prcs,v
retrieving revision 1.3
diff -u -r1.3 _prcs
--- Completion/Unix/Command/_prcs	26 Mar 2003 16:53:37 -0000	1.3
+++ Completion/Unix/Command/_prcs	25 Jun 2003 08:29:12 -0000
@@ -1,6 +1,6 @@
 #compdef prcs
 
-local curcontext="$curcontext" state line subcmds
+local curcontext="$curcontext" state line subcmds ret=1
 typeset -A opt_args
 
 # lookup project names in the repository
@@ -34,7 +34,7 @@
 _arguments -C \
   '(* -)'{-h,-H,--help}'[print out help]' \
   '(* -)--version[display program version]' \
-  '*:: :->subcmd' && return 0
+  '*:: :->subcmd' && ret=0
 
 if (( CURRENT == 1 )); then
   subcmds=(
@@ -54,8 +54,8 @@
     'unpackage:unpackage project in packagefile'
   )
   
-  _describe -t commands 'prcs command' subcmds
-  return
+  _describe -t commands 'prcs command' subcmds && ret=0
+  return ret
 fi
 
 curcontext="${curcontext%:*}-$words[1]:"
Index: Completion/Unix/Command/_sccs
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Unix/Command/_sccs,v
retrieving revision 1.4
diff -u -r1.4 _sccs
--- Completion/Unix/Command/_sccs	25 Apr 2003 11:19:09 -0000	1.4
+++ Completion/Unix/Command/_sccs	25 Jun 2003 08:29:12 -0000
@@ -15,7 +15,7 @@
   return ret
 }
 
-local curcontext="$curcontext" state line
+local curcontext="$curcontext" state line ret=1
 typeset -A opt_args
 local subcmds ropt copt sfiles finalpath
 
@@ -56,12 +56,13 @@
     '-r[run with real and not effective user ID]' \
     '-d+[specify root prefix]:root prefix:_directories' \
     '-p+[specify subdirectory of history file]:path to history file:_directories' \
-    '*::command:->subcmd' && return 0
+    '*::command:->subcmd' && ret=0
 
   if (( CURRENT == 1 )); then
-    _describe -t commands 'sccs command' subcmds
-    return
+    _describe -t commands 'sccs command' subcmds && ret=0
   fi
+  (( ret )) || return 0
+
   service="$words[1]"
   sfiles=':file:_sccs_files'
   curcontext="${curcontext%:*}-$service:"
Index: Completion/Unix/Command/_telnet
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Unix/Command/_telnet,v
retrieving revision 1.3
diff -u -r1.3 _telnet
--- Completion/Unix/Command/_telnet	16 Jan 2002 16:29:52 -0000	1.3
+++ Completion/Unix/Command/_telnet	25 Jun 2003 08:29:12 -0000
@@ -5,7 +5,7 @@
 #  telnet_hosts_ports_users
 #    The array that contains 3-tuples `host:port:user'.
 
-local curcontext="$curcontext" state line expl
+local curcontext="$curcontext" state line expl ret=1
 typeset -A opt_args
 
 if (( ! $+_telnet_args )); then
@@ -43,14 +43,14 @@
 _arguments -C -s \
   "$_telnet_args[@]" \
   ':host:->hosts' \
-  ':port:->ports' && return 0
+  ':port:->ports' && ret=0
 
 case "$state" in
 hosts)
   _wanted hosts expl host \
       _combination -s '[@:]' '' users-hosts-ports \
           ${opt_args[-l]:+users=${opt_args[-l]:q}} \
-          hosts -
+          hosts - && ret=0
   ;;
 
 ports)
@@ -58,7 +58,7 @@
       _combination -s '[@:]' '' users-hosts-ports \
           ${opt_args[-l]:+users=${opt_args[-l]:q}} \
           hosts="${line[1]:q}" \
-          ports -
+          ports - && ret=0
   ;;
 
 users)
@@ -66,6 +66,8 @@
       _combination -s '[@:]' '' users-hosts-ports \
       ${line[2]:+hosts="${line[2]:q}"} \
       ${line[3]:+ports="${line[3]:q}"} \
-      users -
+      users - && ret=0
   ;;
 esac
+
+return ret
Index: Completion/Unix/Command/_w3m
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Unix/Command/_w3m,v
retrieving revision 1.5
diff -u -r1.5 _w3m
--- Completion/Unix/Command/_w3m	25 Apr 2002 15:16:26 -0000	1.5
+++ Completion/Unix/Command/_w3m	25 Jun 2003 08:29:12 -0000
@@ -1,6 +1,6 @@
 #compdef w3m
 
-local curcontext="$curcontext" state line
+local curcontext="$curcontext" state line ret=1
 typeset -A opt_args
 
 _arguments -C \
@@ -31,7 +31,7 @@
   '-o[option]:option-value:' \
   '-config:config file:_files' \
   '-debug' \
-  ':url:->url' && return 0
+  ':url:->url' && ret=0
 
 case $state in
 	url)
@@ -39,10 +39,12 @@
 
 	if [[ -s ~/.w3m/history ]]; then
 	   _w3mhistory=(${(f)"$(<$HOME/.w3m/history)"})
-	   compadd $_w3mhistory
+	   compadd $_w3mhistory && ret=0
 	fi
 
-	_urls -f
+	_urls -f && ret=0
 	;;
 
 esac
+
+return ret
Index: Completion/Unix/Command/_zip
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Unix/Command/_zip,v
retrieving revision 1.6
diff -u -r1.6 _zip
--- Completion/Unix/Command/_zip	24 Aug 2002 19:19:14 -0000	1.6
+++ Completion/Unix/Command/_zip	25 Jun 2003 08:29:12 -0000
@@ -1,7 +1,7 @@
 #compdef zip unzip zipinfo
 
 local suffixes suf zipfile uzi
-local expl curcontext="$curcontext" state line
+local expl curcontext="$curcontext" state line ret=1
 typeset -A opt_args
 
 case $service in
@@ -51,7 +51,7 @@
       '-x[exclude the following names]' \
       '-i[include only the following names]' \
       "(-f -d -R -q -c -b -@ -F -FF -A -T -y -e -h -u -m -g -j -l -ll -L -v -z -t -tt -o -D -J -X -n -0 -1 -2 -3 -4 -5 -6 -7 -8 -9):zip file:_files -g '(#i)*.(zip|[ejw]ar)'" \
-      '*:file:->files' && return 0
+      '*:file:->files' && ret=0
   ;;
   unzip)
     _arguments -C -s \
@@ -76,7 +76,7 @@
       '-x[exclude the following names]' \
       '-Z[zipinfo mode]:zipinfomode:->zipinfo' \
       "(-p -f -u -l -t -z -n -o -j -C -X -q -qq -a -aa -v -L -M)1:zip file:_files -g '(#i)*.(zip|[ejw]ar)'" \
-      '*:file:->files' && return 0
+      '*:file:->files' && ret=0
   ;;
 esac
 
@@ -99,7 +99,7 @@
       '-M[page output]' \
       '-x[exclude the following names]' \
       "(-1 -2 -s -m -l -v -h -z -C -t -T -M)1:zip file:_files -g '(#i)*.(zip|[ejw]ar)'" \
-      '*:file:->files' && return 0
+      '*:file:->files' && ret=0
 fi
 
 case $state in
@@ -108,11 +108,11 @@
     compset -S ':*' || suf=":."
     suffixes=( *.*(N:e) )
     _wanted suffixes expl suffixes \
-	compadd -S "$suf" -r ": \t" .$^suffixes && return 0
+	compadd -S "$suf" -r ": \t" .$^suffixes && return
   ;;
   files)
     if [[ $service = zip ]] && (( ! ${+opt_args[-d]} )); then
-      _files -g '^(#i)*.(zip|[ejw]ar)' && return 0
+      _wanted files expl zfile _files -g '^(#i)*.(zip|[ejw]ar)' && return
     else
       zipfile=( $~line[1](|.zip|.ZIP) )
       [[ -z $zipfile[1] ]] && return 1
@@ -121,7 +121,9 @@
 	_zip_cache_list=( ${(f)"$(zipinfo -1 $_zip_cache_name)"} )
       fi
      _wanted files expl 'file from archive' \
-	 _multi_parts / _zip_cache_list && return 0
+	 _multi_parts / _zip_cache_list && return
     fi
   ;;
 esac
+
+return ret
Index: Completion/Zsh/Command/_compdef
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Zsh/Command/_compdef,v
retrieving revision 1.5
diff -u -r1.5 _compdef
--- Completion/Zsh/Command/_compdef	16 Apr 2002 07:48:46 -0000	1.5
+++ Completion/Zsh/Command/_compdef	25 Jun 2003 08:29:12 -0000
@@ -32,7 +32,7 @@
   '*-P[completion for command matching pattern]' \
   ':completion function:->cfun' \
   '*:commands:->com' \
-  "$args2[@]" && return 0
+  "$args2[@]" && ret=0
 
 if [[ $state = multi ]]; then
   case $(( CURRENT % 3 )) in
@@ -50,20 +50,20 @@
     if (( pat && pat > normal )); then
       _message -e patterns 'pattern'
     else
-      _command_names
+      _command_names && ret=0
     fi
   ;;
   ccom)
-    _wanted commands expl 'completed command' compadd -k _comps
+    _wanted commands expl 'completed command' compadd -k _comps && ret=0
   ;;
   cfun)
     list=( ${^fpath:/.}/_(|*[^~])(:t) )
     if zstyle -T ":completion:${curcontext}:functions" prefix-hidden; then
       disp=( ${list[@]#_} )
       _wanted functions expl 'completion function' \
-          compadd -d disp -a list
+          compadd -d disp -a list && ret=0
     else
-      _wanted functions expl 'completion function' compadd -a list
+      _wanted functions expl 'completion function' compadd -a list && ret=0
     fi
   ;;
   style)
@@ -71,6 +71,8 @@
         compadd -M 'r:|-=* r:|=*' \
             complete-word delete-char-or-list expand-or-complete \
             expand-or-complete-prefix list-choices menu-complete \
-            menu-expand-or-complete reverse-menu-complete
+            menu-expand-or-complete reverse-menu-complete && ret=0
   ;;
 esac
+
+return ret
Index: Completion/Zsh/Command/_hash
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Zsh/Command/_hash,v
retrieving revision 1.2
diff -u -r1.2 _hash
--- Completion/Zsh/Command/_hash	29 May 2001 17:54:38 -0000	1.2
+++ Completion/Zsh/Command/_hash	25 Jun 2003 08:29:12 -0000
@@ -1,6 +1,6 @@
 #compdef hash rehash
 
-local state line expl common_args curcontext="$curcontext"
+local state line expl common_args curcontext="$curcontext" ret=1
 typeset -A opt_args
 
 common_args=( \
@@ -15,7 +15,7 @@
       '(-f -r -m)-v[list entries as they are added]' \
       '(-f -r -v)-L[list in the form of calls to hash]' \
       "${common_args[@]}" \
-      '(-d -f -r -m -v -L)*:hash:->hashval' && return 0
+      '(-d -f -r -m -v -L)*:hash:->hashval' && ret=0
   ;;
   rehash)
     _arguments -C -s ${common_args[@]} && return 0
@@ -25,14 +25,16 @@
 if [[ $state = hashval ]]; then
   if (( $+opt_args[-d] )); then
     if compset -P 1 '*='; then
-      _wanted -C value files expl directories _path_files -/
+      _wanted -C value files expl directories _path_files -/ && ret=0
     else
       _wanted -C name named-directories expl 'named directory' \
-          compadd -q -S '=' -k nameddirs
+          compadd -q -S '=' -k nameddirs && ret=0
     fi
   elif compset -P 1 '*='; then
-    _wanted -C value values expl 'executable file' _files -g '*(-*)'
+    _wanted -C value values expl 'executable file' _files -g '*(-*)' && ret=0
   else
-    _wanted -C name commands expl command compadd -q -S '=' -k commands
+    _wanted -C name commands expl command compadd -q -S '=' -k commands && ret=0
   fi
 fi
+
+return ret
Index: Completion/Zsh/Command/_which
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Zsh/Command/_which,v
retrieving revision 1.2
diff -u -r1.2 _which
--- Completion/Zsh/Command/_which	29 May 2001 17:54:38 -0000	1.2
+++ Completion/Zsh/Command/_which	25 Jun 2003 08:29:12 -0000
@@ -1,6 +1,6 @@
 #compdef which whence where type
 
-local farg aarg cargs args state line curcontext="$curcontext"
+local farg aarg cargs args state line curcontext="$curcontext" ret=1
 
 cargs=( \
   '(-v -c)-w[print command type]' \
@@ -16,11 +16,11 @@
     _arguments -C -s -A "-*" -S \
       '(-c -w)-v[verbose output]' \
       '(-v -w)-c[csh-like output]' \
-      "${cargs[@]}" "$farg" "$aarg" && return 0
+      "${cargs[@]}" "$farg" "$aarg" && ret=0
   ;;
-  where) _arguments -C -s -A "-*" -S "${cargs[@]}" && return 0;;
-  which) _arguments -C -s -A "-*" -S "${cargs[@]}" "$aarg" && return 0;;
-  type) _arguments -C -s -A "-*" -S "${cargs[@]}" "$aarg" "$farg" && return 0;;
+  where) _arguments -C -s -A "-*" -S "${cargs[@]}" && ret=0;;
+  which) _arguments -C -s -A "-*" -S "${cargs[@]}" "$aarg" && ret=0;;
+  type) _arguments -C -s -A "-*" -S "${cargs[@]}" "$aarg" "$farg" && ret=0;;
 esac
 
 if [[ "$state" = command ]]; then
@@ -32,6 +32,8 @@
     'builtins:builtin command:compadd -k builtins' \
     'functions:shell function:compadd -k functions' \
     'aliases:alias:compadd -k aliases' \
-    'reserved-words:reserved word:compadd -k reswords'
+    'reserved-words:reserved word:compadd -k reswords' && ret=0
 
 fi
+
+return ret

________________________________________________________________________
This email has been scanned for all viruses by the MessageLabs Email
Security System. For more information on a proactive email security
service working around the clock, around the globe, visit
http://www.messagelabs.com
________________________________________________________________________


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2003-06-25  8:45 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-06-25  8:44 PATCH: returning early breaks prefix-needed Oliver Kiddle

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).