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

PATCH: Re: Compsys and KSH_AUTOLOAD



This is part 2 for the patch I sent in 19767 and should be applied on
top of it. This changes the documentation and completion functions
along with allowing -k and -z to be used with typeset -f or functions.
The completion system also now uses the -z option to autoload though
kshautoload using users will need to specify it when autoloading
compinit.

Why do export and readonly accept -f arguments? Is that just to avoid
errors on bash scripts? Any reason why we shouldn't implement readonly
functions.

On 13 Apr, Bart wrote:
> 
> } In addition to documentation changes, I also need to make the new
> } options work for functions and typeset -f. Shouldn't running just
> } `functions -U' restrict the listed options to those with PM_UNALIASED
> } set?

Seems I was wrong: it does already. (I probably got confused because my
test function got autoloaded with -U from my .zshrc. Sorry for the
noise.)

> } At the moment, it isn't entirely consistent with typeset. What
> } should `functions +U' do?
> 
> List only the names of the functions with PM_UNALIASED set, whereas -U
> lists the entire definition (such as it is).

I've left this alone for now. To list only names, you can use
`functions +' or `typeset +f'. I'm inclined to think it would be better
if +U caused it to restrict listed functions to those where
PM_UNALIASED is unset. Same goes for all typeset options. Any views?

> } > Here's a possibly-silly idea:  Those flags could be made to apply to
> } > arrays as well as functions

> Well, if you have ksh_autoload set, then chances are you're loading some
> ksh functions, which means you probably also have ksh_arrays set.  So the
> real question is whether there are cases where one would want one-based
> arrays; the opposite is just for logical symmetry.

