zsh-workers
 help / color / mirror / code / Atom feed
* PATCH: Re: sudo completion problem
@ 2000-05-03 14:42 Sven Wischnowsky
  2000-05-03 14:56 ` Andrej Borsenkow
  2000-05-06  6:56 ` Andrej Borsenkow
  0 siblings, 2 replies; 14+ messages in thread
From: Sven Wischnowsky @ 2000-05-03 14:42 UTC (permalink / raw)
  To: zsh-workers


Andrej Borsenkow wrote:

> bor@itsrm2% sudo rm -r
> Completing Kerberos realm
> Completing `Kerberos realm'
> 
> Hmm ... it treats -r as sudo option ... but, I think, it did work once
> ...

If it did, then only before we used the separate description to get
only external command names or because there was some other bug.

Hm. From the logic of the specifications used by _sudo, this
completion is correct, after all, there may be options between
arguments unless otherwise specified.

So this adds the special string `-' for exclusion lists which makes
the description for the options not be used any more. And it makes
this be used in the places where we have such _command_names/_normal
combinations.


Bye
 Sven

Index: Completion/User/_fakeroot
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/User/_fakeroot,v
retrieving revision 1.1
diff -u -r1.1 _fakeroot
--- Completion/User/_fakeroot	2000/04/08 21:06:48	1.1
+++ Completion/User/_fakeroot	2000/05/03 14:39:09
@@ -2,5 +2,6 @@
 
 _arguments \
        '--lib[alternate wrapper library]:wrapper library:_files' \
-       '--faked[alternate faked binary]:fake binary:_command_names' \
+       '--faked[alternate faked binary]:fake binary: _command_names -e' \
+       '(-):command name: _command_names -e'  \
        '*::arguments: _normal'
Index: Completion/User/_rlogin
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/User/_rlogin,v
retrieving revision 1.3
diff -u -r1.3 _rlogin
--- Completion/User/_rlogin	2000/04/11 07:57:57	1.3
+++ Completion/User/_rlogin	2000/05/03 14:39:09
@@ -17,7 +17,7 @@
       '-n[ignore stdin]' \
       '-l[specify login user name]:login as:_rlogin_users' \
       ':remote host name:_rlogin_hosts' \
-      ':command: _command_names -e' \
+      '(-):command: _command_names -e' \
       '*::command:->command' && ret=0
 
     if [[ -n "$state" ]]; then
Index: Completion/User/_ssh
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/User/_ssh,v
retrieving revision 1.2
diff -u -r1.2 _ssh
--- Completion/User/_ssh	2000/04/05 11:28:09	1.2
+++ Completion/User/_ssh	2000/05/03 14:39:09
@@ -18,7 +18,7 @@
   ssh|slogin)
     args=(
       ':remote host name:->userhost'
-      ':command: _command_names -e'
+      '(-):command: _command_names -e'
       '*::args:->command'
     )
     ;&
Index: Completion/User/_sudo
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/User/_sudo,v
retrieving revision 1.1.1.3
diff -u -r1.1.1.3 _sudo
--- Completion/User/_sudo	2000/03/09 11:43:52	1.1.1.3
+++ Completion/User/_sudo	2000/05/03 14:39:09
@@ -15,5 +15,5 @@
        '-s[run SHELL]' \
        '-H[set HOME environment variable]' \
        '-S[read password from stdin]' \
-       ':complete command name: _command_names -e'  \
+       '(-):command name: _command_names -e'  \
        '*::arguments: _normal'
Index: Completion/User/_xargs
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/User/_xargs,v
retrieving revision 1.1.1.2
diff -u -r1.1.1.2 _xargs
--- Completion/User/_xargs	1999/09/07 12:55:12	1.1.1.2
+++ Completion/User/_xargs	2000/05/03 14:39:09
@@ -9,5 +9,5 @@
   '(-n -l)-L:number of input lines:' \
   '(-l -L)-n:maximum number of arguments:' \
   '-s:maximum command line length:' \
-  ':command: _command_names -e' \
-  '*::args:_normal'
+  '(-):command: _command_names -e' \
+  '*::args: _normal'
Index: Completion/X/_xutils
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/X/_xutils,v
retrieving revision 1.4
diff -u -r1.4 _xutils
--- Completion/X/_xutils	2000/04/11 07:57:57	1.4
+++ Completion/X/_xutils	2000/05/03 14:39:09
@@ -107,7 +107,8 @@
     '-screen:screen number:' \
     '-user:remote user name:_users' \
     ':remote host:_hosts' \
-    '*:command::command:_normal'
+    '(-):command: _command_names -e' \
+    '*:command: _normal'
   ;;
 xsetroot)
   _x_arguments \
Index: Doc/Zsh/compsys.yo
===================================================================
RCS file: /cvsroot/zsh/zsh/Doc/Zsh/compsys.yo,v
retrieving revision 1.31
diff -u -r1.31 compsys.yo
--- Doc/Zsh/compsys.yo	2000/05/03 08:46:52	1.31
+++ Doc/Zsh/compsys.yo	2000/05/03 14:39:11
@@ -2925,9 +2925,10 @@
 the argument described by the specification will not be offered if the
 option tt(-foo) is on the line. Also, the list may contain a single
 star as one of its elements to specify that the description for the
-rest arguments should not be used and it may contain a colon to
+rest arguments should not be used, a colon to
 specify that the descriptions for all normal (non-option-) arguments
-should not be used.
+should not be used and a hyphen to specify that the descriptions for
+all options should not be used.
 
 In each of the cases above, the var(action) says how the possible
 completions should be generated. In cases where only one of a fixed
Index: Src/Zle/computil.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Zle/computil.c,v
retrieving revision 1.11
diff -u -r1.11 computil.c
--- Src/Zle/computil.c	2000/05/02 08:56:28	1.11
+++ Src/Zle/computil.c	2000/05/03 14:39:12
@@ -1040,7 +1040,12 @@
 	    }
 	    if (x[0] == ':' && !x[1])
 		d->argsactive = 0;
-	    else if (x[0] == '*' && !x[1]) {
+	    else if (x[0] == '-' && !x[1]) {
+		Caopt p;
+
+		for (p = d->opts; p; p = p->next)
+		    p->active = 0;
+	    } else if (x[0] == '*' && !x[1]) {
 		if (d->rest)
 		    d->rest->active = 0;
 	    } else if (x[0] >= '0' && x[0] <= '9') {

--
Sven Wischnowsky                         wischnow@informatik.hu-berlin.de


^ permalink raw reply	[flat|nested] 14+ messages in thread

* RE: PATCH: Re: sudo completion problem
  2000-05-03 14:42 PATCH: Re: sudo completion problem Sven Wischnowsky
@ 2000-05-03 14:56 ` Andrej Borsenkow
  2000-05-03 15:09   ` Zefram
  2000-05-06  6:56 ` Andrej Borsenkow
  1 sibling, 1 reply; 14+ messages in thread
From: Andrej Borsenkow @ 2000-05-03 14:56 UTC (permalink / raw)
  To: Sven Wischnowsky, zsh-workers

>
> If it did, then only before we used the separate description to get
> only external command names or because there was some other bug.
>

I think, it was the result of change for find (do not have article
handy) - in ``find /tmp -user'' -user was not recognised as option
because /tmp already was argument. So, this change made options be found
everywhere, even after arguments :-) Just to make sure it won't break
this change ...

-andrej


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: PATCH: Re: sudo completion problem
  2000-05-03 14:56 ` Andrej Borsenkow
@ 2000-05-03 15:09   ` Zefram
  2000-05-04  7:23     ` Andrej Borsenkow
  0 siblings, 1 reply; 14+ messages in thread
From: Zefram @ 2000-05-03 15:09 UTC (permalink / raw)
  To: Andrej Borsenkow; +Cc: Sven Wischnowsky, zsh-workers

Andrej Borsenkow wrote:
>I think, it was the result of change for find (do not have article
>handy) - in ``find /tmp -user'' -user was not recognised as option
>because /tmp already was argument. So, this change made options be found
>everywhere, even after arguments :-)

That's the wrong way to do it.  In the find command line, `-user' is not
an option, it's an expression (or part thereof).  The expression starts
with the first argument that starts with `-' and continues to the end
of the line; the directory arguments must appear before the expression.
Actual options are handled as dummy predicates, which is confusing to
the user, but from our point of view means that they must be treated as
part of the expression.

find has a unique syntax, with no options having the usual option syntax.
Therefore it shouldn't be handled by the standard option completion
function; it needs a dedicated find-expression completion function.
The standard option completion function should, as is standard syntax,
process options only before the first non-option argument.

No patch, sorry, I'm not up to speed on the completion functions yet.

-zefram


^ permalink raw reply	[flat|nested] 14+ messages in thread

* RE: PATCH: Re: sudo completion problem
  2000-05-03 15:09   ` Zefram
@ 2000-05-04  7:23     ` Andrej Borsenkow
  2000-05-04 12:02       ` Tanaka Akira
  0 siblings, 1 reply; 14+ messages in thread
From: Andrej Borsenkow @ 2000-05-04  7:23 UTC (permalink / raw)
  To: Zefram; +Cc: Sven Wischnowsky, zsh-workers

> Andrej Borsenkow wrote:
> >I think, it was the result of change for find (do not have article
> >handy) - in ``find /tmp -user'' -user was not recognised as option
> >because /tmp already was argument. So, this change made
> options be found
> >everywhere, even after arguments :-)
>
> That's the wrong way to do it.  In the find command line,
> `-user' is not
> an option, it's an expression (or part thereof).  The
> expression starts
> with the first argument that starts with `-' and continues to the end
> of the line; the directory arguments must appear before the
> expression.
> Actual options are handled as dummy predicates, which is confusing to
> the user, but from our point of view means that they must be
> treated as
> part of the expression.
>


