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

PATCH: arguments for _main_complete



This makes `_main_complete' accept names of completer functions as
arguments, so that one can easily define special-key functions using
`_main_complete _correct' or whatever.

Bye
 Sven

diff -u -r oc/Core/_main_complete Completion/Core/_main_complete
--- oc/Core/_main_complete	Wed Mar 24 08:56:35 1999
+++ Completion/Core/_main_complete	Wed Mar 24 09:11:50 1999
@@ -14,6 +14,10 @@
 #    the code will first try normal completion. If that doesn't yield
 #    any matches, correction is tried and if that doesn't yield
 #    anything either, correcting completion is attempted.
+#
+# These completer functions are only used when this function is called
+# without arguments. If arguments are given, they should be names of
+# completer functions which will then be called.
 
 local comp _set_options _unset_options
 
@@ -31,8 +35,12 @@
   compstate[context]=tilde
 fi
 
+# Get the names of the completers to use in the positional parameters.
+
+(( $# )) || set ${(s.:.)compconfig[completer]}
+
 # And now just call the completer functions defined.
 
-for comp in ${(s.:.)compconfig[completer]}; do
+for comp; do
   "$comp" && return
 done
diff -u -r oc/README Completion/README
--- oc/README	Wed Mar 24 08:56:36 1999
+++ Completion/README	Wed Mar 24 09:01:59 1999
@@ -50,7 +50,9 @@
   _main_complete
     The main entry point called by the key bindings which compinit sets
     up (the main `completion widget' in zsh jargon). This mainly calls
-    completer functions like _complete.
+    completer functions like _complete, either those given as arguments
+    or (if it is called without arguments) those from the completer
+    configuration key (see below).
   _multi_parts
     Utility for completion parts of words given a separator character and 
     a list of words.

--
Sven Wischnowsky                         wischnow@xxxxxxxxxxxxxxxxxxxxxxx



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