But someone with ksh_autoload unset might want a zero-based array. If
the math modulo operator is being used on an index variable, zero based
arrays are more useful. Having `-z' mean not zero-based might be
confusing though.

On 14 Apr, Bart wrote:
> One question that occurred to me ... given:
> 
>     zcompile -k foo
>     autoload -z foo 
> 
> I presume zcompile wins the argument.  That should be documented ...

Yes, zcompile does win. That was applicable before with +X. I've
documented this under zcompile.

Oliver

diff -ur zsh.p1/Completion/Base/Widget/_next_tags zsh/Completion/Base/Widget/_next_tags
--- zsh.p1/Completion/Base/Widget/_next_tags	2003-03-11 18:33:05.000000000 +0100
+++ zsh/Completion/Base/Widget/_next_tags	2004-04-16 18:35:00.000000000 +0200
@@ -37,7 +37,7 @@
       (( $#funcstack > _tags_level )) && _comp_tags="${_comp_tags% * }"
       _tags_level=$#funcstack
       [[ "$_next_tags_not" = *\ ${__spec}\ * ]] && continue
-      _comp_tags="$_comp_tags $__spec "
+      _comp_tags+=" $__spec "
       if [[ "$curtag" = *[^\\]:* ]]; then
         zformat -f __descr "${curtag#*:}" "d:$3"
         _description "$__gopt[@]" "${curtag%:*}" "$2" "$__descr"
@@ -64,7 +64,7 @@
       (( $#funcstack > _tags_level )) && _comp_tags="${_comp_tags% * }"
       _tags_level=$#funcstack
       [[ "$_next_tags_not" = *\ ${__spec}\ * ]] && continue
-      _comp_tags="$_comp_tags $__spec "
+      _comp_tags+=" $__spec "
       if [[ "$curtag" = *[^\\]:* ]]; then
         zformat -f __descr "${curtag#*:}" "d:$3"
         _description "$__gopt[@]" "${curtag%:*}" "$2" "$__descr"
@@ -92,7 +92,7 @@
     fi
   fi
 
-  _next_tags_not="$_next_tags_not $_lastcomp[tags]"
+  _next_tags_not+=" $_lastcomp[tags]"
   _next_tags_pfx="$PREFIX"
   _next_tags_sfx="$SUFFIX"
 
@@ -107,7 +107,7 @@
   compstate[insert]="$ins"
   compstate[list]='list force'
 
-  compprefuncs=( "$compprefuncs[@]" _next_tags_pre )
+  compprefuncs+=( _next_tags_pre )
 }
 
 # Completer, for wrap-around.
@@ -132,9 +132,9 @@
     return 0
   elif [[ ${LBUFFER%${PREFIX}} != ${_next_tags_pre}* ]]; then
     unfunction _all_labels _next_label
-    autoload -U _all_labels _next_label
+    autoload -Uz _all_labels _next_label
   else
-    compprefuncs=( "$compprefuncs[@]" _next_tags_pre )
+    compprefuncs+=( _next_tags_pre )
   fi
 }
 
diff -ur zsh.p1/Completion/bashcompinit zsh/Completion/bashcompinit
--- zsh.p1/Completion/bashcompinit	2003-01-29 15:26:01.000000000 +0100
+++ zsh/Completion/bashcompinit	2004-04-14 16:11:35.000000000 +0200
@@ -168,5 +168,5 @@
 }
 
 unfunction bashcompinit
-autoload -U bashcompinit
+autoload -Uz bashcompinit
 return 0
diff -ur zsh.p1/Completion/compdump zsh/Completion/compdump
--- zsh.p1/Completion/compdump	2002-06-23 06:52:39.000000000 +0200
+++ zsh/Completion/compdump	2004-04-14 16:11:26.000000000 +0200
@@ -108,7 +108,7 @@
 # print them out:  about five to a line looks neat
 
 _i=5
-print -n autoload -U >> $_d_file
+print -n autoload -Uz >> $_d_file
 while (( $#_d_als )); do
   if (( ! $+_compautos[$_d_als[1]] )); then
     print -n " $_d_als[1]"
@@ -123,7 +123,7 @@
 print >> $_d_file
 
 for _i in "${(ok@)_compautos}"; do
-  print "autoload -U $_compautos[$_i] $_i" >> $_d_file
+  print "autoload -Uz $_compautos[$_i] $_i" >> $_d_file
 done
 
 print >> $_d_file
@@ -134,4 +134,4 @@
 mv $_d_file ${_d_file%.$HOST.$$}
 
 unfunction compdump
-autoload -U compdump
+autoload -Uz compdump
diff -ur zsh.p1/Completion/compinit zsh/Completion/compinit
--- zsh.p1/Completion/compinit	2004-04-14 16:11:04.000000000 +0200
+++ zsh/Completion/compinit	2004-04-14 16:11:17.000000000 +0200
@@ -46,7 +46,7 @@
 #     generate matches, but should automatically be loaded
 #     when they are called. The <options> will be given to the
 #     autoload builtin when making the function autoloaded. Note
-#     that this need not include `-U'.
+#     that this need not include `-U' and `-z'.
 #
 # Note that no white space is allowed between the `#' and the rest of
 # the string.
@@ -292,7 +292,7 @@
     # and probably do autoloading.
 
     func="$1"
-    [[ -n "$autol" ]] && autoload -U "$func"
+    [[ -n "$autol" ]] && autoload -Uz "$func"
     shift
 
     case "$type" in
@@ -406,7 +406,7 @@
 _i_wdirs=()
 _i_wfiles=()
 
-autoload -U compaudit
+autoload -Uz compaudit
 if [[ -n "$_i_check" ]]; then
   typeset _i_q
   if ! eval compaudit; then
@@ -433,7 +433,7 @@
 fi
 
 # Make sure compdump is available, even if we aren't going to use it.
-autoload -U compdump compinstall
+autoload -Uz compdump compinstall
 
 # If we have a dump file, load it.
 