I was about to suggest, that it still doable with _arguments - but then
realised, that there is no way to describe "structured arguments" or
"argument values". Every argument is treated as an independent word and
moreover, there is no way to "name" arguments at all.

So, the question is - how useful would it be to allow "named,
structured, ..." arguments? The point is, description vs. shell code.
Basically, be able to treat arguments in almost the same way as
options - with some separator in between. In this case, we could still
use _arguments for find - actually, it does it quite well currently, and
it is a pity to reinvent the wheel.

This may be useful in other cases as well. cvs comes in mind
immediately - common options, then checkout, update, etc as argument -
and possibly (sub-)options and (sub-)arguments for every of them.

I understand, that this is hierarchical structure that probably cannot
be handled with one single table ... but, just as idea, imagine that
action for `update' argument simply points to subarguments description
... or something like this ... this may be more readable than shell
functions. May be not. But it is easier in cases, where we need several
versions for different plattforms.

Then I realised, that reverse situation exists with options - there is
no way to describe options without - prefix. Consider dd or tar ("tar"
not "GNU tar" :-), BSD ps ... In case of dd we have only options; in
case of tar ot ps, the first word consists of single letter options with
possible arguments in next words in order. There is no way to describe
both case with _arguments (unless I'm mistaken).

And I'd like repeat once more - currently, when _arguments is using
lexical structure to describe semantic, it is hard to add something. If
we had flags ... (not suggesting breaking compatibility - but just for
future use).

-andrej


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: PATCH: Re: sudo completion problem
  2000-05-04  7:23     ` Andrej Borsenkow
@ 2000-05-04 12:02       ` Tanaka Akira
  2000-05-04 13:40         ` Sven Wischnowsky
  0 siblings, 1 reply; 14+ messages in thread
From: Tanaka Akira @ 2000-05-04 12:02 UTC (permalink / raw)
  To: zsh-workers

In article <000601bfb599$a9219f80$21c9ca95@mow.siemens.ru>,
  "Andrej Borsenkow" <Andrej.Borsenkow@mow.siemens.ru> writes:

> So, the question is - how useful would it be to allow "named,
> structured, ..." arguments? The point is, description vs. shell code.
> Basically, be able to treat arguments in almost the same way as
> options - with some separator in between. In this case, we could still
> use _arguments for find - actually, it does it quite well currently, and
> it is a pity to reinvent the wheel.

Although I think (-) is good extension, I agree that there are
commands which has too complex argument parsing routine to handle by
_arguments.  And it is true that writing dedicated handling routine as
shell function is too difficult in general.

We need intermediate solution for a completion function of such
commands: more powerful than _arguments and easier than shell
function.  But more difficult than _arguments, maybe.

My idea is already implemented: _regex_arguments.  Although currently
there are only three completion functions - _apt, _xwit and _xset -
which use _regex_arguments because it cannot use _arguments,  I think
there are more completion  functions which can be written bit more
simple if _regex_arguments is used.  Maybe, _xauth (and _cvs?).

> I understand, that this is hierarchical structure that probably cannot
> be handled with one single table ... but, just as idea, imagine that
> action for `update' argument simply points to subarguments description
> ... or something like this ... this may be more readable than shell
> functions. May be not. But it is easier in cases, where we need several
> versions for different plattforms.

In _regex_arguments, a arguments of commands are described as regex
like notation.  Of course, it can handle hierarchical one.

> Then I realised, that reverse situation exists with options - there is
> no way to describe options without - prefix. Consider dd or tar ("tar"
> not "GNU tar" :-), BSD ps ... In case of dd we have only options; in
> case of tar ot ps, the first word consists of single letter options with
> possible arguments in next words in order. There is no way to describe
> both case with _arguments (unless I'm mistaken).

_regex_arguments doesn't handle `-' or `+' specially.

> And I'd like repeat once more - currently, when _arguments is using
> lexical structure to describe semantic, it is hard to add something. If
> we had flags ... (not suggesting breaking compatibility - but just for
> future use).

_regex_arguments handle only parsing of arguments.  So other stuff
handled by _arguments such as descriptions, exclusive options must be
implemented by completion function writer.  It's bit hard task but we
can implement special feature easily.
-- 
Tanaka Akira


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: PATCH: Re: sudo completion problem
@ 2000-05-04 13:40         ` Sven Wischnowsky
  2000-05-04 15:14           ` Completing for "find" and _regex_arguments (Re: PATCH: Re: sudo completion problem) Bart Schaefer
  2000-05-04 20:12           ` PATCH: Re: sudo completion problem Tanaka Akira
  0 siblings, 2 replies; 14+ messages in thread
From: Sven Wischnowsky @ 2000-05-04 13:40 UTC (permalink / raw)
  To: zsh-workers


Tanaka Akira wrote:

> ...
> 
> My idea is already implemented: _regex_arguments.  Although currently
> there are only three completion functions - _apt, _xwit and _xset -
> which use _regex_arguments because it cannot use _arguments,  I think
> there are more completion  functions which can be written bit more
> simple if _regex_arguments is used.  Maybe, _xauth (and _cvs?).

Personally I find _arguments a whole lot more readable than
_regex_arguments. If that could be improved, I'd be glad.

Although I always wonder why people find _cvs difficult...

> ...
> 
> > And I'd like repeat once more - currently, when _arguments is using
> > lexical structure to describe semantic, it is hard to add something. If
> > we had flags ... (not suggesting breaking compatibility - but just for
> > future use).
> 
> _regex_arguments handle only parsing of arguments.  So other stuff
> handled by _arguments such as descriptions, exclusive options must be
> implemented by completion function writer.  It's bit hard task but we
> can implement special feature easily.

I would be *very* glad if _regex_arguments could at least handle the
tags, tag-labels and descriptions. I had lots of problems trying to
work those changes into the functions using _regex_arguments and since 
I don't know any of those commands I still don't know if I've got it
right.

Either in _regex_arguments or in a convenience wrapper function around 
it, of course.

Bye
 Sven


--
Sven Wischnowsky                         wischnow@informatik.hu-berlin.de


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Completing for "find" and _regex_arguments (Re: PATCH: Re: sudo completion problem)
  2000-05-04 13:40         ` Sven Wischnowsky
@ 2000-05-04 15:14           ` Bart Schaefer
  2000-05-04 16:16             ` Tanaka Akira
  2000-05-04 20:12           ` PATCH: Re: sudo completion problem Tanaka Akira
  1 sibling, 1 reply; 14+ messages in thread
From: Bart Schaefer @ 2000-05-04 15:14 UTC (permalink / raw)
  To: zsh-workers

On May 4,  9:02pm, Tanaka Akira wrote:
} Subject: Re: PATCH: Re: sudo completion problem
}
} In article <000601bfb599$a9219f80$21c9ca95@mow.siemens.ru>,
}   "Andrej Borsenkow" <Andrej.Borsenkow@mow.siemens.ru> writes:
} 
} > So, the question is - how useful would it be to allow "named,
} > structured, ..." arguments? The point is, description vs. shell code.
} 
} We need intermediate solution for a completion function of such
} commands: more powerful than _arguments and easier than shell
} function.  But more difficult than _arguments, maybe.
} 
} My idea is already implemented: _regex_arguments.

Indeed, I think _regex_arguments is just the thing here.  In fact, I said
so, back in 11018.

On May 4,  3:40pm, Sven Wischnowsky wrote:
} Subject: Re: PATCH: Re: sudo completion problem
}
} Personally I find _arguments a whole lot more readable than
} _regex_arguments. If that could be improved, I'd be glad.

Is there any chance that it could now be rewritten using extendedglob
patterns, rather than parsing its own RE syntax?

On the other hand, that might not make it any more readable.

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: Completing for "find" and _regex_arguments (Re: PATCH: Re: sudo completion problem)
  2000-05-04 15:14           ` Completing for "find" and _regex_arguments (Re: PATCH: Re: sudo completion problem) Bart Schaefer
