summary refs log tree commit diff
path: root/Completion/Zsh/Command
diff options
context:
space:
mode:
authorOliver Kiddle <opk@zsh.org>2014-10-02 18:57:40 +0200
committerOliver Kiddle <opk@zsh.org>2014-10-02 19:29:32 +0200
commit00a654af5c84f10a682f7e47547f7362865f2139 (patch)
tree617ec2ebe0359bb9df7c211121142d6ae816f5e7 /Completion/Zsh/Command
parent8cbff0b82ee285b7424476439fe1ef4d1032c593 (diff)
downloadzsh-00a654af5c84f10a682f7e47547f7362865f2139.tar.gz
zsh-00a654af5c84f10a682f7e47547f7362865f2139.tar.xz
zsh-00a654af5c84f10a682f7e47547f7362865f2139.zip
33323: fix bug in removing math functions and complete -M option to functions
Diffstat (limited to 'Completion/Zsh/Command')
-rw-r--r--Completion/Zsh/Command/_typeset15
1 files changed, 11 insertions, 4 deletions
diff --git a/Completion/Zsh/Command/_typeset b/Completion/Zsh/Command/_typeset
index f876e1beb..367dbfc23 100644
--- a/Completion/Zsh/Command/_typeset
+++ b/Completion/Zsh/Command/_typeset
@@ -1,7 +1,7 @@
 #compdef autoload declare export functions integer float local readonly typeset
 
 local expl state line func i use curcontext="$curcontext"
-local fopts="-f -k -z"
+local fopts="-f -k -z +k +z"
 local popts="-A -E -F -L -R -T -Z -a -g -h -H -i -l -r -x"
 local -A allargs opt_args
 local -a args
@@ -51,8 +51,9 @@ case ${service} in
   ;;
   float) use="EFHghlprtux";;
   functions)
-    use="UkmTtuz"
+    use="UkmTtuzM"
     func=f
+    allargs[M]='(-k -t -T -u -U -z -M +M +k +t +z)-+M[define mathematical function]'
   ;;
   integer)
     use="Hghilprtux"
@@ -73,14 +74,20 @@ onopts=${(j..)${${words[1,CURRENT-1]:#^-*}##-}}
 offopts=${(j..)${${words[1,CURRENT-1]:#^+*}##+}}
 
 for ((i=1;i<=$#use;++i)); do
-  args+=( ${allargs[${use[$i]}${${(s::)use[$i]}[(r)[Uut]]:+$func}]} )
+  args+=( ${allargs[${use[$i]}${${(s::)use[$i]}[(r)[UutT]]:+$func}]} )
 done
 
 _arguments -C -s -A "-*" -S "${args[@]}" '*::vars:= ->vars_eq'
 
 if [[ "$state" = vars_eq ]]; then
   if [[ $func = f ]]; then
-    if (( $+opt_args[-w] ));then
+    if (( $+opt_args[+M] || ( $+opt_args[-M] && $+opt_args[-m] ) )); then
+      _wanted functions expl 'math function' compadd -F line - \
+          ${${${(f)"$(functions -M)"}##*-M }%% *}
+    elif (( $+opt_args[-M] )); then
+      _arguments ':new math function:_functions' ':minimum arguments' \
+      ':maximum arguments' ':shell function:_functions'
+    elif (( $+opt_args[-w] )); then
       _wanted files expl 'zwc file' _files -g '*.zwc(-.)'
     elif [[ $service = autoload || -n $opt_args[(i)-[uU]] ]]; then
       args=(${^fpath}/*(-.:t))