Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

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<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@xxxxxxxxxxxxxxxxxxxxxxx



Messages sorted by: Reverse Date, Date, Thread, Author