summary refs log tree commit diff
diff options
context:
space:
mode:
authorSven Wischnowsky <wischnow@users.sourceforge.net>2000-06-13 11:55:06 +0000
committerSven Wischnowsky <wischnow@users.sourceforge.net>2000-06-13 11:55:06 +0000
commitbde4cfde51526bb8910c1dfbce8b6e4c4e1f5149 (patch)
tree0875c7bda2fc868f48da66104d403e5d5e9514a0
parenta707108a7544b9c2e5bd99cf51a4c5ba08558ade (diff)
downloadzsh-bde4cfde51526bb8910c1dfbce8b6e4c4e1f5149.tar.gz
zsh-bde4cfde51526bb8910c1dfbce8b6e4c4e1f5149.tar.xz
zsh-bde4cfde51526bb8910c1dfbce8b6e4c4e1f5149.zip
new _generic widget to call completion with $WIDGET in function field of context (?)
-rw-r--r--ChangeLog8
-rw-r--r--Completion/Commands/_generic11
-rw-r--r--Doc/Zsh/compsys.yo14
3 files changed, 33 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 13a6fcc51..3503be782 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
 2000-06-13  Sven Wischnowsky  <wischnow@zsh.org>
 
+	* ?????: Completion/Commands/_generic, Doc/Zsh/compsys.yo: new
+	_generic widget to call completion with $WIDGET in function field
+	of context
+	
+	* ?????: Completion/Core/_main_complete, Doc/Zsh/compsys.yo: allow 
+	insert-tab style to contain `pending[=num]' to handle the case
+	when there is pending input
+
 	* ?????: Completion/Core/_expand, Doc/Zsh/compsys.yo: new style
 	`suffix', use accept-exact style in _expand
 	
diff --git a/Completion/Commands/_generic b/Completion/Commands/_generic
new file mode 100644
index 000000000..9a6b4401f
--- /dev/null
+++ b/Completion/Commands/_generic
@@ -0,0 +1,11 @@
+#autoload
+
+local curcontext="$curcontext"
+
+if [[ -z "$curcontext" ]]; then
+  curcontext="${WIDGET}:::"
+else
+  curcontext="${WIDGET}:${curcontext#*:}"
+fi
+
+_main_complete
diff --git a/Doc/Zsh/compsys.yo b/Doc/Zsh/compsys.yo
index f23f993fd..5167c626b 100644
--- a/Doc/Zsh/compsys.yo
+++ b/Doc/Zsh/compsys.yo
@@ -2452,6 +2452,20 @@ Unlike tt(_expand) this uses a `tt(1)' (one) as the default
 value for the tt(substitute) and tt(glob) styles, so both types of
 expansion will normally be performed.
 )
+findex(_generic)
+item(tt(_generic))(
+This function is not defined as a widget and not bound by
+default. However, it can be used to define a widget and will then
+store the name of the widget in the var(function) field of the context 
+and call the completion system. This allows to easily define custom
+completion widgets with their own sets of style settings. For example, 
+to define a widget that does normal completion and starts
+menu-selection, one could do:
+
+example(zle -C foo complete-word _generic
+bindkey '...' foo
+zstyle ':completion:foo:*' menu yes select=1)
+)
 findex(_history_complete_word) (\e/))
 item(tt(_history_complete_word) (\e/))(
 Complete words from the shell's command history. This uses the