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

PATCH: minor example additions



This makes `compconf' without arguments print the config keys set
(with their values, of course), and makes `_compalso' accept more than 
one context/command name.

Bye
 Sven

diff -u oc/Core/_compalso Completion/Core/_compalso
--- oc/Core/_compalso	Mon Mar 29 11:48:52 1999
+++ Completion/Core/_compalso	Mon Mar 29 15:41:47 1999
@@ -1,15 +1,17 @@
 #autoload
 
-# This searches $1 in the array for normal completions and calls the result.
+# This searches $* in the array for normal completions and calls the result.
 # It is used to include completions for another command or special context
 # into the list generated by the calling function.
 # For example the function for `-subscript-' could call this as in
 # `_compalso -math-' to get the completions that would be generated for a
 # mathematical context.
 
-local tmp ret=1
+local i tmp
 
-tmp="$_comps[$1]"
-[[ -z "$tmp" ]] || "$tmp" && ret=0
+for i; do
+  tmp="$_comps[$1]"
+  [[ -z "$tmp" ]] || "$tmp" && return 0
+done
 
-return ret
+return 1
diff -u oc/Core/compinit Completion/Core/compinit
--- oc/Core/compinit	Mon Mar 29 11:48:52 1999
+++ Completion/Core/compinit	Mon Mar 29 15:43:02 1999
@@ -218,17 +218,24 @@
 # and sets the according values in `compconfig'.
 # Arguments may be `foo=bar' to set key `foo' to `bar' or `baz' to
 # set key `baz' to the empty string.
+# If no arguments are given, all configurations keys set are displayed.
 
 compconf() {
   local i
 
-  for i; do
-    if [[ "$i" = *\=* ]]; then
-      compconfig[${i%%\=*}]="${i#*\=}"
-    else
-      compconfig[$i]=''
-    fi
-  done
+  if (( $# )); then
+    for i; do
+      if [[ "$i" = *\=* ]]; then
+        compconfig[${i%%\=*}]="${i#*\=}"
+      else
+        compconfig[$i]=''
+      fi
+    done
+  else
+    for i in ${(k)compconfig}; do
+      print ${(r:25:)i} $compconfig[$i]
+    done
+  fi
 }
 
 # Now we automatically make the definition files autoloaded.

--
Sven Wischnowsky                         wischnow@xxxxxxxxxxxxxxxxxxxxxxx



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