From: Sven Wischnowsky <wischnow@informatik.hu-berlin.de>
To: zsh-workers@sunsite.auc.dk
Subject: Re: PATCH: Completion/User/_cvs again.
Date: Tue, 7 Sep 1999 13:51:04 +0200 (MET DST) [thread overview]
Message-ID: <199909071151.NAA04195@beta.informatik.hu-berlin.de> (raw)
In-Reply-To: Sven Wischnowsky's message of Tue, 7 Sep 1999 13:22:08 +0200 (MET DST)
I wrote:
> Tanaka Akira wrote:
>
> > I think the style of `_rpm' is useful for state machines. But it
> > cannot represent function call. And `_cvs' has such functions.
> >
> > For example, `_cvs_extract_directory_entries' is called from
> > `_cvs_setup_allentries', `_cvs_setup_direntries' and
> > `_cvs_setup_modentries'. And it should return to its caller.
> > This is hard to implement in state machine style, I think.
>
> Ah, I see. Sorry.
>
> Yes, adding a heap of extra states a la `extract_file_or_directory_entry'
> is ugly.
>
> Hm, some form of `case' that executes all matching branches would be
> useful here.
>
> (Yes, I know that one can do that e.g. with a `case' in a loop where
> the case branches remove substrings from the `state' name, but that
> isn't exactly a nice solution, either.)
I always forget things...
Of course, one can also do (in file `_foo'):
#compdef foo
local state lstate ret=1
if (( $# )); then
state="$1"
else
_arguments '...:->bar' ... && ret=0
fi
while [[ -n "$state" ]]; do
lstate="$state"
state=''
case "$lstate" in
bar)
# include completions for state `baz' and `foobar'
_foo baz && ret=0
_foo foobar && ret=0 # this could also be `state=foobar'
;;
baz) ... ;;
foobar) ...;;
esac
done
return ret
Don't know if that is cleaner than your solution, though.
Bye
Sven
--
Sven Wischnowsky wischnow@informatik.hu-berlin.de
next reply other threads:[~1999-09-07 11:51 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
1999-09-07 11:51 Sven Wischnowsky [this message]
-- strict thread matches above, loose matches on Subject: below --
1999-09-08 8:27 Sven Wischnowsky
1999-09-08 7:08 Sven Wischnowsky
1999-09-07 11:22 Sven Wischnowsky
1999-09-07 7:17 Sven Wischnowsky
1999-09-07 10:47 ` Tanaka Akira
1999-09-07 22:26 ` Bart Schaefer
1999-09-07 22:58 ` Tanaka Akira
1999-09-08 0:46 ` Bart Schaefer
1999-09-06 18:10 Tanaka Akira
1999-09-07 21:06 ` Bart Schaefer
1999-09-07 23:22 ` Tanaka Akira
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=199909071151.NAA04195@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).