@@ -473,7 +473,7 @@
 	fi
 	;;
       (\#autoload)
-	autoload -U "$_i_line[@]" ${_i_name}
+	autoload -Uz "$_i_line[@]" ${_i_name}
 	[[ "$_i_line" != \ # ]] && _compautos[${_i_name}]="$_i_line"
 	;;
       esac
@@ -505,6 +505,6 @@
 fi
 
 unfunction compinit compaudit
-autoload -U compinit compaudit
+autoload -Uz compinit compaudit
 
 return 0
diff -ur zsh.p1/Completion/compinstall zsh/Completion/compinstall
--- zsh.p1/Completion/compinstall	2003-03-07 16:19:47.000000000 +0100
+++ zsh/Completion/compinstall	2004-04-14 16:12:02.000000000 +0200
@@ -7,7 +7,7 @@
 __ci_tidyup() {
   unfunction -m __ci_\* 2>/dev/null
   unfunction compinstall
-  autoload -U compinstall
+  autoload -Uz compinstall
 }
 
 __ci_newline() {
@@ -119,7 +119,7 @@
     then
       compinit_args=$match[1]
     elif [[ $line != [[:blank:]]# &&
-      $line != [[:blank:]]#'autoload -U compinit' &&
+      $line != [[:blank:]]#'autoload -Uz compinit' &&
       $line != [[:blank:]]#compinit &&
       $line != [[:blank:]]#zstyle[[:blank:]]#:compinstall* ]]; then
       warn_unknown="${warn_unknown:+$warn_unknown
@@ -1886,7 +1886,7 @@
   [[ -n $fpath_line ]] && print -r "$fpath_line"
 
   print -r "
-autoload -U compinit
+autoload -Uz compinit
 compinit${compinit_args:+ $compinit_args}"
 
   print -r "$endline"
diff -ur zsh.p1/Completion/Zsh/Command/_typeset zsh/Completion/Zsh/Command/_typeset
--- zsh.p1/Completion/Zsh/Command/_typeset	2002-09-16 20:10:54.000000000 +0200
+++ zsh/Completion/Zsh/Command/_typeset	2004-04-16 18:45:32.000000000 +0200
@@ -1,27 +1,31 @@
-#compdef declare export integer float local readonly typeset
+#compdef autoload declare export functions integer float local readonly typeset
 
 local expl state line func i use curcontext="$curcontext"
-local -A allargs
+local fopts="-f -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
 
 allargs=(
-  A '(-E -F -L -R -T -U -Z -a -f -i -m)-A[specify that arguments refer to associative arrays]'
-  E '(-A -F -L -R -T -U -Z -a -f -i -m)-E[floating point, use engineering notation on output]'
-  F '(-A -E -L -R -T -U -Z -a -f -i -m)-F[floating point, use fixed point decimal on output]'
-  L '(-A -E -F -f -i)-L+[left justify and remove leading blanks from value]:width'
-  R '(-A -E -F -f -i)-R+[right justify and fill with leading blanks]:width'
-  T '(-A -E -F -a -f -g -h -i -l -m -t)-T[tie scalar to array]'
+  A "($fopts -E -F -L -R -T -U -Z -a -i -m)-A[specify that arguments refer to associative arrays]"
+  E "($fopts -A -F -L -R -T -U -Z -a -i -m)-E[floating point, use engineering notation on output]"
+  F "($fopts -A -E -L -R -T -U -Z -a -i -m)-F[floating point, use fixed point decimal on output]"
+  L "($fopts -A -E -F -i)-L+[left justify and remove leading blanks from value]:width"
+  R "($fopts -A -E -F -i)-R+[right justify and fill with leading blanks]:width"
+  T "($fopts -A -E -F -a -g -h -i -l -m -t)-T[tie scalar to array]"
   U '(-A -E -F -i)-U[keep array values unique and suppress alias expansion for functions]'
-  Uf '(-E -F -i)-U[suppress alias expansion for functions]'
-  Up '(-E -F -i)-U[keep array values unique]'
-  Z '(-A -E -F -f -i)-Z+[right justify and fill with leading zeros]:width'
-  a '(-A -E -F -T -f -i)-a[specify that arguments refer to arrays]'
-  f '(-A -E -F -L -R -T -Z -a -g -h -i -l -r -x)-f[specify that arguments refer to functions]'
-  g '(-T -f)-+g[do not restrict parameter to local scope]'
-  h '(-T -f)-+h[hide specialness of parameter]'
-  H '(-T -f)-+H[hide value of parameter in listings]'
-  i '(-A -E -F -T -f)-+i[represent internally as an integer]'
-  l '(-T -f)-l[convert the value to lowercase]'
+  Uf '-U[suppress alias expansion for functions]'
+  Up '(-E -F -i)-+U[keep array values unique]'
+  X '+X[immediately autoload function]'
+  Z "($fopts -A -E -F -i)-Z+[right justify and fill with leading zeros]:width"
+  a "($fopts -A -E -F -T -i)-a[specify that arguments refer to arrays]"
+  f "($popts)-f[specify that arguments refer to functions]"
+  g "($fopts -T)-+g[do not restrict parameter to local scope]"
+  h "($fopts -T)-+h[hide specialness of parameter]"
+  H "($fopts -T)-+H[hide value of parameter in listings]"
+  i "($fopts -A -E -F -T)-+i[represent internally as an integer]"
+  k "($popts -w -z)-+k[mark function for ksh-style autoloading]"
+  l "($popts -T)-l[convert the value to lowercase]"
   m '(-A -E -F -T -i)-m[treat arguments as patterns]'
   p '-p[output parameters in form of calls to typeset]'
   r '(-f)-+r[mark parameters as readonly]'
@@ -31,15 +35,21 @@
   u '-u[convert the value to uppercase or mark function for autoloading]'
   uf '-u[mark function for autoloadling]'
   up '-u[convert the value to uppercase]'
-  x '(-f)-+x[export parameter]'
+  w '(-k -z)-w[specify that arguments refer to files compiled with zcompile]'
+  x "($fopts)-+x[export parameter]"
+  z "($popts -k -w)-+z[mark function for zsh-style autoloading]"
 )
 
-use="AEFHLRTUZafghilmprtux"
+use="AEFHLRTUZafghiklmprtuxz"
 
 case ${service} in
+  autoload)
+    use="UXktwz"
+    func=f
+  ;;
   float) use="EFHghlprtux";;
   functions)
-    use="Umtu"
+    use="Ukmtuz"
     func=f
   ;;
   integer)
@@ -47,28 +57,37 @@
     allargs[i]='-i[specify arithmetic base for output]' \
   ;;
   readonly) use="${use/r/}" ;;
-  local) use="${use/f/}" ;&
-  export) use="${${use/g/}/x/}" ;;
+  local) use="${use/[fkz]/}" ;&
+  export) use="${${use//[gkz]/}/x/}" ;;
 esac
 
