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

PATCH: fix _compdef



Completion after compdef -a was broken. The quick fix below was to use
things like '!-a' though I'd have thought that the whole if statement
and args1/args2 could be done with exclusion lists.

This also allows multiple -p/-P/-N as they are valid and corrects a few
typos in the compdef documentation.

Oliver

Index: Completion/Zsh/Command/_compdef
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Zsh/Command/_compdef,v
retrieving revision 1.3
diff -u -r1.3 _compdef
--- Completion/Zsh/Command/_compdef	13 Mar 2002 09:28:05 -0000	1.3
+++ Completion/Zsh/Command/_compdef	27 Mar 2002 15:59:02 -0000
@@ -13,7 +13,7 @@
   )
   args2=(
      - d
-      '(-a -n)-d[delete]:*:completed command:->ccom'
+      '-d[delete]:*:completed command:->ccom'
      - k
       '-k[define widget and key binding]:completion function:->cfun:style:->style:*:key'
      - K
@@ -21,14 +21,15 @@
   )
 else
   args1=(
-    '-N[completion for named command]'
+    '!-a' '!-n'
+    '*-N[completion for named command]'
   )
 fi
 
 _arguments -C -s -S \
   "$args1[@]" \
-  '-p[completion for command matching pattern]' \
-  '-P[completion for command matching pattern]' \
+  '*-p[completion for command matching pattern]' \
+  '*-P[completion for command matching pattern]' \
   ':completion function:->cfun' \
   '*:commands:->com' \
   "$args2[@]" && return 0
Index: Doc/Zsh/compsys.yo
===================================================================
RCS file: /cvsroot/zsh/zsh/Doc/Zsh/compsys.yo,v
retrieving revision 1.151
diff -u -r1.151 compsys.yo
--- Doc/Zsh/compsys.yo	27 Mar 2002 14:36:18 -0000	1.151
+++ Doc/Zsh/compsys.yo	27 Mar 2002 15:59:03 -0000
@@ -272,7 +272,7 @@
 `var(cmd)tt(=)var(service)'.  This kind of use makes the arguments of
 the var(cmd)s be completed as those for the var(services).
 
-In the first case and the following cases the var(function) may actually
+The var(function) may actually
 be a string containing any shell code and that string will be executed
 via the tt(eval) builtin command.  This allows to easily define completions
 for commands that need to call one of the completion functions with
@@ -286,11 +286,11 @@
 contexts or commands will not be altered.  These definitions can be deleted
 by giving the tt(-d) option as in the second form.
 
-In both of the first two cases forms and as for the tt(#compdef) tag
+In both of the first two forms and as for the tt(#compdef) tag
 described above, the var(names) may also contain tt(-p), tt(-P) and
 tt(-N) options.  The first two make the following arguments be used as
 patterns and the var(function) will be called for all commands and
-contexts matching one of the patterns.  Wtih tt(-P) this will only
+contexts matching one of the patterns.  With tt(-P) this will only
 happen if no specific function is defined for the command or context.
 The tt(-N) option toggles back to using the var(names) as described
 above.
@@ -335,7 +335,7 @@
 example(compdef _pids foo)
 
 using the tt(_pids) function from the distribution to generate the
-process identifiers.  Not also the tt(_gnu_generic) function described
+process identifiers.  Note also the tt(_gnu_generic) function described
 below, which can be used to complete options for commands that
 understand the `tt(-)tt(-help)' option.
 
-- 

This e-mail and any attachment is for authorised use by the intended recipient(s) only.  It may contain proprietary material, confidential information and/or be subject to legal privilege.  It should not be copied, disclosed to, retained or used by, any other party.  If you are not an intended recipient then please promptly delete this e-mail and any attachment and all copies and inform the sender.  Thank you.



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