Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Reading completion manual
- X-seq: zsh-workers 5625
- From: Sven Wischnowsky <wischnow@xxxxxxxxxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxxxxxxxxx
- Subject: Re: Reading completion manual
- Date: Wed, 3 Mar 1999 14:34:53 +0100 (MET)
- In-reply-to: "Andrej Borsenkow"'s message of Tue, 2 Mar 1999 19:52:50 +0300
- Mailing-list: contact zsh-workers-help@xxxxxxxxxxxxxx; run by ezmlm
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@xxxxxxxxxxxxxxxxxxxxxxx
Messages sorted by:
Reverse Date,
Date,
Thread,
Author