@ 2000-05-04 16:16             ` Tanaka Akira
  0 siblings, 0 replies; 14+ messages in thread
From: Tanaka Akira @ 2000-05-04 16:16 UTC (permalink / raw)
  To: zsh-workers

In article <1000504151422.ZM22851@candle.brasslantern.com>,
  "Bart Schaefer" <schaefer@candle.brasslantern.com> writes:

> Is there any chance that it could now be rewritten using extendedglob
> patterns, rather than parsing its own RE syntax?

Hm.  _regex_arguments handles two kind of RE.  Inner RE is just
extendedglob pattern: /RE/.  Outer RE is RE which contains elements as
inner REs instead of characters.  Outer RE has also lookaheads, guards,
and actions and they are corresponds to inner REs.  A lookahead is
also just extendedglob pattern but it doesn't consume arguments
string.  This corresponds to a zero-width positive look-ahead
assertion in perl5: `(?=pattern)'.  A guard is zsh code to test
something which cannot represent as RE.  This corresponds to (??{
(code) ? "[^\000-\377]" : "" }) in perl5.6.  However, currently I
don't use this as real test.  I used this as recording option use
etc. and always report a test is succeed.  So (?{ code }) in perl5.6
is enough to implement my use.  A action is zsh code for completion.
They are evaluated when whole outer RE is failed to match.  When it is
failed, actions corresponding to inner REs which are last candidates
to match.  There is no direct correspondences in RE constructs.  But I
think this can be implemented as (?{ code }) which set some variables.

Note that outer RE of _regex_arguments is not real RE because it
doesn't backtrack.  But if it is implemented by real RE engine, it can
backtrack...

So, if extendedglob patterns have enough RE constructs in perl5.6, 
it can be used to unify inner and outer RE in _regex_arguments.
Maybe.
-- 
Tanaka Akira


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: PATCH: Re: sudo completion problem
  2000-05-04 13:40         ` Sven Wischnowsky
  2000-05-04 15:14           ` Completing for "find" and _regex_arguments (Re: PATCH: Re: sudo completion problem) Bart Schaefer
@ 2000-05-04 20:12           ` Tanaka Akira
  2000-05-04 20:40             ` Tanaka Akira
  1 sibling, 1 reply; 14+ messages in thread
From: Tanaka Akira @ 2000-05-04 20:12 UTC (permalink / raw)
  To: zsh-workers

In article <200005041340.PAA08620@beta.informatik.hu-berlin.de>,
  Sven Wischnowsky <wischnow@informatik.hu-berlin.de> writes:

> Personally I find _arguments a whole lot more readable than
> _regex_arguments. If that could be improved, I'd be glad.

I think so too.  It is one of biggest reason that always I tried to
use _arguments.

> I would be *very* glad if _regex_arguments could at least handle the
> tags, tag-labels and descriptions. I had lots of problems trying to
> work those changes into the functions using _regex_arguments and since 
> I don't know any of those commands I still don't know if I've got it
> right.

Hm.  OK.

Index: Completion/Base/_regex_arguments
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Base/_regex_arguments,v
retrieving revision 1.1.1.15
diff -u -r1.1.1.15 _regex_arguments
--- Completion/Base/_regex_arguments	2000/03/24 11:29:19	1.1.1.15
+++ Completion/Base/_regex_arguments	2000/05/04 20:03:10
@@ -68,8 +68,9 @@
 
   eval \
   "$funcname"' () {
-    local _ra_p1 _ra_p2 _ra_left _ra_right _ra_com
+    local _ra_p1 _ra_p2 _ra_left _ra_right _ra_com expl tmp nm="$compstate[nmatches]"
     local _ra_actions _ra_line="${(pj:\0:)${(@)words[1,CURRENT - 1]:Q}}"$'\''\0'\''"$PREFIX"
+    _ra_actions=()
     zregexparse -c _ra_p1 _ra_p2 "$_ra_line" '"${(j: :)${(qqqq)regex[@]}}"'
     case "$?" in
     0|2) _message "no more arguments";;
@@ -80,13 +81,26 @@
 	_ra_left="$_ra_line[_ra_p1 + 1, _ra_p2]"
 	_ra_right="$_ra_line[_ra_p2 + 1, -1]"
 	compset -p $(( $#PREFIX - $#_ra_line + $_ra_p1 ))
-	for _ra_com in "$_ra_actions[@]"; do
-	  eval "$_ra_com"
-	done
+	: "$_ra_actions[@]"
+	tmp=("${(@)_ra_actions%%:*}")
+	if (( $#tmp )); then
+	  _tags "$tmp[@]"
+	  while _tags; do
+	    for _ra_com in "$_ra_actions[@]"; do
+	      if _requested "${_ra_com%%:*}"; then
+		while _next_label "${_ra_com%%:*}" expl "${${_ra_com#*:}%%:*}"; do
+		  eval "${_ra_com#*:*:}"
+		done
+		[[ nm -ne "$compstate[nmatches]" ]] && break 2
+	      fi
+	    done
+	  done
+	fi
       fi
       ;;
     3) _message "invalid regex";;
     esac
+    [[ nm -ne "$compstate[nmatches]" ]]
   }'
 }
 
Index: Completion/Debian/_apt
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Debian/_apt,v
retrieving revision 1.3
diff -u -r1.3 _apt
--- Completion/Debian/_apt	2000/04/11 07:57:57	1.3
+++ Completion/Debian/_apt	2000/05/04 20:03:10
@@ -75,9 +75,9 @@
   nul=$'\0'
   qnul="\$'\\0'"
 
-  comp_bool='_wanted values expl_bool "boolean value" compadd "$expl_bool[@]" '"$bool"
+  comp_bool='compadd "$expl[@]" '"$bool"
   comp_intlevel= #"_message 'intlevel'"
-  comp_configfile='_files "$expl_configfile[@]"'
+  comp_configfile='_files "$expl[@]"'
   comp_arbitem= #"_message 'Foo::Bar=bar'"
 
   comp_short=\
@@ -116,15 +116,15 @@
     regex_short=("$regex_short[@]"
       /"$short_seq(${(j:|:)short_hasarg})(=|)"/
 	-'_apt_consume_short ${match[1]%=}; current_option=${canonicalize[-${${match[1]%=}[-1]}]}'
-	\( /"$word1"/ :"$comp_hasarg" \| /"$nul"/ /"$word"/ :"$comp_hasarg" \) \|
+	\( /"$word1"/ ":options:option:$comp_hasarg" \| /"$nul"/ /"$word"/ ":options:option:$comp_hasarg" \) \|
     )
     regex_long_prefix=("$regex_long_prefix[@]"
       /"(${(j:|:)short_hasarg})$nul"/
 	-'_apt_consume_short ${match[1][-2]}; current_option=${canonicalize[-${${match[1]%'$qnul'}[-1]}]}'
-	/"$word"/ :"$comp_hasarg" \|
+	/"$word"/ ":options:option:$comp_hasarg" \|
       /"(${(j:|:)short_hasarg})="/
 	-'_apt_consume_short ${match[1][-2]}; current_option=${canonicalize[-${${match[1]%=}[-1]}]}'
-	\( /"$word1"/ :"$comp_hasarg" \| /"$nul"/ /"$word"/ :"$comp_hasarg" \) \|
+	\( /"$word1"/ ":options:option:$comp_hasarg" \| /"$nul"/ /"$word"/ ":options:option:$comp_hasarg" \) \|
     )
   fi
 
@@ -134,15 +134,15 @@
 	-'_apt_consume_short ${match[1]%%('$qnul'('${(j:|:)bool}')|('${(j:|:)bool}')|)'$qnul'}' \|
       /"$short_seq(${(j:|:)short_bool})="/
 	-'_apt_consume_short ${match[1]%=}'
-	\( /"$word1"/ :"$comp_bool" \| /"$nul"/ /"$word"/ :"$comp_bool" \) \|
+	\( /"$word1"/ ":names:boolean value:$comp_bool" \| /"$nul"/ /"$word"/ ":names:boolean value:$comp_bool" \) \|
     )
     regex_long_prefix=("$regex_long_prefix[@]"
       /"(${(j:|:)short_bool})="/
 	-'_apt_consume_short ${match[1][-2]}'
-	\( /"$word1"/ :"$comp_bool" \| /"$nul"/ /"$word"/ :"$comp_bool" \) \|
+	\( /"$word1"/ ":names:boolean value:$comp_bool" \| /"$nul"/ /"$word"/ ":names:boolean value:$comp_bool" \) \|
       /"(${(j:|:)short_bool})$nul"/
 	-'_apt_consume_short ${match[1][-2]}'
-	/"((${(j:|:)bool})$nul|)"/ :"$comp_bool" \|
+	/"((${(j:|:)bool})$nul|)"/ ":names:boolean value:$comp_bool" \|
     )
   fi
 
@@ -152,15 +152,15 @@
 	-'_apt_consume_short ${match[1]%%'"($qnul$intlevel|$intlevel|)$qnul"'}' \|
       /"$short_seq(${(j:|:)short_intlevel})="/
 	-'_apt_consume_short ${match[1]%=}'
