Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: PATCH: _look
- X-seq: zsh-workers 11192
- From: Sven Wischnowsky <wischnow@xxxxxxxxxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxxxxxxxxx
- Subject: Re: PATCH: _look
- Date: Fri, 5 May 2000 13:55:57 +0200 (MET DST)
- In-reply-to: Tanaka Akira's message of 05 May 2000 20:31:26 +0900
- Mailing-list: contact zsh-workers-help@xxxxxxxxxxxxxx; run by ezmlm
Tanaka Akira wrote:
> This is a completion function for `look'. It calls `look' itself to
> find completions.
>
> Apart from that, I found that some functions using a state of
> _arguments such as _gzip declare `curcontext' instead of `context'
> which is specified by zshcompsys(1). Is `curcontext' obsolete?
No. Functions should either
- Call _arguments as in _gzip, make `context' local and in the
state-handling make sure that $context is used in the argument field
of the context name. This is what functions like _tags do when given
the -C option, so:
local context state line
typeset -A opt_args
_arguments '...:->foo' && return 0
if [[ "$state" = foo ]]; then
_tags -C "$context"
...
fi
(That `&& return 0' is missing in _gzip, too.)
Actually, $state and $context nowadays are arrays, because
_arguments may return more than one state, but that's only possible
if the specs make it possible that more than one argument may be
completed in some place.
- Call _arguments with the -C option and then make `curcontext' local,
initialising it to itself, as is done in _gzip. In that case
_arguments will modify $curcontext without making it local to itself
so that the state-handling code doesn't need to care about setting
up the context. Of course, this only works if only one state can be
returned by _arguments. This was the case for all completion
functions when I added the multi-state handling to _arguments.
In other words, there is a `-C' missing in _gzip (and probably in
other functions?).
Bye
Sven
--
Sven Wischnowsky wischnow@xxxxxxxxxxxxxxxxxxxxxxx
Messages sorted by:
Reverse Date,
Date,
Thread,
Author