-[[ -z "${words[(r)-*f*]}" ]] || func=f
 [[ -z "${words[(r)-*[aA]*]}" ]] || func=p
+[[ -z "${words[(r)-*f*]}" ]] || func=f
    
 for ((i=1;i<=$#use;++i)); do
   args+=( ${allargs[${use[$i]}${${(s::)use[$i]}[(r)[Uut]]:+$func}]} )
 done
 
-_arguments -C -s -A "-*" -S "${args[@]}" '*:vars:->vars_eq'
+_arguments -C -s -A "-*" -S "${args[@]}" '*::vars:= ->vars_eq'
 
 if [[ "$state" = vars_eq ]]; then
   if [[ $func = f ]]; then
-    _functions
+    if (( $+opt_args[-w] ));then
+      _wanted files expl 'zwc file' _files -g '*.zwc(-.)'
+    else
+      _functions
+    fi
   elif [[ "$PREFIX" = *\=* ]]; then
     compstate[parameter]="${PREFIX%%\=*}"
     compset -P 1 '*='
     _value
   elif (( $+opt_args[-a] || $+opt_args[-A] )); then
     _parameters -q
+  elif (( $+opt_args[-T] )); then
+    _arguments \
+      ':scalar parameter:_parameters -g "*scalar*" -q -S "="' \
+      ':array parameter:_parameters -g "*array*"' \
+      ':separator character'
   else
     _parameters -q -S '='
   fi
diff -ur zsh.p1/Completion/Zsh/Type/_functions zsh/Completion/Zsh/Type/_functions
--- zsh.p1/Completion/Zsh/Type/_functions	2001-04-02 13:18:39.000000000 +0200
+++ zsh/Completion/Zsh/Type/_functions	2004-04-16 15:58:27.000000000 +0200
@@ -1,4 +1,4 @@
-#compdef functions unfunction
+#compdef unfunction
 
 local expl
 
diff -ur zsh.p1/Doc/Zsh/builtins.yo zsh/Doc/Zsh/builtins.yo
--- zsh.p1/Doc/Zsh/builtins.yo	2004-03-29 10:49:39.000000000 +0200
+++ zsh/Doc/Zsh/builtins.yo	2004-04-16 16:42:05.000000000 +0200
@@ -103,9 +103,9 @@
 findex(autoload)
 cindex(functions, autoloading)
 cindex(autoloading functions)
-item(tt(autoload) [ {tt(PLUS())|tt(-)}tt(UXmt) ] [ tt(-wkz) ] [ var(name) ... ])(
-Equivalent to tt(functions -u), with the exception of tt(-X)/tt(+X),
-tt(-w), tt(-k) and tt(-z).
+item(tt(autoload) [ {tt(PLUS())|tt(-)}tt(UXktz) ] [ tt(-w) ] [ var(name) ... ])(
+Equivalent to tt(functions -u), with the exception of tt(-X)/tt(+X) and
+tt(-w).
 
 The flag tt(-X) may be used only inside a shell function, and may not be
 followed by a var(name).  It causes the calling function to be marked for
@@ -120,16 +120,10 @@
 This does em(not) replace any existing definition of the function.  The
 exit status is nonzero (failure) if the function was already defined or
 when no definition was found.  In the latter case the function remains
-undefined and marked for autoloading.
-
-The flag tt(+X) may be combined with either tt(-k) or tt(-z) to make
-the function be loaded using ksh-style or zsh-style autoloading,
-respectively. If neither is given, the current setting of the
-tt(KSH_AUTOLOAD) options determines how the function is loaded. With
-ksh-style autoloading, the contents of the file will not be executed
-immediately. Instead, the function created will contain the contents of 
-the file plus a call to the function itself appended to it, thus given 
-normal ksh autoloading behaviour on the first call to the function.
+undefined and marked for autoloading.  If ksh-style autoloading is
+enabled, the function created will contain the contents of the file
+plus a call to the function itself appended to it, thus giving normal
+ksh autoloading behaviour on the first call to the function.
 
 With the tt(-w) flag, the var(name)s are taken as names of files compiled
 with the tt(zcompile) builtin, and all functions defined in them are
@@ -461,7 +455,7 @@
 point numbers are not permitted.
 )
 findex(functions)
-item(tt(functions) [ {tt(PLUS())|tt(-)}tt(UXmtu) ] [ var(name) ... ])(
+item(tt(functions) [ {tt(PLUS())|tt(-)}tt(UXkmtuz) ] [ var(name) ... ])(
 Equivalent to tt(typeset -f).
 )
 module(getcap)(zsh/cap)
@@ -1159,7 +1153,7 @@
 findex(typeset)
 cindex(parameters, setting)
 cindex(parameters, declaring)
-xitem(tt(typeset) [ {tt(PLUS())|tt(-)}tt(AEFHLRUZafghilprtuxm) [var(n)]] [ \
+xitem(tt(typeset) [ {tt(PLUS())|tt(-)}tt(AEFHLRUZafghiklprtuxmz) [var(n)]] [ \
 var(name)[tt(=)var(value)] ... ])
 item(tt(typeset) -T [ {tt(PLUS()|tt(-))}tt(LRUZrux) ] \
   var(SCALAR)[tt(=)var(value)] var(array) tt([) var(sep) tt(]))(
@@ -1290,13 +1284,16 @@
 )
 item(tt(-f))(
 The names refer to functions rather than parameters.  No assignments
-can be made, and the only other valid flags are tt(-t), tt(-u) and
-tt(-U).  The flag tt(-t) turns on execution tracing for this
+can be made, and the only other valid flags are tt(-t), tt(-k), tt(-u),
+tt(-U) and tt(-z).  The flag tt(-t) turns on execution tracing for this
 function.  The tt(-u) and tt(-U) flags cause the function to be
 marked for autoloading; tt(-U) also causes alias expansion to be
 suppressed when the function is loaded.  The tt(fpath) parameter
 will be searched to find the function definition when the function
-is first referenced; see noderef(Functions).
+is first referenced; see noderef(Functions). The tt(-k) and tt(-z) flags
+make the function be loaded using ksh-style or zsh-style autoloading
+respectively. If neither is given, the setting of the KSH_AUTOLOAD option
+determines how the function is loaded.
 )
 item(tt(-h))(
 Hide: only useful for special parameters (those marked `<S>' in the table in
@@ -1634,9 +1631,11 @@
 function will be autoloaded as if the tt(KSH_AUTOLOAD) option is
 em(not) set, even if it is set at the time the compiled file is
 read, while if the tt(-k) is given, the function will be loaded as if
-tt(KSH_AUTOLOAD) em(is) set.  If neither of these options is given, the
-function will be loaded as determined by the setting of the
-tt(KSH_AUTOLOAD) option at the time the compiled file is read.
+tt(KSH_AUTOLOAD) em(is) set.  These options also take precedence over
+any tt(-k) or tt(-z) options specified to the tt(autoload) builtin. If
+neither of these options is given, the function will be loaded as
+determined by the setting of the tt(KSH_AUTOLOAD) option at the time
+the compiled file is read.
 ifzman( )
 These options may also appear as many times as necessary between the listed
 var(name)s to specify the loading style of all following functions, up to
diff -ur zsh.p1/Doc/Zsh/compsys.yo zsh/Doc/Zsh/compsys.yo
--- zsh.p1/Doc/Zsh/compsys.yo	2004-03-01 12:36:05.000000000 +0100
+++ zsh/Doc/Zsh/compsys.yo	2004-04-16 10:59:30.000000000 +0200
@@ -225,8 +225,8 @@
 are not otherwise treated specially.  Typically they are to be called
 from within one of the completion functions.  Any var(options) supplied
 will be passed to the tt(autoload) builtin; a typical use is tt(+X) to
-force the function to be loaded immediately.  Note that the tt(-U) flag is
-always added implicitly.
+force the function to be loaded immediately.  Note that the tt(-U) and
+tt(-z) flags are always added implicitly.
 )
 enditem()
 
@@ -234,16 +234,6 @@
 The tt(#compdef) tags use the tt(compdef) function described below; the
 main difference is that the name of the function is supplied implicitly.
 
-Note also that the functions for the completion system assume that the
-tt(KSH_AUTOLOAD) option is not set.  They cannot be loaded if it is
-set.  To avoid having to unset tt(KSH_AUTOLOAD), you can instead use one or
-more tt(zwc) file(s) that have been created with the command tt(zcompile
--z) to load the functions for the completion system; see
-ifzman(zmanref(zshbuiltins))\
-ifnzman(noderef(Shell Builtin Commands))\
-.  This forces the functions to be autoloaded the way zsh normally
-loads functions.
-
 The special contexts for which completion functions can be defined are:
 
 startitem()
diff -ur zsh.p1/Src/builtin.c zsh/Src/builtin.c
--- zsh.p1/Src/builtin.c	2004-04-13 15:08:44.000000000 +0200
+++ zsh/Src/builtin.c	2004-04-16 17:27:28.000000000 +0200
@@ -53,7 +53,7 @@
     BUILTIN("cd", BINF_SKIPINVALID | BINF_SKIPDASH | BINF_DASHDASHVALID, bin_cd, 0, 2, BIN_CD, "sPL", NULL),
     BUILTIN("chdir", BINF_SKIPINVALID | BINF_SKIPDASH | BINF_DASHDASHVALID, bin_cd, 0, 2, BIN_CD, "sPL", NULL),
     BUILTIN("continue", BINF_PSPECIAL, bin_break, 0, 1, BIN_CONTINUE, NULL, NULL),
-    BUILTIN("declare", BINF_PLUSOPTS | BINF_MAGICEQUALS | BINF_PSPECIAL, bin_typeset, 0, -1, 0, "AE:%F:%HL:%R:%TUZ:%afghi:%lprtux", NULL),
+    BUILTIN("declare", BINF_PLUSOPTS | BINF_MAGICEQUALS | BINF_PSPECIAL, bin_typeset, 0, -1, 0, "AE:%F:%HL:%R:%TUZ:%afghi:%klmprtuxz", NULL),
     BUILTIN("dirs", 0, bin_dirs, 0, -1, 0, "clpv", NULL),
     BUILTIN("disable", 0, bin_enable, 0, -1, BIN_DISABLE, "afmrs", NULL),
     BUILTIN("disown", 0, bin_fg, 0, -1, BIN_DISOWN, NULL, NULL),
@@ -73,7 +73,7 @@
 	    NULL),
     BUILTIN("fg", 0, bin_fg, 0, -1, BIN_FG, NULL, NULL),
     BUILTIN("float", BINF_PLUSOPTS | BINF_MAGICEQUALS | BINF_PSPECIAL, bin_typeset, 0, -1, 0, "E:%F:%Hghlprtux", "E"),
-    BUILTIN("functions", BINF_PLUSOPTS, bin_functions, 0, -1, 0, "mtuU", NULL),
+    BUILTIN("functions", BINF_PLUSOPTS, bin_functions, 0, -1, 0, "kmtuUz", NULL),
     BUILTIN("getln", 0, bin_read, 0, -1, 0, "ecnAlE", "zr"),
     BUILTIN("getopts", 0, bin_getopts, 2, -1, 0, NULL, NULL),
     BUILTIN("hash", BINF_MAGICEQUALS, bin_hash, 0, -1, 0, "Ldfmrv", NULL),
@@ -121,7 +121,7 @@
     BUILTIN("trap", BINF_PSPECIAL, bin_trap, 0, -1, 0, NULL, NULL),
     BUILTIN("true", 0, bin_true, 0, -1, 0, NULL, NULL),
     BUILTIN("type", 0, bin_whence, 0, -1, 0, "ampfsw", "v"),
-    BUILTIN("typeset", BINF_PLUSOPTS | BINF_MAGICEQUALS | BINF_PSPECIAL, bin_typeset, 0, -1, 0, "AE:%F:%HL:%R:%TUZ:%afghi:%lprtuxm", NULL),
+    BUILTIN("typeset", BINF_PLUSOPTS | BINF_MAGICEQUALS | BINF_PSPECIAL, bin_typeset, 0, -1, 0, "AE:%F:%HL:%R:%TUZ:%afghi:%klprtuxmz", NULL),
     BUILTIN("umask", 0, bin_umask, 0, 1, 0, "S", NULL),
     BUILTIN("unalias", 0, bin_unhash, 1, -1, 0, "ms", "a"),
     BUILTIN("unfunction", 0, bin_unhash, 1, -1, 0, "m", "f"),
@@ -2406,13 +2406,15 @@
 	on |= PM_TAGGED;
     else if (OPT_PLUS(ops,'t'))
 	off |= PM_TAGGED;
-    if (OPT_MINUS(ops,'z'))
+    if (OPT_MINUS(ops,'z')) {
 	on |= PM_ZSHSTORED;
-    else if (OPT_PLUS(ops,'z'))
+	off |= PM_KSHSTORED;
+    } else if (OPT_PLUS(ops,'z'))
 	off |= PM_ZSHSTORED;
-    if (OPT_MINUS(ops,'k'))
+    if (OPT_MINUS(ops,'k')) {
 	on |= PM_KSHSTORED;
-    else if (OPT_PLUS(ops,'k'))
+	off |= PM_ZSHSTORED;
+    } else if (OPT_PLUS(ops,'k'))
 	off |= PM_KSHSTORED;
 
     if ((off & PM_UNDEFINED) || (OPT_ISSET(ops,'k') && OPT_ISSET(ops,'z')) ||



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