From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9334 invoked from network); 3 Mar 1999 13:36:07 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 3 Mar 1999 13:36:07 -0000 Received: (qmail 19329 invoked by alias); 3 Mar 1999 13:35:39 -0000 Mailing-List: contact zsh-workers-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 5625 Received: (qmail 19319 invoked from network); 3 Mar 1999 13:35:36 -0000 Date: Wed, 3 Mar 1999 14:34:53 +0100 (MET) Message-Id: <199903031334.OAA00644@beta.informatik.hu-berlin.de> From: Sven Wischnowsky To: zsh-workers@sunsite.auc.dk In-reply-to: "Andrej Borsenkow"'s message of Tue, 2 Mar 1999 19:52:50 +0300 Subject: Re: Reading completion manual I forgot to reply to... Andrej Borsenkow wrote: > What happens, if I use > several compgen's with different listings (-y parameter)? Matches with a `-y' list are put into separate groups with names that no user will ever be able to use. When matches are listed, those groups are always `listed', i.e. the display-list is shown. All of them. > As most of us, I don't like the idea of conditions with side effects. But I > don't like the Sven's suggestion of replacing conditions with shell code > either (at least, with *THIS* code :-) Even more, as it does not solve the > original problem - you still have to save parameters and restore them after > that. And here I forgot to point out that you need to restore the old values by hand only in those places where the parameters will be used again in the same function and not after the test just made. E.g.: foo() { if [[ ...test1... ]]; then IPREFIX=...; PREFIX=...; compgen ... elif [[ ...test2... ]]; then compgen ... else compgen ... fi } Here you don't need to restore them (and the completion code will automatically restore them on function exit). Only with: foo() { if [[ ...test... ]]; then IPREFIX=...; PREFIX=...; compgen ... # restore needed here fi compgen ... # or if [[ ...test... ]]; then ...; fi } will you need to restore them. Bye Sven -- Sven Wischnowsky wischnow@informatik.hu-berlin.de