From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10851 invoked from network); 16 May 2000 11:12:10 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 16 May 2000 11:12:10 -0000 Received: (qmail 18617 invoked by alias); 16 May 2000 11:12:01 -0000 Mailing-List: contact zsh-workers-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 11406 Received: (qmail 18610 invoked from network); 16 May 2000 11:12:00 -0000 Date: Tue, 16 May 2000 13:11:38 +0200 (MET DST) Message-Id: <200005161111.NAA27123@beta.informatik.hu-berlin.de> From: Sven Wischnowsky To: zsh-workers@sunsite.auc.dk In-reply-to: Tanaka Akira's message of 16 May 2000 08:05:27 +0900 Subject: PATCH: _arguments (was: Re: option and case insensitive matcher-list.) 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 > -> > 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