-	\( /"$word1"/ :"$comp_intlevel" \| /"$nul"/ /"$word"/ :"$comp_intlevel" \) \|
+	\( /"$word1"/ ":options:option:$comp_intlevel" \| /"$nul"/ /"$word"/ ":options:option:$comp_intlevel" \) \|
     )
     regex_long_prefix=("$regex_long_prefix[@]"
       /"(${(j:|:)short_intlevel})="/
 	-'_apt_consume_short ${match[1][-2]}'
-	\( /"$word1"/ :"$comp_intlevel" \| /"$nul"/ /"$word"/ :"$comp_intlevel" \) \|
+	\( /"$word1"/ ":options:option:$comp_intlevel" \| /"$nul"/ /"$word"/ ":options:option:$comp_intlevel" \) \|
       /"(${(j:|:)short_intlevel})$nul"/
 	-'_apt_consume_short ${match[1][-2]}'
-	/"($intlevel$nul|)"/ :"$comp_intlevel" \|
+	/"($intlevel$nul|)"/ ":options:option:$comp_intlevel" \|
     )
   fi
 
@@ -168,15 +168,15 @@
     regex_short=("$regex_short[@]"
       /"$short_seq(${(j:|:)short_configfile})(=|)"/
 	-'_apt_consume_short ${match[1]%=}'
-	\( /"$word1"/ :"$comp_configfile" \| /"$nul"/ /"$word"/ :"$comp_configfile" \) \|
+	\( /"$word1"/ ":files:config file:$comp_configfile" \| /"$nul"/ /"$word"/ ":files:config file:$comp_configfile" \) \|
     )
     regex_long_prefix=("$regex_long_prefix[@]"
       /"(${(j:|:)short_configfile})$nul"/
 	-'_apt_consume_short ${match[1][-2]}'
-	/"$word"/ :"$comp_configfile" \|
+	/"$word"/ ":files:config file:$comp_configfile" \|
       /"(${(j:|:)short_configfile})="/
 	-'_apt_consume_short ${match[1][-2]}'
-	\( /"$word1"/ :"$comp_configfile" \| /"$nul"/ /"$word"/ :"$comp_configfile" \) \|
+	\( /"$word1"/ ":files:config file:$comp_configfile" \| /"$nul"/ /"$word"/ ":files:config file:$comp_configfile" \) \|
     )
   fi
 
@@ -184,15 +184,15 @@
     regex_short=("$regex_short[@]"
       /"$short_seq(${(j:|:)short_arbitem})(=|)"/
 	-'_apt_consume_short ${match[1]%=}'
-	\( /"$word1"/ :"$comp_arbitem" \| /"$nul"/ /"$word"/ :"$comp_arbitem" \) \|
+	\( /"$word1"/ ":options:option:$comp_arbitem" \| /"$nul"/ /"$word"/ ":options:option:$comp_arbitem" \) \|
     )
     regex_long_prefix=("$regex_long_prefix[@]"
       /"(${(j:|:)short_arbitem})$nul"/
 	-'_apt_consume_short ${match[1][-2]}'
-	/"$word"/ :"$comp_arbitem" \|
+	/"$word"/ ":options:option:$comp_arbitem" \|
       /"(${(j:|:)short_arbitem})="/
 	-'_apt_consume_short ${match[1][-2]}'
-	\( /"$word1"/ :"$comp_arbitem" \| /"$nul"/ /"$word"/ :"$comp_arbitem" \) \|
+	\( /"$word1"/ ":options:option:$comp_arbitem" \| /"$nul"/ /"$word"/ ":options:option:$comp_arbitem" \) \|
     )
   fi
 
@@ -200,18 +200,18 @@
     regex_long=("$regex_long[@]"
       /"(${(j:|:)long_hasarg})$nul"/
 	-'_apt_consume_long ${match[1]%'$qnul'}; current_option=${canonicalize[--${match[1]%'$qnul'}]}'
-	/"$word"/ :"$comp_hasarg" \|
+	/"$word"/ ":options:option:$comp_hasarg" \|
       /"(${(j:|:)long_hasarg})="/
 	-'_apt_consume_long ${match[1]%=}; current_option=${canonicalize[--${match[1]%=}]}'
-	\( /"$word1"/ :"$comp_hasarg" \| /"$nul"/ /"$word"/ :"$comp_hasarg" \) \|
+	\( /"$word1"/ ":options:option:$comp_hasarg" \| /"$nul"/ /"$word"/ ":options:option:$comp_hasarg" \) \|
     )
     regex_long_prefix=("$regex_long_prefix[@]"
       /"(${(j:|:)long_hasarg})$nul"/
 	-'_apt_consume_long ${match[1]%'$qnul'}; current_option=${canonicalize[--${match[1]%'$qnul'}]}'
-	/"$word"/ :"$comp_hasarg" \|
+	/"$word"/ ":options:option:$comp_hasarg" \|
       /"(${(j:|:)long_hasarg})="/
 	-'_apt_consume_long ${match[1]%=}; current_option=${canonicalize[--${match[1]%=}]}'
-	\( /"$word1"/ :"$comp_hasarg" \| /"$nul"/ /"$word"/ :"$comp_hasarg" \) \|
+	\( /"$word1"/ ":options:option:$comp_hasarg" \| /"$nul"/ /"$word"/ ":options:option:$comp_hasarg" \) \|
     )
   fi
 
@@ -219,18 +219,18 @@
     regex_long=("$regex_long[@]"
       /"(${(j:|:)long_bool})="/
 	-'_apt_consume_long ${match[1]%=}'
-	\( /"$word1"/ :"$comp_bool" \| /"$nul"/ /"$word"/ :"$comp_bool" \) \|
+	\( /"$word1"/ ":names:boolean value:$comp_bool" \| /"$nul"/ /"$word"/ ":names:boolean value:$comp_bool" \) \|
       /"(${(j:|:)long_bool})$nul"/
 	-'_apt_consume_long ${match[1]%'$qnul'}'
-	/"((${(j:|:)bool})$nul|)"/ :"$comp_bool" \|
+	/"((${(j:|:)bool})$nul|)"/ ":names:boolean value:$comp_bool" \|
     )
     regex_long_prefix=("$regex_long_prefix[@]"
       /"(${(j:|:)long_bool})="/
 	-'_apt_consume_long ${match[1]%=}'
-	\( /"$word1"/ :"$comp_bool" \| /"$nul"/ /"$word"/ :"$comp_bool" \) \|
+	\( /"$word1"/ ":names:boolean value:$comp_bool" \| /"$nul"/ /"$word"/ ":names:boolean value:$comp_bool" \) \|
       /"(${(j:|:)long_bool})$nul"/
 	-'_apt_consume_long ${match[1]%'$qnul'}'
-	/"((${(j:|:)bool})$nul|)"/ :"$comp_bool" \|
+	/"((${(j:|:)bool})$nul|)"/ ":names:boolean value:$comp_bool" \|
     )
   fi
 
@@ -238,18 +238,18 @@
     regex_long=("$regex_long[@]"
       /"(${(j:|:)long_intlevel})="/
 	-'_apt_consume_long ${match[1]%=}'
-	\( /"$word1"/ :"$comp_intlevel" \| /"$nul"/ /"$word"/ :"$comp_intlevel" \) \|
+	\( /"$word1"/ ":options:option:$comp_intlevel" \| /"$nul"/ /"$word"/ ":options:option:$comp_intlevel" \) \|
       /"(${(j:|:)long_intlevel})$nul"/
 	-'_apt_consume_long ${match[1]%'$qnul'}'
-	/"($intlevel$nul|)"/ :"$comp_intlevel" \|
+	/"($intlevel$nul|)"/ ":options:option:$comp_intlevel" \|
     )
     regex_long_prefix=("$regex_long_prefix[@]"
       /"(${(j:|:)long_intlevel})="/
 	-'_apt_consume_long ${match[1]%=}'
-	\( /"$word1"/ :"$comp_intlevel" \| /"$nul"/ /"$word"/ :"$comp_intlevel" \) \|
+	\( /"$word1"/ ":options:option:$comp_intlevel" \| /"$nul"/ /"$word"/ ":options:option:$comp_intlevel" \) \|
       /"(${(j:|:)long_intlevel})$nul"/
 	-'_apt_consume_long ${match[1]%'$qnul'}'
-	/"($intlevel$nul|)"/ :"$comp_intlevel" \|
+	/"($intlevel$nul|)"/ ":options:option:$comp_intlevel" \|
     )
   fi
 
@@ -257,18 +257,18 @@
     regex_long=("$regex_long[@]"
       /"(${(j:|:)long_configfile})$nul"/
 	-'_apt_consume_long ${match[1]%'$qnul'}'
-	/"$word"/ :"$comp_configfile" \|
+	/"$word"/ ":files:config file:$comp_configfile" \|
       /"(${(j:|:)long_configfile})="/
 	-'_apt_consume_long ${match[1]%=}'
-	\( /"$word1"/ :"$comp_configfile" \| /"$nul"/ /"$word"/ :"$comp_configfile" \) \|
+	\( /"$word1"/ ":files:config file:$comp_configfile" \| /"$nul"/ /"$word"/ ":files:config file:$comp_configfile" \) \|
     )
     regex_long_prefix=("$regex_long_prefix[@]"
       /"(${(j:|:)long_configfile})$nul"/
 	-'_apt_consume_long ${match[1]%'$qnul'}'
-	/"$word"/ :"$comp_configfile" \|
+	/"$word"/ ":files:config file:$comp_configfile" \|
       /"(${(j:|:)long_configfile})="/
 	-'_apt_consume_long ${match[1]%=}'
-	\( /"$word1"/ :"$comp_configfile" \| /"$nul"/ /"$word"/ :"$comp_configfile" \) \|
+	\( /"$word1"/ ":files:config file:$comp_configfile" \| /"$nul"/ /"$word"/ ":files:config file:$comp_configfile" \) \|
     )
   fi
 
