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

PATCH: return value in examples



This patch makes all completion functions return zero if they
generated matches and non-zero otherwise, as suggested by Andrej. I
also `documented' this in `compinit'. For some functions this may be
superfluous, but I'd like this to be a coding convention for all
functions (maybe I'm just too paranoid).

Bye
 Sven

diff -u -r ooc/Base/_command_names Completion/Base/_command_names
--- ooc/Base/_command_names	Mon Mar  8 09:05:46 1999
+++ Completion/Base/_command_names	Mon Mar  8 10:24:20 1999
@@ -1,7 +1,11 @@
 #defcomp -command-
 
-local nm=$compstate[nmatches]
+local nm=$compstate[nmatches] ret=1
 
-compgen -c
+compgen -c && ret=0
 
-[[ nm -eq compstate[nmatches] ]] && _path_files -/g "*(*)"
+if [[ nm -eq compstate[nmatches] ]]; then
+  _path_files -/g "*(*)"
+else
+  return ret
+fi
diff -u -r ooc/Base/_condition Completion/Base/_condition
--- ooc/Base/_condition	Mon Mar  8 09:05:46 1999
+++ Completion/Base/_condition	Mon Mar  8 10:24:21 1999
@@ -7,6 +7,10 @@
 elif [[ "$prev" = -([no]t|ef) ]]; then
   _files
 else
-  _files
-  compgen -v
+  local ret=1
+
+  _files && ret=0
+  compgen -v && ret=0
+
+  return ret
 fi
diff -u -r ooc/Base/_default Completion/Base/_default
--- ooc/Base/_default	Mon Mar  8 09:05:46 1999
+++ Completion/Base/_default	Mon Mar  8 10:24:21 1999
@@ -9,6 +9,6 @@
 # and insert the line `[[ compstate[nmatches] -eq 0 ]] || return' after
 # `compcall'.
 
-compcall || return
+compcall || return 0
 
 _files
diff -u -r ooc/Base/_subscript Completion/Base/_subscript
--- ooc/Base/_subscript	Mon Mar  8 09:05:46 1999
+++ Completion/Base/_subscript	Mon Mar  8 10:24:21 1999
@@ -1,5 +1,10 @@
 #defcomp -subscript-
 
-_compalso -math-
+local ret=1
+
+_compalso -math- && ret=0
+
 [[ ${(Pt)${compstate[parameter]}} = assoc* ]] &&
-    compgen -k "( ${(kP)${compstate[parameter]}} )"
+  compgen -k "( ${(kP)${compstate[parameter]}} )" && ret=0
+
+return ret
diff -u -r ooc/Builtins/_cd Completion/Builtins/_cd
--- ooc/Builtins/_cd	Mon Mar  8 09:06:15 1999
+++ Completion/Builtins/_cd	Mon Mar  8 10:24:21 1999
@@ -24,7 +24,7 @@
   rep=(${~PWD/$words[2]/*}~$PWD(-/N))
   # Now remove all the common parts of $PWD and the completions from this
   rep=(${${rep#${PWD%%$words[2]*}}%${PWD#*$words[2]}})
-  (( $#rep )) && compadd $rep
+  (( ! $#rep )) || compadd $rep
 elif [[ $words[1] = pu* && $PREFIX = [-+]* ]]; then
   # pushd: just complete the numbers, but show the full directory list with
   # numbers.
@@ -34,7 +34,8 @@
   # lazy to type pushd.
   IPREFIX=$PREFIX[1]
   PREFIX=$PREFIX[2,-1]
-  local list lines
+  local list lines ret=1
+
   # get the list of directories with their canonical number
   lines="$(dirs -v)"
   # turn the lines into an array, removing the current directory
@@ -52,9 +53,11 @@
   lines="${(F)list}"
   # get the array of numbers only
   list=(${list%%[ 	]*})
-  compgen -y '$lines' -Q -k list
-  [[ -z $compstate[list] ]] && compstate[list]=list
-  [[ -n $compstate[insert] ]] && compstat[insert]=menu
+  compgen -y '$lines' -Q -k list && ret=0
+  [[ -z $compstate[list] ]] && compstate[list]=list && ret=0
+  [[ -n $compstate[insert] ]] && compstat[insert]=menu && ret=0
+
+  return ret
 elif [[ $PREFIX != (\~|/|./|../)* && $#cdpath -ne 0 ]]; then
   _path_files -W cdpath -/
 else
diff -u -r ooc/Builtins/_disable Completion/Builtins/_disable
--- ooc/Builtins/_disable	Mon Mar  8 09:06:15 1999
+++ Completion/Builtins/_disable	Mon Mar  8 10:24:21 1999
@@ -1,8 +1,10 @@
 #defcomp disable
 
-local prev="$words[CURRENT-1]"
+local prev="$words[CURRENT-1]" ret=1
 
-[[ "$prev" = -*a* ]] && compgen -ea
-[[ "$prev" = -*f* ]] && compgen -eF
-[[ "$prev" = -*r* ]] && compgen -ew
-[[ "$prev" != -* ]] && compgen -eB
+[[ "$prev" = -*a* ]] && compgen -ea && ret=0
+[[ "$prev" = -*f* ]] && compgen -eF && ret=0
+[[ "$prev" = -*r* ]] && compgen -ew && ret=0
+[[ "$prev" != -* ]]  && compgen -eB && ret=0
+
+return ret
diff -u -r ooc/Builtins/_enable Completion/Builtins/_enable
--- ooc/Builtins/_enable	Mon Mar  8 09:06:16 1999
+++ Completion/Builtins/_enable	Mon Mar  8 10:24:22 1999
@@ -1,8 +1,10 @@
 #defcomp enable
 
-local prev="$words[CURRENT-1]"
+local prev="$words[CURRENT-1]" ret=1
 
-[[ "$prev" = -*a* ]] && compgen -da
-[[ "$prev" = -*f* ]] && compgen -dF
-[[ "$prev" = -*r* ]] && compgen -dw
-[[ "$prev" != -* ]] && compgen -dB
+[[ "$prev" = -*a* ]] && compgen -da && ret=0
+[[ "$prev" = -*f* ]] && compgen -dF && ret=0
+[[ "$prev" = -*r* ]] && compgen -dw && ret=0
+[[ "$prev" != -* ]]  && compgen -dB && ret=0
+
+return ret
diff -u -r ooc/Builtins/_kill Completion/Builtins/_kill
--- ooc/Builtins/_kill	Mon Mar  8 09:06:16 1999
+++ Completion/Builtins/_kill	Mon Mar  8 10:24:22 1999
@@ -5,7 +5,11 @@
 if [[ -iprefix '-' ]]; then
   compgen -k "($signals[1,-3])"
 else
-  compgen -P '%' -j
+  local ret=1
+
+  compgen -P '%' -j && ret=0
   list=("$(ps 2>/dev/null)")
-  compgen -y '$list' -s '`ps 2>/dev/null | tail +2 | cut -c1-5`'
+  compgen -y '$list' -s '`ps 2>/dev/null | tail +2 | cut -c1-5`' && ret=0
+
+  return ret
 fi
diff -u -r ooc/Builtins/_setopt Completion/Builtins/_setopt
--- ooc/Builtins/_setopt	Mon Mar  8 09:06:16 1999
+++ Completion/Builtins/_setopt	Mon Mar  8 10:24:22 1999
@@ -1,8 +1,11 @@
 #defcomp setopt
 
-local nm=$compstate[nmatches]
+local nm=$compstate[nmatches] ret=1
 
 compgen -M 'L:|[nN][oO]= M:_= M:{A-Z}={a-z}' \
-         -s '$({ unsetopt kshoptionprint; unsetopt } 2>/dev/null)'
+         -s '$({ unsetopt kshoptionprint; unsetopt } 2>/dev/null)' && ret=0
+
 [[ compstate[nmatches] -eq nm ]] &&
-    compgen -M 'L:|[nN][oO]= M:_= M:{A-Z}={a-z}' -o
+    compgen -M 'L:|[nN][oO]= M:_= M:{A-Z}={a-z}' -o && ret=0
+
+return ret
diff -u -r ooc/Builtins/_unhash Completion/Builtins/_unhash
--- ooc/Builtins/_unhash	Mon Mar  8 09:06:16 1999
+++ Completion/Builtins/_unhash	Mon Mar  8 10:24:22 1999
@@ -1,8 +1,10 @@
 #defcomp unhash
 
-local fl="$words[2]"
+local fl="$words[2]" ret=1
 
-[[ "$fl" = -*d* ]] && compgen -n
-[[ "$fl" = -*a* ]] && compgen -a
-[[ "$fl" = -*f* ]] && compgen -F
-[[ "$fl" != -* ]] && compgen -m
+[[ "$fl" = -*d* ]] && compgen -n && ret=0
+[[ "$fl" = -*a* ]] && compgen -a && ret=0
+[[ "$fl" = -*f* ]] && compgen -F && ret=0
+[[ "$fl" != -* ]]  && compgen -m && ret=0
+
+return ret
diff -u -r ooc/Builtins/_unsetopt Completion/Builtins/_unsetopt
--- ooc/Builtins/_unsetopt	Mon Mar  8 09:06:16 1999
+++ Completion/Builtins/_unsetopt	Mon Mar  8 10:24:22 1999
@@ -1,8 +1,11 @@
 #defcomp unsetopt
 
-local nm=$compstate[nmatches]
+local nm=$compstate[nmatches] ret=1
 
 compgen -M 'L:|[nN][oO]= M:_= M:{A-Z}={a-z}' \
-         -s '$({ unsetopt kshoptionprint; setopt } 2>/dev/null)'
+         -s '$({ unsetopt kshoptionprint; setopt } 2>/dev/null)' && ret=0
+
 [[ compstate[nmatches] -eq nm ]] &&
-    compgen -M 'L:|[nN][oO]= M:_= M:{A-Z}={a-z}' -o
+    compgen -M 'L:|[nN][oO]= M:_= M:{A-Z}={a-z}' -o && ret=0
+
+return ret
diff -u -r ooc/Builtins/_wait Completion/Builtins/_wait
--- ooc/Builtins/_wait	Mon Mar  8 09:06:16 1999
+++ Completion/Builtins/_wait	Mon Mar  8 10:24:23 1999
@@ -1,7 +1,9 @@
 #defcomp wait
 
-local list
+local list ret=1
 
-compgen -P '%' -j
+compgen -P '%' -j && ret=0
 list=("$(ps 2>/dev/null)")
-compgen -y '$list' -s '`ps 2>/dev/null | tail +2 | cut -c1-5`'
+compgen -y '$list' -s '`ps 2>/dev/null | tail +2 | cut -c1-5`' && ret=0
+
+return ret
diff -u -r ooc/Builtins/_zftp Completion/Builtins/_zftp
--- ooc/Builtins/_zftp	Mon Mar  8 09:06:15 1999
+++ Completion/Builtins/_zftp	Mon Mar  8 10:24:23 1999
@@ -45,6 +45,7 @@
 
   *)
   # dunno... try ordinary completion after all.
-  unset _compskip   
+  unset _compskip
+  return 1
   ;;
 esac
diff -u -r ooc/Core/_comp_parts Completion/Core/_comp_parts
--- ooc/Core/_comp_parts	Mon Mar  8 09:05:22 1999
+++ Completion/Core/_comp_parts	Mon Mar  8 10:24:23 1999
@@ -42,7 +42,7 @@
 # Get the string from the line.
 
 str="$PREFIX$SUFFIX"
-[[ -o globcomplete ]] && str="$str:q"
+[[ $#compstate[pattern_match] -ne 0 ]] || str="$str:q"
 prefix=""
 
 # Walk through the arguments to find the longest unambiguous prefix.
@@ -131,13 +131,13 @@
     arr=tmparr
   fi
   tmparr=( "${(@M)${(@P)arr}:#${~test}*}" )
-  tmparr=( "${(@)testarr:#}" )
-  suffixes=("${^suffixes[@]}${1}$^tmparr")
+  tmparr=( "${(@)tmparr:#}" )
+  suffixes=("${(@)^suffixes[@]}${1}${(@)^tmparr}")
 
   # We want the completion code to generate the most specific suffix
   # for us, so we collect matching specifications that allow partial
   # word matching before the separators on the fly.
-  matchers=("$matchers[@]" "r:|${1}=*")
+  matchers=("$matchers[@]" "r:|${1:q}=*")
   shift 2
 done
 
diff -u -r ooc/Core/_compalso Completion/Core/_compalso
--- ooc/Core/_compalso	Mon Mar  8 09:05:22 1999
+++ Completion/Core/_compalso	Mon Mar  8 10:24:23 1999
@@ -7,7 +7,9 @@
 # `_compalso -math-' to get the completions that would be generated for a
 # mathematical context.
 
-local tmp
+local tmp ret=1
 
 tmp="$_comps[$1]"
-[[ -z "$tmp" ]] || "$tmp"
+[[ -z "$tmp" ]] || "$tmp" && ret=0
+
+return ret
diff -u -r ooc/Core/_files Completion/Core/_files
--- ooc/Core/_files	Mon Mar  8 09:05:22 1999
+++ Completion/Core/_files	Mon Mar  8 10:24:23 1999
@@ -3,10 +3,9 @@
 # Utility function for completing files of a given type or any file.
 # In many cases you will want to call this one instead of _path_files().
 
-local nm=$compstate[nmatches] ret
+local nm=$compstate[nmatches] ret=1
 
-_path_files "$@"
-ret=$?
+_path_files "$@" && ret=0
 
 if [[ $# -ne 0 && compstate[nmatches] -eq nm ]]; then
   local opt opts
@@ -23,7 +22,7 @@
     [[ "$opt" = [PSWFJVX] ]] && opts=("$opts[@]" "-$opt" "$OPTARG")
   done
 
-  _path_files "$opts[@]"
-else
-  return $ret
+  _path_files "$opts[@]" && ret=0
 fi
+
+return ret
diff -u -r ooc/Core/_multi_parts Completion/Core/_multi_parts
--- ooc/Core/_multi_parts	Mon Mar  8 09:05:22 1999
+++ Completion/Core/_multi_parts	Mon Mar  8 10:24:24 1999
@@ -45,7 +45,7 @@
 # the original string in `orig'. The `eval' is used to replace our
 # separator character by `*<sep>'.
 
-if [[ -o globcomplete ]]; then
+if [[ $#compstate[pattern_match] -ne 0 ]]; then
   patstr="${PREFIX}*${SUFFIX}*"
 else
   patstr="${PREFIX:q}*${SUFFIX:q}*"
@@ -131,7 +131,8 @@
 
   if [[ -z "$orig" && "$PREFIX$SUFFIX" != "$pref$orig" ]]; then
     compadd -QU  "$group[@]" "$expl[@]" -i "$IPREFIX" -S '' - "${pref}${orig}"
-  elif [[ $compstate[insert] = *menu ]]; then
+  elif [[ $compstate[insert] = *menu ||
+          $#compstate[pattern_match] -ne 0 ]]; then
     for i in "$matches[@]" ; do
       if [[ "$i" = *${sep}* ]]; then
         compadd -U "$group[@]" "$expl[@]" -i "$IPREFIX" \
@@ -145,7 +146,7 @@
     for i in "$matches[@]" ; do
       if [[ "$i" = *${sep}* ]]; then
         compadd -U -i "$IPREFIX" -p "$pref" -s "${sep}${i#*${sep}}" \
-	        "$group[@]" "$expl[@]" -M "r:|${sep}=*" - "${i%%${sep}*}"
+	        "$group[@]" "$expl[@]" -M "r:|${sep:q}=*" - "${i%%${sep}*}"
       else
         compadd -U "$group[@]" "$expl[@]" -i "$IPREFIX" -p "$pref" - "$i"
       fi
diff -u -r ooc/Core/_normal Completion/Core/_normal
--- ooc/Core/_normal	Mon Mar  8 09:05:22 1999
+++ Completion/Core/_normal	Mon Mar  8 10:24:24 1999
@@ -1,6 +1,6 @@
 #autoload
 
-local comp command cmd1 cmd2 pat val name i ret
+local comp command cmd1 cmd2 pat val name i ret=1
 
 # Completing in command position? If not we set up `cmd1' and `cmd2' as
 # two strings we have search in the completion definition arrays (e.g.
@@ -9,8 +9,9 @@
 command="$words[1]"
 if [[ CURRENT -eq 1 ]]; then
   comp="$_comps[-command-]"
-  [[ -z "$comp" ]] || "$comp"
-  return
+  [[ -z "$comp" ]] || "$comp" && ret=0
+
+  return ret
 elif [[ "$command[1]" == '=' ]]; then
   eval cmd1\=$command
   cmd2="$command[2,-1]"
@@ -28,11 +29,10 @@
   pat="${i% *}"
   val="${i#* }"
   if [[ "$cmd1" == $~pat || "$cmd2" == $~pat ]]; then
-    "$val"
-    ret=$?
+    "$val" && ret=0
     if (( $+_compskip )); then
       unset _compskip
-      return $ret
+      return ret
     fi
   fi
 done
@@ -53,4 +53,6 @@
   name=-default-
   comp="$_comps[-default-]"
 fi
-[[ -z "$comp" ]] || "$comp"
+[[ -z "$comp" ]] || "$comp" && ret=0
+
+return ret
diff -u -r ooc/Core/_path_files Completion/Core/_path_files
--- ooc/Core/_path_files	Mon Mar  8 09:05:22 1999
+++ Completion/Core/_path_files	Mon Mar  8 10:24:24 1999
@@ -91,7 +91,7 @@
 # str holds the whole string from the command line with a `*' between
 # the prefix and the suffix.
 
-if [[ -o globcomplete ]]; then
+if [[ $#compstate[pattern_match] -ne 0 ]]; then
   str="${PREFIX}*${SUFFIX}"
 else
   str="${PREFIX:q}*${SUFFIX:q}"
@@ -282,7 +282,8 @@
 	# these are file names and that `fignore' should be used as usual
 	# (the `-f' and `-F' options).
 
-	if [[ $compstate[insert] = *menu ]]; then
+	if [[ $compstate[insert] = *menu ||
+	      $#compstate[pattern_match] -ne 0 ]]; then
           compadd -QU "$addpfx[@]" "$addsfx[@]" "$group[@]" "$expl[@]" \
                   -i "$IPREFIX" -p "${linepath:q}${testpath:q}" -S "/${ostr#*/}" \
 		  -W "$tmp1" -f "$ignore[@]" - "${(@)${(@)collect%%/*}:q}"
diff -u -r ooc/Core/compinit Completion/Core/compinit
--- ooc/Core/compinit	Mon Mar  8 09:05:22 1999
+++ Completion/Core/compinit	Mon Mar  8 10:24:24 1999
@@ -37,6 +37,9 @@
 # Note that no white space is allowed between the `#' and the rest of
 # the string.
 #
+# Functions that are used to generate matches should return zero if they
+# were able to add matches and non-zero otherwise.
+#
 # See the file `compdump' for how to speed up initialiation.
 #
 # If you are using global matching specifications with `compctl -M ...'
diff -u -r ooc/User/_a2ps Completion/User/_a2ps
--- ooc/User/_a2ps	Mon Mar  8 09:05:44 1999
+++ Completion/User/_a2ps	Mon Mar  8 10:24:24 1999
@@ -1,22 +1,26 @@
 #defcomp a2ps
 
+local ret=1
+
 if [[ "$PREFIX[1,2]" = -- ]]; then
   _comp_parts '(--borders --compact --truncate-lines --interpret
-                --print-anyway --delegate)' '=' '(yes no)'
-  _comp_parts '(--major)' '=' '(rows columns)'
-  _comp_parts '(--end-of-line)' '=' '(r n nr rn any)'
+                --print-anyway --delegate)' '=' '(yes no)' && ret=0
+  _comp_parts '(--major)' '=' '(rows columns)' && ret=0
+  _comp_parts '(--end-of-line)' '=' '(r n nr rn any)' && ret=0
 
   compgen -S= -k '(--medium --columns --rows --line-numbers
-                    --font-size --lines-per-page --chars-per-line
- 		    --tabsize --non-printable-format --encoding
-		    --title --stdin --prologue --highlight-level
-		    --strip-level --output --version-control --suffix
-		    --printer --copies --sides --page-prefeed
-		    --no-page-prefeed)'
+                   --font-size --lines-per-page --chars-per-line
+ 		   --tabsize --non-printable-format --encoding
+		   --title --stdin --prologue --highlight-level
+		   --strip-level --output --version-control --suffix
+		   --printer --copies --sides --page-prefeed
+		   --no-page-prefeed)' && ret=0
   compgen -qS= -k '(--margin --header --underlay --left-title
-                     --right-title --left-footer --footer --right-footer
-		     --pages --pretty-print)'
-  compgen -k '(--landscape --portrait --catman --no-header)'
+                    --right-title --left-footer --footer --right-footer
+		    --pages --pretty-print)' && ret=0
+  compgen -k '(--landscape --portrait --catman --no-header)' && ret=0
+
+  return ret
 else
   _files -F fignore -g "*~*.ps"
 fi
diff -u -r ooc/User/_configure Completion/User/_configure
--- ooc/User/_configure	Mon Mar  8 09:05:44 1999
+++ Completion/User/_configure	Mon Mar  8 10:26:13 1999
@@ -6,11 +6,11 @@
   # Complete filenames after e.g. --prefix=
   IPREFIX=${PREFIX%%=*}=
   PREFIX=${PREFIX#*=}
-  compgen -f
+  _files
 else
   # Generate a list of options from configure --help
   local -a pars
-  local i
+  local i ret=1
   pars=($($words[1] --help | awk '$1 ~ /--[a-z]*.*/ {print $1}'))
   for i in $pars
   do
@@ -22,14 +22,15 @@
         : Skip standard help output
       ;;
       --*\[=* )
-        compadd -M 'r:|-=* r:|=*' -q -S = -- ${i%%\[=*}
+        compadd -M 'r:|-=* r:|=*' -q -S = -- ${i%%\[=*} && ret=0
       ;;
       --*=* )
-        compadd -M 'r:|-=* r:|=*' -S = -- ${i%%=*}
+        compadd -M 'r:|-=* r:|=*' -S = -- ${i%%=*} && ret=0
       ;;
       * )
-        compadd -M 'r:|-=* r:|=*' -- $i
+        compadd -M 'r:|-=* r:|=*' -- $i && ret=0
       ;;
     esac
   done
+  return ret
 fi
diff -u -r ooc/User/_dd Completion/User/_dd
--- ooc/User/_dd	Mon Mar  8 09:05:44 1999
+++ Completion/User/_dd	Mon Mar  8 10:24:25 1999
@@ -5,7 +5,7 @@
   # test alone will have that effect.
   [[ -string , ]]
   compgen -S, -q \
-  -k '(ascii ebcdic ibm block unblock lcase ucase swab noerror sync)'
+      -k '(ascii ebcdic ibm block unblock lcase ucase swab noerror sync)'
 elif [[ -iprefix 'if=' || -iprefix 'of=' ]]; then
   _files
 else
diff -u -r ooc/User/_find Completion/User/_find
--- ooc/User/_find	Mon Mar  8 09:05:44 1999
+++ Completion/User/_find	Mon Mar  8 10:24:25 1999
@@ -10,8 +10,12 @@
     {i,}{l,}name {no,}{user,group} path perm regex size true uid used \
     exec {f,}print{f,0,} ok prune ls'
 elif [[ -position 2 ]]; then
-  compgen -g '. ..'
-  _files -g '(-/)'
+  local ret=1
+
+  compgen -g '. ..' && ret=0
+  _files -g '(-/)' && ret=0
+
+  return ret
 elif [[ "$prev" = -((a|c|)newer|fprint(|0|f)) ]]; then
   _files
 elif [[ "$prev" = -fstype ]]; then
diff -u -r ooc/User/_man Completion/User/_man
--- ooc/User/_man	Mon Mar  8 09:05:45 1999
+++ Completion/User/_man	Mon Mar  8 10:24:25 1999
@@ -1,7 +1,9 @@
 #defcomp man
+
 setopt localoptions rcexpandparam
 
 local rep
+
 if [[ $words[2] = (<->*|ln) ]]; then
   rep=( $manpath/(man|cat)${words[2]}/$PREFIX*$SUFFIX.<->*(N:t:r) )
 else
diff -u -r ooc/User/_mh Completion/User/_mh
--- ooc/User/_mh	Mon Mar  8 09:05:45 1999
+++ Completion/User/_mh	Mon Mar  8 10:24:26 1999
@@ -4,6 +4,7 @@
 # Alter the following two to your own mh directory and the directory
 # where standard mh library files live.  (It works anyway, but this
 # will save a little time.)
+
 local mymhdir=~/Mail
 local mhlib=/usr/lib/mh
 
@@ -25,6 +26,7 @@
 elif [[ -iprefix '+' || -iprefix '@' || "$prev" = -draftfolder ]]; then
   # Complete folder names.
   local mhpath
+
   if [[ $IPREFIX != '@' ]]; then
     [[ $IPREFIX = '+' ]] || IPREFIX=+
     mhpath=$mymhdir
@@ -53,7 +55,8 @@
   compadd public private never ask
 else
   # Generate sequences.
-  local foldnam folddir f
+  local foldnam folddir f ret
+
   for f in $argv; do
     [[ $f = [@+]* ]] && foldnam=$f
   done
@@ -66,7 +69,10 @@
     # leaving foldnam empty works here
   fi
 
-  compgen -s '$(mark $foldnam 2>/dev/null | awk -F: '\''{ print $1 }'\'')'
-  compadd reply next cur prev first last all unseen
-  compgen -W folddir -g '<->'
+  compgen -s '$(mark $foldnam 2>/dev/null | awk -F: '\''{ print $1 }'\'')' &&
+      ret=0
+  compadd reply next cur prev first last all unseen && ret=0
+  compgen -W folddir -g '<->' && ret=0
+
+  return ret
 fi
diff -u -r ooc/User/_rcs Completion/User/_rcs
--- ooc/User/_rcs	Mon Mar  8 09:05:45 1999
+++ Completion/User/_rcs	Mon Mar  8 10:24:26 1999
@@ -6,6 +6,7 @@
 
 if [[ $compstate[nmatches] -eq nm && -d RCS && $words[1] != ci ]]; then
   local rep
+
   rep=(RCS/$PREFIX*$SUFFIX,v(:t:s/\,v//))
   (( $#rep )) && compadd - $rep
 fi
diff -u -r ooc/User/_strip Completion/User/_strip
--- ooc/User/_strip	Mon Mar  8 09:05:45 1999
+++ Completion/User/_strip	Mon Mar  8 10:24:26 1999
@@ -1,2 +1,3 @@
 #defcomp strip
+
 _files -g '*(*)'
diff -u -r ooc/User/_tar Completion/User/_tar
--- ooc/User/_tar	Mon Mar  8 09:05:46 1999
+++ Completion/User/_tar	Mon Mar  8 10:24:26 1999
@@ -35,7 +35,8 @@
   # gnu tar, generate completions from --help
   # ones followed by = get that as a suffix
   local -a ownlist eqlist
-  local comp
+  local comp ret=1
+
   $words[1] --help |
   perl -ne 'while (/--[^[\s,='\'']+=?/g) { print "$&\n"; }' |
   while read comp; do
@@ -45,8 +46,10 @@
       ownlist[$#ownlist+1]=$comp
     fi
   done
-  compgen -S '=' -k eqlist
-  compgen -k ownlist
+  compgen -S '=' -k eqlist && ret=0
+  compgen -k ownlist && ret=0
+
+  return ret
 elif [[ "$tcmd" = *[tx]*f* && $CURRENT -ge 4 ]] then
   # Listing or extracting a particular file.  We run `tar t...'
   # on the file, keeping the list of filenames cached, plus the

--
Sven Wischnowsky                         wischnow@xxxxxxxxxxxxxxxxxxxxxxx



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