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

Re: PATCH: Re: sudo completion problem



In article <200005041340.PAA08620@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>,
  Sven Wischnowsky <wischnow@xxxxxxxxxxxxxxxxxxxxxxx> 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



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