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

Re: PATCH: _archie



Tanaka Akira wrote:

> Z(2):akr@is27e1u11% Src/zsh -f
> is27e1u11% bindkey -e; fpath=($PWD/Completion/*(/)); autoload -U compinit; compinit -D; compdef _tst tst
> is27e1u11% compconf group_matches=yes message_format='%d' description_format='%d'
> is27e1u11% compconf describe_options=yes describe_values=yes option_prefix=yes
> 
> (1) archie -O<TAB>

Whoa. I did quite a bit of testing but...

> (2) flex -C<TAB><TAB>

Oops. This works correctly for me. Hm, what am I doing wrong... (or right)

However, I forgot to include a hunk in `_values' for this one.

> (3) bison -ba <TAB>

So the argument may come directly after the `-b'... this needed only a 
fix in `_bison' (since it expected the argument of `-b' to be in the
next word it thought that `-ba' wasn't an option string and hence took 
it for the first and only argument).

> (4) bison -Vba -<TAB>

Same reason and fix as for (3), it didn't consider `-Vba' to be an
option string.

Bye
 Sven

diff -u oldsrc/Zle/computil.c Src/Zle/computil.c
--- oldsrc/Zle/computil.c	Thu Oct 21 12:31:50 1999
+++ Src/Zle/computil.c	Thu Oct 21 14:31:47 1999
@@ -696,7 +696,8 @@
 		opt->name = ztrdup(name);
 		if (descr)
 		    opt->descr = ztrdup(descr);
-		else if (adpre && oargs && !oargs->next)
+		else if (adpre && oargs && !oargs->next &&
+			 oargs->descr && oargs->descr[0])
 		    opt->descr = tricat(adpre, oargs->descr, adsuf);
 		else
 		    opt->descr = NULL;
@@ -1118,8 +1119,15 @@
 	    ca_laststate.doff = 0;
 	} else if (cur == compcurrent && !ca_laststate.def) {
 	    if ((ca_laststate.def = ddef)) {
-		ca_laststate.doff = doff;
-		ca_laststate.opt = 0;
+		ca_laststate.singles = state.singles;
+		if (state.curopt && state.curopt->type == CAO_NEXT) {
+		    ca_laststate.ddef = ddef;
+		    ca_laststate.def = NULL;
+		    ca_laststate.opt = 1;
+		} else {
+		    ca_laststate.doff = doff;
+		    ca_laststate.opt = 0;
+		}
 	    } else {
 		ca_laststate.def = adef;
 		ca_laststate.ddef = NULL;
diff -u -r oldcompletion/Base/_arguments Completion/Base/_arguments
--- oldcompletion/Base/_arguments	Thu Oct 21 10:33:22 1999
+++ Completion/Base/_arguments	Thu Oct 21 14:38:12 1999
@@ -71,7 +71,7 @@
 
     lopts=("--${(@)^${(@)${(@)${(@M)${(@ps:\n:j:\n:)${(@)${(@M)${(@f)$(${~words[1]} --help 2>&1)//\[--/
 --}:#[ 	]#-*}//,/
-}}:#[ 	]#--*}#*--}%%[, ]*}:#}")
+}}:#[ 	]#--*}#*--}%%[], ]*}:#}")
 
     # Now remove all ignored options ...
 
@@ -227,7 +227,8 @@
 
     if [[ -z "$matched" ]] &&
        comparguments -O next direct odirect equal &&
-       [[ ( ( nm -eq compstate[nmatches] || -n "$noargs" ) && -z "$aret" ) ||
+       [[ ( ( nm -eq compstate[nmatches] || -n "$noargs" ) &&
+            -z "$aret" && -z "$mesg" ) ||
           -z "$compconfig[option_prefix]" || 
           "$compconfig[option_prefix]" = *\!${cmd}* ||
           "$PREFIX" = [-+]* ]]; then
@@ -246,6 +247,7 @@
 	  compadd "$expl[@]" -QqS= - "${PREFIX}${SUFFIX}"
         else
 	  tmp1=( "$next[@]" "$direct[@]" "$odirect[@]" "$equal[@]" )
+	  tmp1=( "${(M@)tmp1:#[-+]?(|:*)}" )
 	  tmp2=( "${PREFIX}${(@M)^${(@)${(@)tmp1%%:*}#[-+]}:#?}" )
 
           _describe -o -c "$cmd" option tmp1 tmp2 -Q -S ''
diff -u -r oldcompletion/Base/_values Completion/Base/_values
--- oldcompletion/Base/_values	Thu Oct 21 08:58:56 1999
+++ Completion/Base/_values	Thu Oct 21 11:45:48 1999
@@ -36,7 +36,7 @@
     else
       compvalues -d descr
       if [[ ${#noargs}+${#args}+${#opts} -ne 1 ]] && compvalues -s sep; then
-        sep=( "-qQS$sep" )
+        sep=( "-qQS" "$sep" )
       else
         sep=()
       fi
diff -u -r oldcompletion/User/_bison Completion/User/_bison
--- oldcompletion/User/_bison	Thu Oct 21 10:33:31 1999
+++ Completion/User/_bison	Thu Oct 21 13:42:09 1999
@@ -1,14 +1,14 @@
 #compdef bison
 
 _arguments -s \
-  '(--file-prefix)-b[specify output file prefix]:output file prefix:' \
+  '(--file-prefix)-b+[specify output file prefix]:output file prefix:' \
   '(--defines)-d[write token definition file]' \
   '(--raw)-r[output bison token numbers]' \
   '(--token-table)-k[output token table]' \
   '(--no-lines)-l[don'"'"'t generate #line directives]' \
   '(--no-parser)-n[don'"'"'t generate parse (only declarations)]' \
-  '(--output-file)-o[specify parser output file name]:parser file name:_files' \
-  '(--name-prefix)-p[change yy prefix]:prefix string:' \
+  '(--output-file)-o+[specify parser output file name]:parser file name:_files' \
+  '(--name-prefix)-p+[change yy prefix]:prefix string:' \
   '(--debug)-t[output YYDEBUG definition]' \
   '(--verbose)-v[verbose mode]' \
   '(--version)-V[show version]' \

--
Sven Wischnowsky                         wischnow@xxxxxxxxxxxxxxxxxxxxxxx



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