From: Sven Wischnowsky <wischnow@informatik.hu-berlin.de>
To: zsh-workers@sunsite.auc.dk
Subject: Re: Reading completion manual
Date: Wed, 3 Mar 1999 14:34:53 +0100 (MET) [thread overview]
Message-ID: <199903031334.OAA00644@beta.informatik.hu-berlin.de> (raw)
In-Reply-To: "Andrej Borsenkow"'s message of Tue, 2 Mar 1999 19:52:50 +0300
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
next reply other threads:[~1999-03-03 13:36 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
1999-03-03 13:34 Sven Wischnowsky [this message]
-- strict thread matches above, loose matches on Subject: below --
1999-03-03 9:29 Sven Wischnowsky
1999-03-04 5:50 ` Bart Schaefer
1999-03-02 16:52 Andrej Borsenkow
1999-03-02 17:09 ` Bruce Stephens
1999-03-02 17:20 ` Andrej Borsenkow
1999-03-02 17:29 ` Bruce Stephens
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=199903031334.OAA00644@beta.informatik.hu-berlin.de \
--to=wischnow@informatik.hu-berlin.de \
--cc=zsh-workers@sunsite.auc.dk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).