From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16729 invoked from network); 13 Jun 2000 12:45:43 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 13 Jun 2000 12:45:43 -0000 Received: (qmail 18718 invoked by alias); 13 Jun 2000 12:45:35 -0000 Mailing-List: contact zsh-workers-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 11872 Received: (qmail 18709 invoked from network); 13 Jun 2000 12:45:33 -0000 Date: Tue, 13 Jun 2000 13:54:01 +0200 (MET DST) Message-Id: <200006131154.NAA31445@beta.informatik.hu-berlin.de> From: Sven Wischnowsky To: zsh-workers@sunsite.auc.dk Subject: PATCH: _generic Felix suggested something like this some time ago. I think there were more suggestions, but I can't find the message anymore. Anyway, maybe this is an acceptable start... _generic puts $WIDGET in the function field of the context and calls _main_complete. I.e. it allows users to (relatively) easily define custom completion widgets for which different styles can be set. Bye Sven Index: Completion/Commands/_generic =================================================================== RCS file: _generic diff -N _generic --- /dev/null Tue May 5 13:32:27 1998 +++ _generic Tue Jun 13 04:53:24 2000 @@ -0,0 +1,11 @@ +#autoload + +local curcontext="$curcontext" + +if [[ -z "$curcontext" ]]; then + curcontext="${WIDGET}:::" +else + curcontext="${WIDGET}:${curcontext#*:}" +fi + +_main_complete Index: Doc/Zsh/compsys.yo =================================================================== RCS file: /cvsroot/zsh/zsh/Doc/Zsh/compsys.yo,v retrieving revision 1.62 diff -u -r1.62 compsys.yo --- Doc/Zsh/compsys.yo 2000/06/13 11:45:26 1.62 +++ Doc/Zsh/compsys.yo 2000/06/13 11:53:26 @@ -2452,6 +2452,20 @@ 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 -- Sven Wischnowsky wischnow@informatik.hu-berlin.de