@@ -276,18 +276,18 @@
     regex_long=("$regex_long[@]"
       /"(${(j:|:)long_arbitem})$nul"/
 	-'_apt_consume_long ${match[1]%'$qnul'}'
-	/"$word"/ :"$comp_arbitem" \|
+	/"$word"/ ":options:option:$comp_arbitem" \|
       /"(${(j:|:)long_arbitem})="/
 	-'_apt_consume_long ${match[1]%=}'
-	\( /"$word1"/ :"$comp_arbitem" \| /"$nul"/ /"$word"/ :"$comp_arbitem" \) \|
+	\( /"$word1"/ ":options:option:$comp_arbitem" \| /"$nul"/ /"$word"/ ":options:option:$comp_arbitem" \) \|
     )
     regex_long_prefix=("$regex_long_prefix[@]"
       /"(${(j:|:)long_arbitem})$nul"/
 	-'_apt_consume_long ${match[1]%'$qnul'}'
-	/"$word"/ :"$comp_arbitem" \|
+	/"$word"/ ":options:option:$comp_arbitem" \|
       /"(${(j:|:)long_arbitem})="/
 	-'_apt_consume_long ${match[1]%=}'
-	\( /"$word1"/ :"$comp_arbitem" \| /"$nul"/ /"$word"/ :"$comp_arbitem" \) \|
+	\( /"$word1"/ ":options:option:$comp_arbitem" \| /"$nul"/ /"$word"/ ":options:option:$comp_arbitem" \) \|
     )
   fi
 
@@ -296,9 +296,9 @@
     \( /--/+ \( "$regex_long[@]"
 		/"(${(j:|:)bool})-"/+
 		  \( "$regex_long_prefix[@]"
-		     /"[]"/ :"$comp_long_prefix" \) \) \|
+		     /"[]"/ ":options:option:$comp_long_prefix" \) \) \|
        /-/+ \( "$regex_short[@]" /"[]"/ \) \|
-       /"[]"/ :"$comp_opt" \) \#
+       /"[]"/ ":options:option:$comp_opt" \) \#
     "$regex_all[@]"
   )
 
@@ -324,11 +324,6 @@
     long_arbitem=($long_arbitem)
     bool_prefix=($bool_prefix)
 
-    local expl_opt expl_bool expl_configfile
-    _description options expl_opt option
-    _description values expl_bool 'boolean value'
-    _description files expl_configfile 'config file'
-
     local current_option tmp1 tmp2 tmp3
 
     ${funcname}_sm
@@ -375,16 +370,16 @@
     -- \
     /$'update\0'/ \| \
     /$'upgrade\0'/ \| \
-    /$'install\0'/ /$'[^\0]#\0'/ :'_deb_packages "$expl_packages[@]" uninstalled || _deb_packages "$expl_packages[@]" installed' \# \| \
-    /$'remove\0'/ /$'[^\0]#\0'/ :'_deb_packages "$expl_packages[@]" installed' \# \| \
+    /$'install\0'/ /$'[^\0]#\0'/ ':packages::_deb_packages "$expl_packages[@]" uninstalled || _deb_packages "$expl_packages[@]" installed' \# \| \
+    /$'remove\0'/ /$'[^\0]#\0'/ ':packages::_deb_packages "$expl_packages[@]" installed' \# \| \
     /$'dist-upgrade\0'/ \| \
     /$'dselect-upgrade\0'/ \| \
     /$'clean\0'/ \| \
     /$'autoclean\0'/ \| \
     /$'check\0'/ \| \
-    /$'source\0'/ /$'[^\0]#\0'/ :'_deb_packages "$expl_packages[@]" avail' \# \| \
+    /$'source\0'/ /$'[^\0]#\0'/ ':packages::_deb_packages "$expl_packages[@]" avail' \# \| \
     /$'help\0/' \| \
