* PATCH: _arguments (was: Re: option and case insensitive matcher-list.)
@ 2000-05-16 11:11 Sven Wischnowsky
2000-05-16 15:08 ` Andrej Borsenkow
0 siblings, 1 reply; 2+ messages in thread
From: Sven Wischnowsky @ 2000-05-16 11:11 UTC (permalink / raw)
To: zsh-workers
Tanaka Akira wrote:
> Z(4):akr@serein% Src/zsh -f
> serein% bindkey -e; autoload -U compinit; compinit -D; compdef _tst tst
> serein% _tst () { _arguments '-o+:o: _message x' -O }
> serein% zstyle ':completion:*' matcher-list '' 'm:{a-z}={A-Z}'
> serein% tst -o<TAB>
> ->
> serein% tst -O
>
> Is this intentional? I like that `x' is displayed in this case,
> though.
Of course, you'll get the `x' only if the format style is set...
But yes, the behaviour is a bit weird.
In another message:
> This patch modifies _diff_options to use =-.
>
> Apart from that, I found another use of optional argument in _a2ps:
>
> "--pretty-print*::style:(${_a2ps_cache_values[1]})" \
> ...
>
> But this is a description for automatic option detection. Is there a
> way to specify that it should use `=-'?
Umpf. No, currently not and I can't think of a good syntax. Does
anyone have suggestion? (Of course we could just put it before the
`--' with a normal spec, but I'd like to find a way to specify such
things for the auto-detection descriptions...)
Bye
Sven
Index: Completion/Base/_arguments
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Base/_arguments,v
retrieving revision 1.17
diff -u -r1.17 _arguments
--- Completion/Base/_arguments 2000/05/12 14:36:46 1.17
+++ Completion/Base/_arguments 2000/05/16 11:09:55
@@ -163,7 +163,7 @@
zstyle -s ":completion:${curcontext}:options" auto-description autod
if (( $# )) && comparguments "$multi[@]" "$autod" "$@"; then
- local action noargs aret expl local
+ local action noargs aret expl local tried
local next direct odirect equal single match matched ws tmp1 tmp2 tmp3
local opts subc tc prefix suffix descrs actions subcs
local origpre="$PREFIX" origipre="$IPREFIX"
@@ -244,6 +244,7 @@
_message "$descr"
mesg=yes
+ tried=yes
elif [[ "$action" = \(\(*\)\) ]]; then
@@ -252,6 +253,7 @@
eval ws\=\( "${action[3,-3]}" \)
_describe -t "$subc" "$descr" ws -M "$match" "$subopts[@]"
+ tried=yes
elif [[ "$action" = \(*\) ]]; then
@@ -259,6 +261,7 @@
_all_labels "$subc" expl "$descr" \
compadd "$subopts[@]" - ${=action[2,-2]}
+ tried=yes
elif [[ "$action" = \{*\} ]]; then
# A string in braces is evaluated.
@@ -266,6 +269,7 @@
while _next_label "$subc" expl "$descr"; do
eval "$action[2,-2]"
done
+ tried=yes
elif [[ "$action" = \ * ]]; then
# If the action starts with a space, we just call it.
@@ -274,6 +278,7 @@
while _next_label "$subc" expl "$descr"; do
"$action[@]"
done
+ tried=yes
else
# Otherwise we call it with the description-arguments.
@@ -282,6 +287,7 @@
while _next_label "$subc" expl "$descr"; do
"$action[1]" "$subopts[@]" "$expl[@]" "${(@)action[2,-1]}"
done
+ tried=yes
fi
fi
fi
@@ -294,7 +300,7 @@
{ [[ -n "$ismulti" ]] ||
! zstyle -T ":completion:${curcontext}:options" prefix-needed ||
[[ "$origpre" = [-+]* ||
- ( -z "$aret$mesg" && nm -eq compstate[nmatches] ) ]] } ; then
+ ( -z "$aret$mesg" && -z "$tried" ) ]] } ; then
local prevpre="$PREFIX" previpre="$IPREFIX"
hasopts=yes
@@ -351,6 +357,7 @@
PREFIX="$prevpre"
IPREFIX="$previpre"
fi
+ [[ -n "$tried" ]] && break
done
if [[ -n "$opts" && -z "$aret$matched$mesg" &&
nm -eq compstate[nmatches] ]]; then
--
Sven Wischnowsky wischnow@informatik.hu-berlin.de
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: PATCH: _arguments (was: Re: option and case insensitive matcher-list.)
2000-05-16 11:11 PATCH: _arguments (was: Re: option and case insensitive matcher-list.) Sven Wischnowsky
@ 2000-05-16 15:08 ` Andrej Borsenkow
0 siblings, 0 replies; 2+ messages in thread
From: Andrej Borsenkow @ 2000-05-16 15:08 UTC (permalink / raw)
To: Sven Wischnowsky; +Cc: zsh-workers
On Tue, 16 May 2000, Sven Wischnowsky wrote:
>
> Umpf. No, currently not and I can't think of a good syntax. Does
> anyone have suggestion? (Of course we could just put it before the
> `--' with a normal spec, but I'd like to find a way to specify such
> things for the auto-detection descriptions...)
>
Sven, you once asked about example, why adding new features to _arguments
is not as easy. Here you have one. For this reason I really think, that
something different (like flags in parameter expansions or globbing) is
needed. In this case you have just one syntax construct.
I do not suggest, that should not support current formats. It needs too
much rewrite. But for the future something different is definitely needed.
-andrej
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2000-05-16 15:09 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-05-16 11:11 PATCH: _arguments (was: Re: option and case insensitive matcher-list.) Sven Wischnowsky
2000-05-16 15:08 ` Andrej Borsenkow
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).