-    /"[]"/	:'_wanted actions expl_action action compadd update upgrade install remove dist-upgrade dselect-upgrade clean autoclean check source help'
+    /"[]"/	':argument-1::compadd "$expl_action[@]" update upgrade install remove dist-upgrade dselect-upgrade clean autoclean check source help'
 
   _apt-get () {
     local expl_action expl_packages
@@ -411,18 +406,18 @@
     -o,--option:arbitem \
     -- \
     /$'help\0'/ \| \
-    /$'add\0'/ /$'[^\0]#\0'/ :'_files' \# \| \
+    /$'add\0'/ /$'[^\0]#\0'/ ':files:index files:_files "$expl[@]"' \# \| \
     /$'gencaches\0'/ \| \
-    /$'showpkg\0'/ /$'[^\0]#\0'/ :'_deb_packages "$expl_packages[@]" avail' \# \| \
+    /$'showpkg\0'/ /$'[^\0]#\0'/ ':packages::_deb_packages "$expl_packages[@]" avail' \# \| \
     /$'stats\0'=$status[4]/ \| \
     /$'dump\0'/ \| \
     /$'dumpavail\0'/ \| \
     /$'unmet\0'/ \| \
     /$'check\0'/ \| \
-    /$'search\0'/ /$'[^\0]#\0'/ :'_message "pattern"' \| \
-    /$'show\0'/ /$'[^\0]#\0'/ :'_deb_packages "$expl_packages[@]" avail' \# \| \
+    /$'search\0'/ /$'[^\0]#\0'/ ':strings::_message "pattern"' \| \
+    /$'show\0'/ /$'[^\0]#\0'/ ':packages::_deb_packages "$expl_packages[@]" avail' \# \| \
     /$'depends\0'/ \| \
-    /"[]"/ :'_wanted actions expl_action action compadd help add gencaches showpkg stats dump dumpavail unmet check search show depends'
+    /"[]"/ ':argument-1::compadd "$expl_action[@]" help add gencaches showpkg stats dump dumpavail unmet check search show depends'
 
   _apt-cache () {
     local expl_action expl_packages expl_pkg_cache expl_src_cache
@@ -451,7 +446,7 @@
     -o,--option:arbitem \
     -- \
     /$'add\0'/ \| \
-    /"[]"/	:'_wanted actions expl_action action compadd add'
+    /"[]"/	':argument-1::compadd "$expl_action[@]" add'
 
   _apt-cdrom () {
     local expl_action expl_mount_point
@@ -465,7 +460,7 @@
 }
 
 _apt-config () {
-  _apt_arguments _apt-config_sm \
+  _apt_arguments _apt-config \
     -h,--help:bool \
     -v,--version:bool \
     -c,--config-file:configfile \
@@ -473,20 +468,11 @@
     -- \
     /$'shell\0'/ \
       \( \
-	/$'[^\0]#\0'/ :'_wanted parameters expl_shell_var "shell variable to assign" compadd - "${(@k)parameters}"' \
-	/$'[^\0]#\0'/ :'_wanted configuration-keys expl_config_key "configuration key" compadd - ${${(f)"$(apt-config dump 2>&1)"}% *}' \
+	/$'[^\0]#\0'/ ':parameters:shell variable to assign:compadd "$expl[@]" - "${(@k)parameters}"' \
+	/$'[^\0]#\0'/ ':values:configuration key:compadd "$expl[@]" - ${${(f)"$(apt-config dump 2>&1)"}% *}' \
       \) \# \| \
     /$'dump\0'/ \| \
-    /"[]"/	:'_wanted actions expl_action action compadd shell dump'
-
-  _apt-config () {
-    local expl_action expl_shell_var expl_config_key
-    _description actions expl_action 'action'
-    _description parameters expl_shell_var 'shell variable to assign'
-    _description configuration-keys expl_config_key 'configuration key'
-
-    _apt-config_sm
-  }
+    /"[]"/	':argument-1:action:compadd "$expl[@]" shell dump'
 
   _apt-config "$@"
 }
Index: Completion/X/_xset
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/X/_xset,v
retrieving revision 1.1
diff -u -r1.1 _xset
--- Completion/X/_xset	2000/04/26 08:31:20	1.1
+++ Completion/X/_xset	2000/05/04 20:03:10
@@ -32,11 +32,11 @@
 }
 
 _xset_compfpadd () {
-  _wanted directories expl directory _files -/
+  _files "$expl[@]" -/
 }
 
 _xset_compfpdel () {
-  _wanted directories expl directory compadd - ${(s:,:)${"$(xset q)"##*
+  compadd "$expl[@]" - ${(s:,:)${"$(xset q)"##*
 Font Path:
  #}%%
 *}
@@ -44,69 +44,70 @@
 
 _regex_arguments _xset_parse \
   "/$word/" \
-  \( "/-d(isplay|)$nul/" "$guard" "/$word/" ":_x_display" \
+  \( "/-d(isplay|)$nul/" "$guard" "/$word/" ':option-display:display:_x_display "$expl[@]"' \
   \| "/-c$nul/" "$guard" \
   \| "/c$nul/" "$guard" \
-    \( "/(on|off)$nul/" ':_wanted values expl click compadd on off' \
-    \| "/[0-9]##$nul/" ':_message volume' \
+    \( "/(on|off)$nul/" ':option-c-bool:click:compadd "$expl[@]" on off' \
+    \| "/[0-9]##$nul/" ':option-c-volume:volume:_message volume' \
     \| \) \
   \| "/-b$nul/" "$guard" \
   \| "/b$nul/" "$guard" \
-    \( "/(on|off)$nul/" ':_wanted values expl bell compadd on off' \
-    \| "/[0-9]##$nul/" ':_message volume' \
-      \( "/[0-9]##$nul/" ':_message pitch' \
-	\( "/[0-9]##$nul/" ':_message duration' \
+    \( "/(on|off)$nul/" ':option-b-bool:bell:compadd "$expl[@]" on off' \
+    \| "/[0-9]##$nul/" ':option-b-volume:bell volume:_message volume' \
+      \( "/[0-9]##$nul/" ':option-b-pitch:bell pitch:_message pitch' \
+	\( "/[0-9]##$nul/" ':option-b-duration:bell duration:_message duration' \
 	\| \) \
       \| \) \
     \| \) \
   \| "/bc$nul/" "$guard" \
   \| "/-bc$nul/" "$guard" \
-  \| "/fp$nul/" "$guard" "/$word/" ':_wanted values expl "font path" compadd default rehash' \
-  \| "/(fp[+=]|[+]fp)$nul/" "$guard" "/$word/" ':compset -P "*,"; _xset_compfpadd' \
-  \| "/(fp-|-fp)$nul/" "$guard" "/$word/" ':compset -P "*,"; _xset_compfpdel' \
+  \| "/fp$nul/" "$guard" "/$word/" ':option-fp:font path:compadd "$expl[@]" default rehash' \
+  \| "/(fp[+=]|[+]fp)$nul/" "$guard" "/$word/" ':option-fp-add:font path:compset -P "*,"; _xset_compfpadd' \
+  \| "/(fp-|-fp)$nul/" "$guard" "/$word/" ':option-fp-del:font path:compset -P "*,"; _xset_compfpdel' \
   \| "/-led$nul/" "$guard" \
-    \( "/[0-9]##$nul/" ':_message integer' \
+    \( "/[0-9]##$nul/" ':option-led-number:led number:_message "led number"' \
     \| \) \
   \| "/led$nul/" "$guard" \
-    \( "/(on|off)$nul/" ':_wanted values expl led compadd on off' \
-    \| "/[0-9]##$nul/" ':_message integer' \
+    \( "/(on|off)$nul/" ':option-led-bool:led:compadd "$expl[@]" on off' \
+    \| "/[0-9]##$nul/" ':option-led-number:led number:_message "led number"' \
     \| \) \
   \| "/m(ouse|)$nul/" "$guard" \
-    \( "/default$nul/" ':_wanted values expl "mouse parameter" compadd default' \
-    \| "/[0-9]##(/[0-9]##|)$nul/" ':_message accel_mult/accel_div' \
-      \( "/[0-9]##$nul/" ':_message threshold' \
+    \( "/default$nul/" ':option-mouse-default:mouse parameter:compadd "$expl[@]" default' \
+    \| "/[0-9]##(/[0-9]##|)$nul/" ':option-mouse-mult-div:accel_mult/accel_div:_message accel_mult/accel_div' \
+      \( "/[0-9]##$nul/" ':option-mouse-threshold:threshold:_message threshold' \
       \| \) \
     \| \) \
   \| "/[-+]dpms$nul/" "$guard" \
   \| "/dpms$nul/" "$guard" \
-    \( "/[0-9]##$nul/" ':_message "standby timeout"' \
-      \( "/[0-9]##$nul/" ':_message "suspend timeout"' \
-	\( "/[0-9]##$nul/" ':_message "off timeout"' \
+    \( "/[0-9]##$nul/" ':option-dpms-standby:standby timeout:_message "standby timeout"' \
+      \( "/[0-9]##$nul/" ':option-dpms-suspend:suspend timeout:_message "suspend timeout"' \
+	\( "/[0-9]##$nul/" ':option-dpms-off:off timeout:_message "off timeout"' \
 	\| \) \
       \| \) \
-    \| "/(on|standby|suspend|off)$nul/" ':_wanted values expl DPMS compadd on standby suspend off' \
+    \| "/force/" ':option-dpms-force:force DPMS state:compadd "$expl[@]" force' \
+       "/(on|standby|suspend|off)$nul/" ':option-dpms-state:DPMS state:compadd "$expl[@]" on standby suspend off' \
     \) \
   \| "/s$nul/" "$guard" \
     \( "/(blank|noblank|expose|noexpose|default|on|activate|reset)$nul/" \
-       ':_wanted values expl "screen saver" compadd blank noblank expose noexpose default on activate reset off' \
-    \| "/off$nul/" \( "/off$nul/" ':compadd off' \| \) \
-    \| "/[0-9]##$nul/" ':_message length' \
-      \( "/[0-9]##$nul/" ':_message period' \
+       ':option-s:screen saver:compadd "$expl[@]" blank noblank expose noexpose default on activate reset off' \
+    \| "/off$nul/" \( "/off$nul/" ':option-s-off-period:period off:compadd "$expl[@]" off' \| \) \
+    \| "/[0-9]##$nul/" ':option-s-timeout:length:_message length' \
+      \( "/[0-9]##$nul/" ':option-s-period:period:_message period' \
       \| \) \
     \| \) \
   \| "/-r$nul/" "$guard" \
-    \( "/[0-9]##$nul/" ':_message keycode' \
+    \( "/[0-9]##$nul/" ':option-r-keycode:keycode:_message keycode' \
     \| \) \
   \| "/r$nul/" "$guard" \
-    \( "/(on|off)$nul/" ':_wanted values expl autorepeat compadd on off' \
-    \| "/[0-9]##$nul/" ':_message keycode' \
+    \( "/(on|off)$nul/" ':option-r-autorepeat:autorepeat:compadd "$expl[@]" on off' \
+    \| "/[0-9]##$nul/" ':option-r-keycode:keycode:_message keycode' \
     \| \) \
   \| "/p$nul/" "$guard" \
-    "/[0-9]##$nul/" ':_message pixel' \
-    "/$word/" ':_x_color' \
+    "/[0-9]##$nul/" ':option-p-pixel:pixel:_message pixel' \
+    "/$word/" ':option-p-color:color:_x_color "$expl[@]"' \
   \| "/(-|)k$nul/" "$guard" \
   \| "/(-|)q$nul/" "$guard" \
-  \| "/[]/" ':_xset_compopts' \
+  \| "/[]/" ':options:options:_xset_compopts' \
   \) \#
 
 _xset () {
Index: Completion/X/_xwit
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/X/_xwit,v
retrieving revision 1.3
diff -u -r1.3 _xwit
--- Completion/X/_xwit	2000/04/11 07:57:57	1.3
+++ Completion/X/_xwit	2000/05/04 20:03:11
@@ -15,34 +15,53 @@
 }
 
 _xwit_compopts () {
-  local expl
-  _wanted options expl option compadd - ${(k)no[(R)*~0]} ||
-      _wanted options expl option compadd - ${(k)no}
+  compadd "$expl[@]" - ${(k)no[(R)*~0]} ||
+    compadd "$expl[@]" - ${(k)no}
 }
 
 _regex_arguments _xwit_parse \
   "/$word/" \
   \( \
     "/-/+" \
-    \( "/display$nul/" "$guard" "/$word/" ":_x_display" \
+    \( "/display$nul/" "$guard" "/$word/" ':option-display:display:_x_display' \
     \| "/(sync|pop|open|iconify|unmap|root|current|select|(no|)(save|backingstore|saveunder))$nul/" "$guard" \
-    \| "/resize$nul/" "$guard" "/$word/" ":_message width" "/$word/" ":_message height" \
-    \| "/rows$nul/" "$guard" "/$word/" ":_message rows" \
-    \| "/columns$nul/" "$guard" "/$word/" ":_message columns" \
-    \| "/(r|)move$nul/" "$guard" "/$word/" ":_message x" "/$word/" ":_message y" \
-    \| "/(r|)warp$nul/" "$guard" "/$word/" ":_message x" "/$word/" ":_message y" \
-    \| "/colormap$nul/" "$guard" "/$word/" ":_x_colormapid" \
-    \| "/(name|label)$nul/" "$guard" "/$word/" ":_x_name" \
-    \| "/iconname$nul/" "$guard" "/$word/" ":_x_name" \
-    \| "/bitmap$nul/" "$guard" "/$word/" ":_files -g \\*.xbm" \
-    \| "/mask$nul/" "$guard" "/$word/" ":_files -g \\*.xbm" \
-    \| "/iconmove$nul/" "$guard" "/$word/" ":_message x" "/$word/" ":_message y" \
-    \| "/id$nul/" "$guard" "/$word/" ":_x_window" \
+    \| "/resize$nul/" "$guard" \
+       "/$word/" ':option-resize-width:width:_message width' \
+       "/$word/" ':option-resize-height:height:_message height' \
+    \| "/rows$nul/" "$guard" "/$word/" ':option-rows:rows:_message rows' \
+    \| "/columns$nul/" "$guard" "/$word/" ':option-columns:columns:_message columns' \
+    \| "/move$nul/" "$guard" \
+       "/$word/" ':option-move-x:x:_message x' \
+       "/$word/" ':option-move-y:y:_message y' \
+    \| "/rmove$nul/" "$guard" \
+       "/$word/" ':option-rmove-x:x:_message x' \
+       "/$word/" ':option-rmove-y:y:_message y' \
+    \| "/warp$nul/" "$guard" \
+       "/$word/" ':option-warp-x:x:_message x' \
+       "/$word/" ':option-warp-y:y:_message y' \
+    \| "/rwarp$nul/" "$guard" \
+       "/$word/" ':option-rwarp-x:x:_message x' \
+       "/$word/" ':option-rwarp-y:y:_message y' \
+    \| "/colormap$nul/" "$guard" \
+       "/$word/" ':option-colormap:colormapid:_x_colormapid' \
+    \| "/(name|label)$nul/" "$guard" \
+       "/$word/" ':option-name:name:_x_name "$expl[@]"' \
+    \| "/iconname$nul/" "$guard" \
+       "/$word/" ':option-name:iconname:_x_name "$expl[@]"' \
+    \| "/bitmap$nul/" "$guard" \
+       "/$word/" ':option-bitmap:bitmap file:_files "$expl[@]" -g \*.xbm' \
+    \| "/mask$nul/" "$guard" \
+       "/$word/" ':option-mask:mask file:_files "$expl[@]" -g \*.xbm' \
+    \| "/iconmove$nul/" "$guard" \
+       "/$word/" ':option-iconmove-x:x:_message x' \
+       "/$word/" ':option-iconmove-y:y:_message y' \
+    \| "/id$nul/" "$guard" "/$word/" ':option-id:window id:_x_window' \
     \| "/(no|)keyrepeat$nul/" "$guard" \
-        \( "/[0-9]##$nul/" ":[[ -prefix [0-9]# ]] && _message keycode" \
-	  \( "/-$nul/" "/[0-9]##$nul/" ":[[ -prefix [0-9]# ]] && _message 'last keycode'" \| \) \) \# \
-    \| "/names$nul/" "$guard" "/$word/" ":_x_window -n" \# \
-    \| "/[]/" ':_xwit_compopts' \
+        \( "/[0-9]##$nul/" ':option-keyrepeat-keycode:keycode:[[ -prefix [0-9]# ]] && _message keycode' \
+	  \( "/-$nul/" "/[0-9]##$nul/" ':option-keyrepeat-last-keycode:last keycode:[[ -prefix [0-9]# ]] && _message "last keycode"' \| \) \) \# \
+    \| "/names$nul/" "$guard" \
+       "/$word/" ':option-names:window name:_x_window -n' \# \
+    \| "/[]/" ':options:option:_xwit_compopts' \
     \) \
   \) \#
 
Index: Doc/Zsh/compsys.yo
===================================================================
RCS file: /cvsroot/zsh/zsh/Doc/Zsh/compsys.yo,v
retrieving revision 1.33
diff -u -r1.33 compsys.yo
--- Doc/Zsh/compsys.yo	2000/05/04 07:44:21	1.33
+++ Doc/Zsh/compsys.yo	2000/05/04 20:03:11
@@ -3276,7 +3276,7 @@
 should be quoted.
 
 startitem()
-item(tt(/)var(pattern)tt(/) [tt(%)var(lookahead)tt(%)] [tt(-)var(guard)] [tt(:)var(action)])(
+item(tt(/)var(pattern)tt(/) [tt(%)var(lookahead)tt(%)] [tt(-)var(guard)] [tt(:)var(tag)tt(:)var(descr)tt(:)var(action)])(
 This is a primitive element, corresponding to one
 state of the compiled state machine.  The state is entered if
 `tt((#b)LPAR()(#B))var(pattern)tt(RPAR()(#B))var(lookahead)tt(*)' matches
@@ -3295,12 +3295,15 @@
 command line string and var(action)s for the target are evaluated.
 In this case, nothing is actually removed from the command line string
 so that any previous or neighbouring state may also have var(actions)s.
+var(actions)s evaluation are ordered by the tt(tag-order) style and
+specified var(tag).  var(descr) is used for set up the array parameter
+tt(expl).
 )
-item(tt(/)var(pattern)tt(/+) [tt(%)var(lookahead)tt(%)] [tt(-)var(guard)] [tt(:)var(action)])(
+item(tt(/)var(pattern)tt(/+) [tt(%)var(lookahead)tt(%)] [tt(-)var(guard)] [tt(:)var(tag)tt(:)var(descr)tt(:)var(action)])(
 This is similar to `tt(/)var(pattern)tt(/) ...' but the left part of
 command line string is also considered as part of the completion target.
 )
-item(tt(/)var(pattern)tt(/-) [tt(%)var(lookahead)tt(%)] [tt(-)var(guard)] [tt(:)var(action)])(
+item(tt(/)var(pattern)tt(/-) [tt(%)var(lookahead)tt(%)] [tt(-)var(guard)] [tt(:)var(tag)tt(:)var(descr)tt(:)var(action)])(
 This is similar to `tt(/)var(pattern)tt(/) ...' but the var(action)s of the
 current and previous states are ignored even if the following state's
 `var(pattern)' matches the empty string.
Index: Src/Modules/zutil.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Modules/zutil.c,v
retrieving revision 1.1.1.19
diff -u -r1.1.1.19 zutil.c
--- Src/Modules/zutil.c	2000/03/23 04:19:46	1.1.1.19
+++ Src/Modules/zutil.c	2000/05/04 20:03:12
@@ -1008,14 +1008,13 @@
     setiparam(var1, point1);
     setiparam(var2, point2);
 
-    if (!*subj) {
-	if (sm->nullacts)
-	    for (ln = firstnode(sm->nullacts); ln; ln = nextnode(ln)) {
-	        char *action = getdata(ln);
+    if (!comp && !*subj && sm->nullacts) {
+	for (ln = firstnode(sm->nullacts); ln; ln = nextnode(ln)) {
+	    char *action = getdata(ln);
 
-		if (action)
-		    execstring(action, 1, 0);
-	    }
+	    if (action)
+		execstring(action, 1, 0);
+	}
 	return 0;
     }
 
@@ -1036,7 +1035,7 @@
 	    if (next->pattern && !next->patprog) {
 	        tokenize(next->pattern);
 		if (!(next->patprog = patcompile(next->pattern, 0, NULL)))
-		    return 2;
+		    return 3;
 	    }
 	    if (next->pattern && pattry(next->patprog, subj) &&
 		(!next->guard || (execstring(next->guard, 1, 0), !lastval))) {
@@ -1102,7 +1101,7 @@
 }
 
 /*
-  usage: zregexparse string regex...
+  usage: zregexparse [-c] var1 var2 string regex...
   status:
     0: matched
     1: unmatched (all next state candidates are failed)
-- 
Tanaka Akira


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: PATCH: Re: sudo completion problem
  2000-05-04 20:12           ` PATCH: Re: sudo completion problem Tanaka Akira
@ 2000-05-04 20:40             ` Tanaka Akira
  0 siblings, 0 replies; 14+ messages in thread
From: Tanaka Akira @ 2000-05-04 20:40 UTC (permalink / raw)
  To: zsh-workers

In article <hvobt2moz0v.fsf@serein.m17n.org>,
  Tanaka Akira <akr@m17n.org> writes:

> +	: "$_ra_actions[@]"

Oops.  Debugging code is remained.

Index: Completion/Base/_regex_arguments
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Base/_regex_arguments,v
retrieving revision 1.2
diff -u -r1.2 _regex_arguments
--- Completion/Base/_regex_arguments	2000/05/04 20:16:09	1.2
+++ Completion/Base/_regex_arguments	2000/05/04 20:38:50
@@ -22,7 +22,7 @@
 # pattern = "/" ( glob | "[]" ) "/" [ "+" | "-" ]
 # lookahead = "%" glob "%"
 # guard = "-" zsh-code-to-eval
-# caction = ":" zsh-code-to-eval
+# caction = ":" tag ":" descr ":" zsh-code-to-eval
 # action = "{" zsh-code-to-eval "}"
 
 ## regex word sequence definition:
@@ -81,7 +81,6 @@
 	_ra_left="$_ra_line[_ra_p1 + 1, _ra_p2]"
 	_ra_right="$_ra_line[_ra_p2 + 1, -1]"
 	compset -p $(( $#PREFIX - $#_ra_line + $_ra_p1 ))
-	: "$_ra_actions[@]"
 	tmp=("${(@)_ra_actions%%:*}")
 	if (( $#tmp )); then
 	  _tags "$tmp[@]"
-- 
Tanaka Akira


^ permalink raw reply	[flat|nested] 14+ messages in thread

* RE: PATCH: Re: sudo completion problem
  2000-05-03 14:42 PATCH: Re: sudo completion problem Sven Wischnowsky
  2000-05-03 14:56 ` Andrej Borsenkow
@ 2000-05-06  6:56 ` Andrej Borsenkow
  2000-05-06  7:40   ` Tanaka Akira
  2000-05-06  8:19   ` Zefram
  1 sibling, 2 replies; 14+ messages in thread
From: Andrej Borsenkow @ 2000-05-06  6:56 UTC (permalink / raw)
  To: Sven Wischnowsky, zsh-workers

>
> Hm. From the logic of the specifications used by _sudo, this
> completion is correct, after all, there may be options between
> arguments unless otherwise specified.
>
> So this adds the special string `-' for exclusion lists which makes
> the description for the options not be used any more. And it makes
> this be used in the places where we have such _command_names/_normal
> combinations.
>


No, that is wrong approach. As Zefram pointed out, the logic is: first
argument terminates options. Anything after first argument must NOT be
trated as option. Cf.:

bor@itsrm2% diff  .zshrc --r
diff: Cannot access --r: No such file or directory

This applies to *all* arguments cases, not just a case with _normal.
Currently we get:

bor@itsrm2% gdiff --brief .zshrc -r<TAB>
bor@itsrm2% gdiff --brief .zshrc -r
Completing option
-B                        -- ignore lines that are all blank
-H                        -- assume large files and many small changes
-I                        -- ignore lines that match regex
.....

but in this case the ``--r'' is *argument* (== file) and not an option
any more:

bor@itsrm2% gdiff --brief .zshrc -r
gdiff: missing operand
gdiff: Try `gdiff --help' for more information.

The weird is, that *long* options (at least in this case) are
interpreted everywhere:

bor@itsrm2% gdiff --brief .zshrc --r
gdiff: option `--r' is ambiguous
gdiff: Try `gdiff --help' for more information.

In other words, what we need, is:

- short options must be treated consistent with Unix. First non-option
argument terminates short options. Because it is normal, default
behaviour - I suggest reverting change for find (to avoid modifying
*every* completion function) and

- for rare cases, when arguments and options (or what looks like
options - in case of find) can be intermixed - some way to express it is
needed. Option for _arguments may be?

- can somebody comment on long options case - is it expected behaviour?
Note, that I mean in this case "GNU long options". In this case, again,
_arguments should differentiate bewteen long and short case, again with
option. There are enough commands out there that use "long" options but
not GNU ones.

-andrej


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: PATCH: Re: sudo completion problem
  2000-05-06  6:56 ` Andrej Borsenkow
@ 2000-05-06  7:40   ` Tanaka Akira
  2000-05-06  7:51     ` Andrej Borsenkow
  2000-05-06  8:19   ` Zefram
  1 sibling, 1 reply; 14+ messages in thread
From: Tanaka Akira @ 2000-05-06  7:40 UTC (permalink / raw)
  To: zsh-workers

In article <000501bfb728$30dd2f40$21c9ca95@mow.siemens.ru>,
  "Andrej Borsenkow" <Andrej.Borsenkow@mow.siemens.ru> writes:

> - can somebody comment on long options case - is it expected behaviour?
> Note, that I mean in this case "GNU long options". In this case, again,
> _arguments should differentiate bewteen long and short case, again with
> option. There are enough commands out there that use "long" options but
> not GNU ones.

It's not differences between long and short.  It's caused by the
difference between traditional getopt and GNU getopt.

By default, GNU getopt permutes argv and finds options on anywhere
(until `--').

If we can easily find out whether a command is linked with GNU getopt
or not, we can (and should) complete correctly.

But I think the current behavior is not bad because it completes all
correct (and some non-correct) candidates.  If _arguments behavior is
changed as you said, it completes only subset of correct candidates.
-- 
Tanaka Akira


^ permalink raw reply	[flat|nested] 14+ messages in thread

* RE: PATCH: Re: sudo completion problem
  2000-05-06  7:40   ` Tanaka Akira
@ 2000-05-06  7:51     ` Andrej Borsenkow
  0 siblings, 0 replies; 14+ messages in thread
From: Andrej Borsenkow @ 2000-05-06  7:51 UTC (permalink / raw)
  To: Tanaka Akira, zsh-workers

>
> > - can somebody comment on long options case - is it
> expected behaviour?
> > Note, that I mean in this case "GNU long options". In this
> case, again,
> > _arguments should differentiate bewteen long and short
> case, again with
> > option. There are enough commands out there that use "long"
> options but
> > not GNU ones.
>
> It's not differences between long and short.  It's caused by the
> difference between traditional getopt and GNU getopt.
>

Yes, that is what I meant.

> By default, GNU getopt permutes argv and finds options on anywhere
> (until `--').
>
> If we can easily find out whether a command is linked with GNU getopt
> or not, we can (and should) complete correctly.
>

Well, hence I wrote "option for _arguments" for those commands, that use
GNU getopt.

> But I think the current behavior is not bad because it completes all
> correct (and some non-correct) candidates.  If _arguments behavior is
> changed as you said, it completes only subset of correct candidates.
>

No, it does not complete "corect" canditates. It completes totally wrong
set - options instead of arguments (files in case of diff). And this
change was introduced a couple of weeks ago ... and nobody has ever
complained before.

I think, old behaviour is "the least evil" case because it applies in
most cases. Apart from GNU getopt, there are commands that may intemix
options and arguments (with semantic - "this option applies to following
arguments" - do not have example ready) - but these are really special
cases and should be treated as such.

-andrej


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: PATCH: Re: sudo completion problem
  2000-05-06  6:56 ` Andrej Borsenkow
  2000-05-06  7:40   ` Tanaka Akira
@ 2000-05-06  8:19   ` Zefram
  1 sibling, 0 replies; 14+ messages in thread
From: Zefram @ 2000-05-06  8:19 UTC (permalink / raw)
  To: Andrej Borsenkow; +Cc: Sven Wischnowsky, zsh-workers

Andrej Borsenkow wrote:
>The weird is, that *long* options (at least in this case) are
>interpreted everywhere:

Actually it's all options, it's the evil GNU getopt's default behaviour
(it can be turned off by putting a "+" at the start of the option string).

$ ls --version
ls (GNU fileutils) 4.0l
Written by Richard Stallman and David MacKenzie.

Copyright (C) 1999 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
$ ls . -l
total 5
drwx------   17 zefram   fysh         1024 Mar 30 15:13 etc
drwxr-xr-x    5 zefram   fysh         1024 Mar  8 14:07 pub
drwxr-xr-x    6 zefram   fysh         1024 Apr  3 18:58 public_html
drwx------    3 zefram   fysh         1024 May  6 09:10 tmp
drwx------   11 zefram   fysh         1024 Mar  8 14:10 usr

If we can determine that a particular command is processing options in
this way, it would be nice to complet options accordingly.  However,
by default options should only be completed before the first non-option
argument.  In either case, options should never be completed after a "--".

I envision _arguments first of all deciding whether the command allows
options everywhere or not.  This should be under the control of the
caller, via options to _arguments; possible values are "everywhere",
"only before first argument", "autodetect GNU getopt" (if possible).
_arguments must also check for a "--" argument, and not do option
completion (regardless of option style) if the cursor is after the "--".
All of this then lets it decide whether to complete options or not;
non-option arguments are always a possibility, though we might want to
be clever about handling arguments that start with "-".

-zefram


^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2000-05-06  8:20 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-05-03 14:42 PATCH: Re: sudo completion problem Sven Wischnowsky
2000-05-03 14:56 ` Andrej Borsenkow
2000-05-03 15:09   ` Zefram
2000-05-04  7:23     ` Andrej Borsenkow
2000-05-04 12:02       ` Tanaka Akira
2000-05-04 13:40         ` Sven Wischnowsky
2000-05-04 15:14           ` Completing for "find" and _regex_arguments (Re: PATCH: Re: sudo completion problem) Bart Schaefer
2000-05-04 16:16             ` Tanaka Akira
2000-05-04 20:12           ` PATCH: Re: sudo completion problem Tanaka Akira
2000-05-04 20:40             ` Tanaka Akira
2000-05-06  6:56 ` Andrej Borsenkow
2000-05-06  7:40   ` Tanaka Akira
2000-05-06  7:51     ` Andrej Borsenkow
2000-05-06  8:19   ` Zefram

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).