about summary refs log tree commit diff
diff options
context:
space:
mode:
authorTanaka Akira <akr@users.sourceforge.net>1999-07-24 14:01:54 +0000
committerTanaka Akira <akr@users.sourceforge.net>1999-07-24 14:01:54 +0000
commit14810d6df13e0564a606b74e4c4e918e80862e25 (patch)
tree0e24a6c6b0226a90bdf8398ce94b60fdc9a87b0e
parentd6d4a3abfc84f0940e663cd69537789a039a7056 (diff)
downloadzsh-dot-zsh-199907241534.tar.gz
zsh-dot-zsh-199907241534.tar.xz
zsh-dot-zsh-199907241534.zip
zsh-3.1.6-test-3 dot-zsh-199907241534
-rw-r--r--ChangeLog117
-rw-r--r--Completion/Base/.distfiles3
-rw-r--r--Completion/Base/_complete_opts88
-rw-r--r--Completion/Base/_first4
-rw-r--r--Completion/Builtins/_aliases2
-rw-r--r--Completion/Builtins/_functions2
-rw-r--r--Completion/Commands/_correct_filename2
-rw-r--r--Completion/Commands/_correct_word2
-rw-r--r--Completion/Commands/_expand_word2
-rw-r--r--Completion/Commands/_history_complete_word2
-rw-r--r--Completion/Commands/_most_recent_file2
-rw-r--r--Completion/Commands/_read_comp2
-rw-r--r--Completion/Core/_main_complete11
-rw-r--r--Completion/Core/_normal6
-rw-r--r--Completion/Core/_parameters7
-rw-r--r--Completion/Core/compinit9
-rw-r--r--Completion/User/.distfiles2
-rw-r--r--Completion/User/_bunzip23
-rw-r--r--Completion/User/_bzip23
-rw-r--r--Completion/User/_cvs141
-rw-r--r--Completion/User/_make2
-rw-r--r--Completion/User/_rlogin12
-rw-r--r--Completion/User/_stty2
-rw-r--r--Config/version.mk4
-rw-r--r--Doc/Makefile.in12
-rw-r--r--Doc/Zsh/arith.yo13
-rw-r--r--Doc/Zsh/builtins.yo38
-rw-r--r--Doc/Zsh/compctl.yo6
-rw-r--r--Doc/Zsh/compsys.yo41
-rw-r--r--Doc/Zsh/compwid.yo26
-rw-r--r--Doc/Zsh/cond.yo25
-rw-r--r--Doc/Zsh/expn.yo110
-rw-r--r--Doc/Zsh/files.yo13
-rw-r--r--Doc/Zsh/func.yo51
-rw-r--r--Doc/Zsh/grammar.yo47
-rw-r--r--Doc/Zsh/invoke.yo11
-rw-r--r--Doc/Zsh/jobs.yo3
-rw-r--r--Doc/Zsh/metafaq.yo1
-rw-r--r--Doc/Zsh/mod_complist.yo6
-rw-r--r--Doc/Zsh/mod_stat.yo8
-rw-r--r--Doc/Zsh/mod_zftp.yo5
-rw-r--r--Doc/Zsh/mod_zle.yo16
-rw-r--r--Doc/Zsh/options.yo141
-rw-r--r--Doc/Zsh/params.yo12
-rw-r--r--Doc/Zsh/redirect.yo20
-rw-r--r--Doc/Zsh/zftpsys.yo33
-rw-r--r--Doc/Zsh/zle.yo16
-rw-r--r--Doc/zman.yo3
-rw-r--r--Doc/ztexi.yo4
-rw-r--r--Etc/CONTRIBUTORS12
-rw-r--r--Etc/FAQ.yo40
-rw-r--r--Etc/MACHINES13
-rw-r--r--Etc/NEWS2
-rw-r--r--INSTALL24
-rw-r--r--README37
-rw-r--r--Src/Modules/clone.c2
-rw-r--r--Src/Modules/mapfile.c3
-rw-r--r--Src/Modules/parameter.c2
-rw-r--r--Src/Zle/complist.c15
-rw-r--r--Src/Zle/zle_tricky.c77
-rw-r--r--Src/exec.c6
-rw-r--r--Src/subst.c2
-rw-r--r--Util/zsh-development-guide8
-rw-r--r--configure.in4
64 files changed, 1030 insertions, 308 deletions
diff --git a/ChangeLog b/ChangeLog
index feea8c23f..18e38b19b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,122 @@
+1999-07-24  Peter Stephenson  <pws@ibmth.df.unipi.it>
+
+	* pws: version 3.1.6-test-3
+
+	* pws: lastest FAQ.yo, FAQ
+
+1999-07-23  Peter Stephenson  <pws@ibmth.df.unipi.it>
+
+	* pws: 7264: Completion/Commands/_correct_filename,
+	  Completion/Commands/_correct_word,
+	  Completion/Commands/_expand_word,
+	  Completion/Commands/_history_complete_word,
+	  Completion/Commands/_most_recent_file,
+	  Completion/Commands/_read_comp, Completion/Core/compinit,
+	  Doc/Zsh/compsys.yo: compdef -k takes -n option not to override
+	  existing keybinding; used in completion command widgets to
+	  keep user bindings during compinit.
+
+	* Sven: 7260: Completion/Core/_main_complete: commented-out
+	  option saving bit can uses parameter module
+
+	* Sven: 7259, 7261: Src/subst.c, Src/Modules/parameter.c,
+	  Doc/Zsh/expn.yo, Completion/Core/_normal,
+	  Completion/Core/_parameters: parameter module provides
+	  local information; used in _parameters; _normal uses
+	  $commands when available.
+
+	* pws: 7257: Completion/Core/_parameters: simplify.
+
+	* Tanak Akira: 7256: Completion/User/_bzip2,
+	  Completion/User/_bunzip2: new.
+
+	* Tanaka Akira: 7255: Completion/User/_make: complete after =.
+
+	* Oliver: 7254: Completion/Builtins/_aliases: do unalias.
+
+1999-07-22  Peter Stephenson  <pws@ibmth.df.unipi.it>
+
+	* pws: 7253: Doc/Zsh/arith.yo, Doc/Zsh/builtins.yo,
+	  Doc/Zsh/compctl.yo, Doc/Zsh/compsys.yo, Doc/Zsh/compwid.yo,
+	  Doc/Zsh/cond.yo, Doc/Zsh/expn.yo, Doc/Zsh/files.yo,
+	  Doc/Zsh/func.yo, Doc/Zsh/grammar.yo, Doc/Zsh/invoke.yo,
+	  Doc/Zsh/jobs.yo, Doc/Zsh/mod_stat.yo, Doc/Zsh/mod_zle.yo,
+	  Doc/Zsh/options.yo, Doc/Zsh/params.yo, Doc/Zsh/redirect.yo,
+	  Doc/Zsh/zle.yo, Doc/ztexi.yo, Util/zsh-development-guide:
+	  General documentation fixes and enhancements.
+
+	* Sven: 7251: Src/Zle/zle_tricky.c: completion words wrapper
+	  tweak thing.
+
+1999-07-21  Peter Stephenson  <pws@ibmth.df.unipi.it>
+
+	* Bart: 7246: Completion/Builtin/_functions: complete for
+	  _functions.
+
+	* Tanaka Akira, Sven: 7243, 7250: Completion/Base/_complete_opts,
+	  Completion/User_cvs: enhancements for cvs completion.
+
+	* Sven: 7241: Completion/Base/_first: typos
+
+	* pws: 7231: README, Etc/CONTRIBUTORS: notes for latest release
+	  including possible incompatibilities.
+
+	* Bart: 7230: Src/exec.c: cancd2 didn't free string properly
+	  (or at all, in fact).
+
+	* Tanaka Akira, Bart: 7228: Completion/User/_cvs,
+	  Completion/User/_complete_opts:  completion for cvs.
+	
+1999-07-20  Peter Stephenson  <pws@ibmth.df.unipi.it>
+
+	* pws: 7226: INSTALL: mention that dependent libraries of zle
+	  can't be used if zle is dynamically loaded on systems without
+	  working RTLD_GLOBAL.
+
+	* pws: 7223: Doc/Makefile.in, Doc/Zsh/compsys.yo,
+	  Doc/Zsh/compwid.yo, Doc/Zsh/mod_complist.yo,
+	  Doc/Zsh/mod_zftp.yo, Doc/Zsh/mod_zle.yo, Doc/Zsh/zftpsys.yo:
+	  dependences for texinfo manual; extra index entries.
+
+	* Sven: 7220: Src/Zle/complist.c: `*=' works and the last
+	  column is set.
+
+	* Sven: 7219: Src/Zle/zle_tricky.c, Doc/Zsh/compwid.yo:
+	  compstate[force_list] now works as documented.
+
+	* Sven: 2456: Src/Zle/zle_tricky.c, Doc/Zsh/compwid.yo: 
+	  clear explanation string; document compstate[insert]=''
+	  is same as unsetting.
+
+	* pws: 7218: Doc/Makefile.in, Doc/zman.yo: delete all manual
+	  page lines beginning .'; work around yodl .SH ""NAME problem.
+
+	* Sven: 7217: Src/exec.c: duplicate function name for scriptname.
+
+	* Sven: 7216: Src/Zle/zle_tricky.c: insertion with old and
+	  new completion.
+
+	* Tanaka Akira: 7213: Doc/Makefile.in: postprocess manual pages
+	  to remove yodl cruft.
+
+	* Ollivier: 7209, 7210: configure.in, Etc/MACHINES: Elf and a.out
+	  dynamic loading on FreeBSD (MACHINES entry adapted).
+
 1999-07-19  Peter Stephenson  <pws@ibmth.df.unipi.it>
 
+	* Tanaka Akira: 7205: Src/Modules/mapfile.c: MS_SYNC was not
+          defined on SunOS 4.
+
+	* pws: 7202: Src/Modules/clone.c: add an extra zero argument
+	  to ioctl() to make three.
+
+	* pws: from Ollivier Robert: Etc/MACHINES: FreeBSD 4.0 builds OK.
+
+	* pws: 7196: Src/Zle/zle_tricky.c: try to handle multiple supplied
+	  (-P) prefixes better.
+
+	* pws: 2446: Completion/User/_rlogin: handle user@host better.
+
 	* pws: version 3.1.6-test-2
 
 	* pws: 7192: Src/glob.c: bug with null in pattern if at end of
diff --git a/Completion/Base/.distfiles b/Completion/Base/.distfiles
index ef1e9df73..c2cd2b58a 100644
--- a/Completion/Base/.distfiles
+++ b/Completion/Base/.distfiles
@@ -1,6 +1,7 @@
 DISTFILES_SRC='
     .distfiles 
-    _brace_parameter _command_names _condition _default _equal _first
+    _brace_parameter _command_names _complete_opts
+    _condition _default _equal _first
     _long_options _math _parameter _precommand _redirect _subscript
     _tilde _vars 
 '
diff --git a/Completion/Base/_complete_opts b/Completion/Base/_complete_opts
new file mode 100644
index 000000000..689e13e22
--- /dev/null
+++ b/Completion/Base/_complete_opts
@@ -0,0 +1,88 @@
+#autoload
+
+# Usage:
+#  _complete_opts H '' f '_files'
+
+emulate -L zsh
+setopt extendedglob
+
+local done=yes
+
+typeset -A option_pairs
+option_pairs=("$@")
+typeset -a no_arg with_arg opt_arg
+no_arg=($option_pairs[(I)?])
+opt_arg=($option_pairs[(I)?::]:s/:://)
+with_arg=($option_pairs[(I)?:]:s/:// $opt_arg)
+
+case "${#no_arg}-${#with_arg}" in
+  0-0)
+    if [[ x$PREFIX = x-* ]]; then
+      compadd -nQ - "$PREFIX$SUFFIX"
+    else
+      done=''
+    fi
+    ;;
+
+  0-*)
+    if [[ x$PREFIX = x- ]]; then
+      IPREFIX="$IPREFIX$PREFIX"
+      PREFIX=
+      compadd $with_arg
+    elif [[ x$PREFIX = x-[${(j::)with_arg}] ]]; then
+      IPREFIX="$IPREFIX$PREFIX"
+      PREFIX=
+      eval $option_pairs[$IPREFIX[-1]:]
+    elif [[ x$PREFIX = x-[${(j::)with_arg}]* ]]; then
+      local p="$PREFIX[1,(r)[${(j::)with_arg}]]"
+      IPREFIX="$IPREFIX$p"
+      PREFIX="$PREFIX[$#p + 1,-1]"
+      eval $option_pairs[$IPREFIX[-1]:]
+    elif [[ x$words[$CURRENT-1] = x-[${(j::)with_arg}] ]]; then
+      local p="$words[$CURRENT - 1]"
+      eval $option_pairs[$p[-1]:]
+    else
+      done=''
+    fi
+    ;;
+
+  *-0)
+    if [[ x$PREFIX = x-[${(j::)no_arg}]# ]]; then
+      IPREFIX="$IPREFIX$PREFIX"
+      PREFIX=
+      compadd $no_arg
+    else
+      done=''
+    fi
+    ;;
+
+  *-*)
+    if [[ x$PREFIX = x-[${(j::)no_arg}]# ]]; then
+      IPREFIX="$IPREFIX$PREFIX"
+      PREFIX=
+      compadd $no_arg
+      compadd $with_arg
+    elif [[ x$PREFIX = x-[${(j::)no_arg}]#[${(j::)with_arg}] ]]; then
+      IPREFIX="$IPREFIX$PREFIX"
+      PREFIX=
+      eval $option_pairs[$IPREFIX[-1]:]
+    elif [[ x$PREFIX = x-[${(j::)no_arg}]#[${(j::)with_arg}]* ]]; then
+      local p="$PREFIX[1,(r)[${(j::)with_arg}]]"
+      IPREFIX="$IPREFIX$p"
+      PREFIX="$PREFIX[$#p + 1,-1]"
+      eval $option_pairs[$IPREFIX[-1]:]
+    elif [[ x$words[$CURRENT-1] = x-[${(j::)no_arg}]#[${(j::)with_arg}] ]]; then
+      local p="$words[$CURRENT - 1]"
+      eval $option_pairs[$p[-1]:]
+    else
+      done=''
+    fi
+    ;;
+esac
+
+if [[ -z "$done" ]]; then
+  compadd - -${(k)^option_pairs:gs/://}
+  false
+else
+  true
+fi
diff --git a/Completion/Base/_first b/Completion/Base/_first
index 8b4da019d..c33e91ff0 100644
--- a/Completion/Base/_first
+++ b/Completion/Base/_first
@@ -53,9 +53,9 @@
 #         if compgen -X "%Bhistory ($n):%b" -Q -H $(( i*10 )) ''; then
 #           # We have found at least one matching word, so we switch
 #           # on menu-completion and make sure that no other
-#           # completion function is called by setting _comp_skip.
+#           # completion function is called by setting _compskip.
 #           compstate[insert]=menu
-#           _comp_skip=1
+#           _compskip=1
 #           return
 #         fi
 #         (( i++ ))
diff --git a/Completion/Builtins/_aliases b/Completion/Builtins/_aliases
index 94c8a0f7c..990f43457 100644
--- a/Completion/Builtins/_aliases
+++ b/Completion/Builtins/_aliases
@@ -1,3 +1,3 @@
-#compdef unalias
+#compdef alias unalias
 
 compgen -a
diff --git a/Completion/Builtins/_functions b/Completion/Builtins/_functions
index 052dfca00..52c37952b 100644
--- a/Completion/Builtins/_functions
+++ b/Completion/Builtins/_functions
@@ -1,3 +1,3 @@
-#compdef unfunction
+#compdef functions unfunction
 
 compgen -F
diff --git a/Completion/Commands/_correct_filename b/Completion/Commands/_correct_filename
index 7431a4831..e9415a81f 100644
--- a/Completion/Commands/_correct_filename
+++ b/Completion/Commands/_correct_filename
@@ -1,4 +1,4 @@
-#compdef -k complete-word \C-xC
+#compdef -kn complete-word \C-xC
 
 # Function to correct a filename.  Can be used as a completion widget,
 # or as a function in its own right, in which case it will print the
diff --git a/Completion/Commands/_correct_word b/Completion/Commands/_correct_word
index d0abcd4fe..4376de092 100644
--- a/Completion/Commands/_correct_word
+++ b/Completion/Commands/_correct_word
@@ -1,4 +1,4 @@
-#compdef -k complete-word \C-xc
+#compdef -kn complete-word \C-xc
 
 # Simple completion front-end implementing spelling correction.
 # The maximum number of errors is set quite high, and
diff --git a/Completion/Commands/_expand_word b/Completion/Commands/_expand_word
index 570f06987..481d5e6a0 100644
--- a/Completion/Commands/_expand_word
+++ b/Completion/Commands/_expand_word
@@ -1,4 +1,4 @@
-#compdef -k complete-word \C-xe
+#compdef -kn complete-word \C-xe
 
 # Simple completion front-end implementing expansion.
 #
diff --git a/Completion/Commands/_history_complete_word b/Completion/Commands/_history_complete_word
index fc67c0f14..8e99aec17 100644
--- a/Completion/Commands/_history_complete_word
+++ b/Completion/Commands/_history_complete_word
@@ -1,2 +1,2 @@
-#compdef -k complete-word \e/
+#compdef -kn complete-word \e/
 compgen -Q -H 0 ''
diff --git a/Completion/Commands/_most_recent_file b/Completion/Commands/_most_recent_file
index 868da8993..f8d2bd80c 100644
--- a/Completion/Commands/_most_recent_file
+++ b/Completion/Commands/_most_recent_file
@@ -1,4 +1,4 @@
-#compdef -k complete-word \C-xm
+#compdef -kn complete-word \C-xm
 
 # Complete the most recent file matching the pattern on the line so
 # far: globbing is active, i.e. *.txt will be expanded to the most recent
diff --git a/Completion/Commands/_read_comp b/Completion/Commands/_read_comp
index a32879b56..0a4f549f1 100644
--- a/Completion/Commands/_read_comp
+++ b/Completion/Commands/_read_comp
@@ -1,4 +1,4 @@
-#compdef -k complete-word \C-x\C-r
+#compdef -kn complete-word \C-x\C-r
 
 # This allows an on-the-fly choice of completions.  On typing the key
 # sequence given above, you will be prompted for a string of arguments.  If
diff --git a/Completion/Core/_main_complete b/Completion/Core/_main_complete
index af659e1d4..e71267677 100644
--- a/Completion/Core/_main_complete
+++ b/Completion/Core/_main_complete
@@ -29,10 +29,15 @@
 #
 #   local _set_options _unset_options
 #
-#   _set_options=("${(@f)$({ unsetopt kshoptionprint; setopt } 2>/dev/null)}")
-#   _unset_options=("${(@f)$({ unsetopt kshoptionprint; unsetopt } 2>/dev/null)}")
+#   if zmodload -e parameter; then
+#     _set_options=(${(k)options[(R)on]})
+#     _unset_options=(${(k)options[(R)off]})
+#   else
+#     _set_options=("${(@f)$({ unsetopt kshoptionprint; setopt } 2>/dev/null)}")
+#     _unset_options=("${(@f)$({ unsetopt kshoptionprint; unsetopt } 2>/dev/null)}")
+#   fi
 #
-# This is needed because completion function may set options locally
+# This is needed because completion functions may set options locally
 # which makes the output of setopt and unsetopt reflect a different
 # state than the global one for which you are completing.
 
diff --git a/Completion/Core/_normal b/Completion/Core/_normal
index ba7f2123f..6da653021 100644
--- a/Completion/Core/_normal
+++ b/Completion/Core/_normal
@@ -20,7 +20,11 @@ elif [[ "$command" == */* ]]; then
   cmd2="${command:t}"
 else
   cmd1="$command"
-  cmd2=$(whence -p $command)
+  if zmodload -e parameter; then
+    cmd2="$commands[$command]"
+  else
+    cmd2=$(whence -p $command)
+  fi
 fi
 
 # See if there are any matching pattern completions.
diff --git a/Completion/Core/_parameters b/Completion/Core/_parameters
index d9d8a38b2..a579e5ead 100644
--- a/Completion/Core/_parameters
+++ b/Completion/Core/_parameters
@@ -4,4 +4,9 @@
 # extra options of compadd. It completes only non-local parameters. All
 # arguments are given to compadd.
 
-compadd "$@" - "${(@)${(@)${(@)${(@f)$(typeset)}:#*local *\=*}%%\=*}##* }"
+if zmodload -e parameter; then
+  setopt localoptions extendedglob
+  compadd "$@" - ${(k)parameters[(R)^*local*]}
+else
+  compadd "$@" - ${${${(f)"$(typeset +)"}:#*local *}##* }
+fi
diff --git a/Completion/Core/compinit b/Completion/Core/compinit
index 63e4c0860..808c20f5b 100644
--- a/Completion/Core/compinit
+++ b/Completion/Core/compinit
@@ -114,7 +114,8 @@ fi
 # whose name is given as the first argument be autoloaded. When defining
 # a function for command names the `-n' option may be given and keeps
 # the definitions from overriding any previous definitions for the
-# commands.
+# commands; with `-k', the `-n' option prevents compdef from rebinding
+# a key sequence which is already bound.
 # For deleting definitions, the `-d' option must be given. Without the
 # `-p' option, this deletes definitions for functions for the commands
 # whose names are given as arguments. If combined with the `-p' option
@@ -202,6 +203,10 @@ compdef() {
 
       # And bind the keys...
       for i; do
+        if [[ -n $new ]]; then
+	   bindkey "$i" | read -A opt
+	   [[ $opt[-1] = undefined-key ]] || continue
+	fi
         bindkey "$i" "$func"
       done
       ;;
@@ -354,7 +359,7 @@ if [[ -z "$_i_done" ]]; then
       shift _i_line
       case $_i_tag in
       (\#compdef)
-	if [[ $_i_line[1] = -[pk] ]]; then
+	if [[ $_i_line[1] = -[pk](n|) ]]; then
 	  compdef ${_i_line[1]}a "${_i_file:t}" "${(@)_i_line[2,-1]}"
 	else
 	  compdef -na "${_i_file:t}" "${_i_line[@]}"
diff --git a/Completion/User/.distfiles b/Completion/User/.distfiles
index 9187fa520..1491ba653 100644
--- a/Completion/User/.distfiles
+++ b/Completion/User/.distfiles
@@ -1,6 +1,6 @@
 DISTFILES_SRC='
     .distfiles
-    _a2ps _chown _compress _configure _dd _dvi _find
+    _a2ps _bzip2 _bunzip2 _chown _compress _configure _cvs _dd _dvi _find
     _gdb _groups _gunzip _gzip
     _hosts _use_lo _make _man _mh _pdf _ps
     _rcs _rlogin _sh _strip _stty _su
diff --git a/Completion/User/_bunzip2 b/Completion/User/_bunzip2
new file mode 100644
index 000000000..f544c8c27
--- /dev/null
+++ b/Completion/User/_bunzip2
@@ -0,0 +1,3 @@
+#compdef bunzip2 bzcat
+
+_files -g '*.bz2'
diff --git a/Completion/User/_bzip2 b/Completion/User/_bzip2
new file mode 100644
index 000000000..faf9f2501
--- /dev/null
+++ b/Completion/User/_bzip2
@@ -0,0 +1,3 @@
+#compdef bzip2
+
+_files -g '*~*.bz2'
diff --git a/Completion/User/_cvs b/Completion/User/_cvs
new file mode 100644
index 000000000..4e191cecb
--- /dev/null
+++ b/Completion/User/_cvs
@@ -0,0 +1,141 @@
+#compdef cvs
+
+setopt localoptions extendedglob
+
+typeset -A commands
+commands=(add "ad new"            admin "adm rcs"         annotate ann
+          checkout "co get"       commit "ci com"         diff "di dif"
+          edit ""                 editors ""              export "exp ex"
+          history "hi his"        import "im imp"         init ""
+          log "lo rlog"           login "logon lgn"       logout ""
+          rdiff patch             release "re rel"        remove "rm delete"
+          status "st stat"        rtag "rt rfreeze"       tag "ta freeze"
+          unedit ""               update "up upd"         watch ""
+          watchers "")
+
+local com="${words[(i)(${(j:|:)${(kv)=commands}})]}"
+
+local showlist='compstate[list]=list; compstate[force_list]=yes'
+local showhint="$showlist ; compstate[insert]=''"
+local complete_D="compadd yesterday week\\ ago month\\ ago"
+local complete_k="compadd kv kvl k o b v"
+local complete_r="compadd -UX 'Enter tag name or rev number' ''; $showhint"
+local complete_m="compadd -UX 'Enter log message' -n ''; $showhint"
+
+
+if (( com < CURRENT )); then
+  case "$words[$com]" in
+    add|ad|new) # "+k:m:"
+      _complete_opts k: "$complete_k" m: "$complete_m" || _files
+      ;;
+    admin|adm|rcs) # "+ib::c:a:A:e:l::u::LUn:N:m:o:s:t::IqxV:k:"
+      _complete_opts i '' b:: '' c: '' a: '' A: '' e: '' l:: '' u:: '' L '' U '' n: '' N: '' m: "$complete_m" o: '' s: '' t:: '' I '' q '' x '' V: '' k: "$complete_k" || _files
+      ;;
+    annotate|ann) # "+lr:D:fR"
+      _complete_opts l '' r: '' D: '' f '' R '' || _files
+      ;;
+    checkout|co|get) # "+ANnk:d:flRpQqcsr:D:j:P"
+      _complete_opts A '' N '' n '' k: "$complete_k" d: '' f '' l '' R '' p '' Q '' q '' c '' s '' r: "$complete_r" D: "$complete_D" j: '' P '' || compadd MODULE
+      ;;
+    commit|ci|com) # "+nlRm:fF:r:"
+      _complete_opts n '' l '' R '' m: "$complete_m" f '' F: '' r: "$complete_r" || _files
+      ;;
+    diff|di|dif) # "+abcdefhilnpstuw0123456789BHNRC:D:F:I:L:U:V:W:k:r:"
+      _complete_opts a '' b '' c '' d '' e '' f '' h '' i '' l '' n '' p '' s '' t '' u '' w '' 0 '' 1 '' 2 '' 3 '' 4 '' 5 '' 6 '' 7 '' 8 '' 9 '' B '' H '' N '' R '' C: '' D: "$complete_D" F: '' I: '' L: '' U: '' V: '' W: '' k: "$complete_k" r: "$complete_r" || _files
+      ;;
+    edit) # "+lRa:"
+      _complete_opts l '' R '' a: '' || _files
+      ;;
+    editors) # "+lR"
+      _complete_opts l '' R '' || _files
+      ;;
+    export|exp|ex) # "+ANnk:d:flRpQqcsr:D:j:P"
+      _complete_opts A '' N '' n '' k: "$complete_k" d: '' f '' l '' R '' p '' Q '' q '' c '' s '' r: "$complete_r" D: "$complete_D" j: '' P '' || compadd MODULE
+      ;;
+    history|hi|his) # "+Tacelow?D:b:f:m:n:p:r:t:u:x:X:z:"
+      _complete_opts T '' a '' c '' e '' l '' o '' w '' \? '' D: "$complete_D" b: '' f: '' m: "$complete_m" n: '' p: '' r: '' t: '' u: '' x: '' X: '' z: '' || _files
+      ;;
+    import|im|imp) # "+Qqdb:m:I:k:W:"
+      _complete_opts Q '' q '' d '' b: '' m: "$complete_m" I: '' k: "$complete_k" W: '' || case $[CURRENT-com] in
+	1) if [[ "${+CVSROOT}" == 1 && "$CVSROOT" != :* ]]; then
+	     compgen -X "Enter repository name" -W "$CVSROOT" -g '*~*CVSROOT(/)' -s ''
+	   else
+	     compadd -UX "Enter repository name" -n '' && eval "$showhint"
+	   fi
+	   ;;
+	2) compadd -UX "Enter vendor tag name" -n '' && eval "$showhint";;
+	3) compadd -UX "Enter release tag name" -n '' && eval "$showhint";;
+	*) compadd -UX "No futher arguments used" -n '' && eval "$showhint";;
+	esac
+      ;;
+    init)
+      break
+      ;;
+    login|logon|lgn|logout)
+      _complete_opts || _files
+      ;;
+    rdiff|patch|pa) # "+V:k:cuftsQqlRD:r:"
+      _complete_opts V: '' k: "$complete_k" c '' u '' f '' t '' s '' Q '' q '' l '' R '' D: "$complete_D" r: "$complete_r" || _files
+      ;;
+    release|re|rel) # "+Qdq"
+      _complete_opts Q '' d '' q '' || _files -/
+      ;;
+    remove|rm|delete) # "+flR"
+      _complete_opts f '' l '' R '' || _files
+      ;;
+    status|st|stat) # "+vlR"
+      _complete_opts v '' l '' R '' || _files
+      ;;
+    tag|ta|freeze) # "+FQqlRcdr:D:bf"
+      _complete_opts F '' Q '' q '' l '' R '' c '' d '' r: "$complete_r" D: "$complete_D" b '' f '' || _files
+      ;;
+    unedit) # "+lR"
+      _complete_opts l '' R '' || _files
+      ;;
+    update|up|upd) # "+ApPflRQqduk:r:D:j:I:W:"
+      _complete_opts A '' p '' P '' f '' l '' R '' Q '' q '' d '' u '' k: "$complete_k" r: "$complete_r" D: "$complete_D" j: '' I: '' W: '' || _files
+      ;;
+    watch)
+      if (( CURRENT == com + 1 )); then
+        compadd on off add remove
+      else
+        case "$words[com+1]" in
+          on|off) # "+lR"
+            _complete_opts l '' R '' || _files
+            ;;
+          add|remove) # "+lRa:"
+            _complete_opts l '' R '' a: '' || _files
+            ;;
+        esac
+      fi
+      ;;
+    watchers) # "+lR"
+      _complete_opts l '' R '' || _files
+      ;;
+    *) _files;;
+  esac
+  return
+fi
+
+case ${+cvs_roots} in
+  0)
+    cvs_roots=()
+    if [[ -f ~/.cvspass ]]; then
+      cvs_roots=(
+	$(cut -d ' ' -f 1 ~/.cvspass)
+      )
+    fi
+    ;;
+esac
+
+_complete_opts \
+  H '' Q '' q '' r '' w '' l '' n '' t '' v '' f '' a '' \
+  b: "compadd /usr/local/bin" \
+  T: "compadd $TMPPREFIX:h $TMPDIR /tmp" \
+  e: "compadd vi" \
+  d: "compadd $cvs_roots || _files -/" \
+  z: "compadd 9'" \
+  s: "_cvs_user_variable" \
+ || 
+compadd ${(k)commands} ||
+compadd ${(kv)=commands}
diff --git a/Completion/User/_make b/Completion/User/_make
index 7a19484f0..e9ee7979f 100644
--- a/Completion/User/_make
+++ b/Completion/User/_make
@@ -20,5 +20,5 @@ else
 
   [[ -n "$file" ]] &&
     compadd - $(awk '/^[a-zA-Z0-9][^\/ 	]+:/ {print $1}' FS=: $file) && ret=0
-  (( ret )) && _files
+  (( ret )) && { compset -P 1 '*\='; _files }
 fi
diff --git a/Completion/User/_rlogin b/Completion/User/_rlogin
index 36ee7ffe8..03af65382 100644
--- a/Completion/User/_rlogin
+++ b/Completion/User/_rlogin
@@ -1,9 +1,15 @@
 #compdef rlogin rsh ssh
 
-if [[ CURRENT -eq 2 ]]; then
-  _hosts
+if [[ CURRENT -eq 2 ]];
+  if compset -P 1 '*@'; then
+   _hosts
+  else
+    local nm=${compstate[nmatches]}
+    _hosts
+    [[ nm -eq compstate[nmatches] ]] && compgen -S @ -u
+  fi
 elif [[ CURRENT -eq 3 ]]; then
   compadd - -l
 else
-  compgen -u
+  compgen -S @ -u
 fi
diff --git a/Completion/User/_stty b/Completion/User/_stty
index 32355be30..6e2afcde8 100644
--- a/Completion/User/_stty
+++ b/Completion/User/_stty
@@ -3,7 +3,7 @@
 if [[ "$words[CURRENT-1]" = \
   (*erase|discard|status|dsusp|intr|kill|lnext|quit|reprint|start|s*p) ]]
 then
-     compadd -Q '^-' '^h' '^?' '^c' '^u'
+     compadd '^-' '^h' '^?' '^c' '^u'
 else
   compset -P '[-+]'
   compadd rows columns intr quit erase kill eof eol \
diff --git a/Config/version.mk b/Config/version.mk
index 640fe6f8e..2be6bb57f 100644
--- a/Config/version.mk
+++ b/Config/version.mk
@@ -27,5 +27,5 @@
 # This must also serve as a shell script, so do not add spaces around the
 # `=' signs.
 
-VERSION=3.1.6-test-2
-VERSION_DATE='July 19, 1999'
+VERSION=3.1.6-test-3
+VERSION_DATE='July 24, 1999'
diff --git a/Doc/Makefile.in b/Doc/Makefile.in
index 9e70f88b1..c76083b89 100644
--- a/Doc/Makefile.in
+++ b/Doc/Makefile.in
@@ -52,13 +52,15 @@ zshoptions.1 zshparam.1 zshzftpsys.1 zshzle.1 zshall.1
 # yodl documentation
 YODLDOC = $(MAN) zsh.texi
 YODLSRC = zmacros.yo zman.yo ztexi.yo Zsh/arith.yo Zsh/builtins.yo \
-Zsh/compat.yo Zsh/compctl.yo Zsh/cond.yo Zsh/exec.yo Zsh/expn.yo \
+Zsh/compat.yo Zsh/compctl.yo Zsh/compsys.yo Zsh/compwid.yo Zsh/cond.yo \
+Zsh/exec.yo Zsh/expn.yo \
 Zsh/filelist.yo Zsh/files.yo Zsh/func.yo Zsh/grammar.yo Zsh/guide.yo \
 Zsh/index.yo Zsh/intro.yo Zsh/invoke.yo Zsh/jobs.yo Zsh/metafaq.yo \
-Zsh/modules.yo Zsh/mod_cap.yo Zsh/compwid.yo Zsh/compsys.yo \
+Zsh/modules.yo Zsh/mod_cap.yo \
 Zsh/mod_clone.yo Zsh/mod_comp1.yo Zsh/mod_compctl.yo Zsh/mod_complist.yo \
 Zsh/mod_deltochar.yo Zsh/mod_example.yo Zsh/mod_files.yo \
-Zsh/mod_mapfile.yo Zsh/mod_stat.yo Zsh/mod_zle.yo Zsh/options.yo \
+Zsh/mod_mapfile.yo Zsh/mod_parameter.yo Zsh/mod_sched.yo \
+Zsh/mod_stat.yo Zsh/mod_zftp.yo Zsh/mod_zle.yo Zsh/options.yo \
 Zsh/params.yo Zsh/prompt.yo Zsh/redirect.yo Zsh/restricted.yo \
 Zsh/seealso.yo Zsh/zftpsys.yo Zsh/zle.yo
 
@@ -83,7 +85,7 @@ zsh.texi: zsh.yo
 	  */*) target=$@ ;; \
 	  *) target=$(sdir)/$@ ;; \
 	esac; \
-	$(YODL) -o $$target -I$(sdir) -w zman.yo version.yo $< || exit 1; \
+	$(YODL) -I$(sdir) -w zman.yo version.yo $< | sed -e '1s/\\-/-/g' -e '/^\.'\''/d' > $$target || exit 1; \
 	test -f $$target
 
 zsh_us.ps: zsh.dvi
@@ -100,7 +102,7 @@ zshall.1: zsh.yo
 	  */*) target=$@ ;; \
 	  *) target=$(sdir)/$@ ;; \
 	esac; \
-	$(YODL) -o $$target -I$(sdir) -DZSHALL -w zman.yo version.yo zsh.yo || exit 1; \
+	$(YODL) -I$(sdir) -DZSHALL -w zman.yo version.yo zsh.yo | sed -e '1s/\\-/-/g' -e '/^\.'\''/d' > $$target || exit 1; \
 	test -f $$target
 
 ../META-FAQ: META-FAQ.yo Zsh/metafaq.yo
diff --git a/Doc/Zsh/arith.yo b/Doc/Zsh/arith.yo
index 80c023301..bb91b6fe9 100644
--- a/Doc/Zsh/arith.yo
+++ b/Doc/Zsh/arith.yo
@@ -7,12 +7,11 @@ cindex(arithmetic evaluation)
 cindex(evaluation, arithmetic)
 findex(let, use of)
 The shell can perform integer arithmetic, either using the builtin tt(let),
-or via a substitution of the form tt($((...))).  Usually arithmetic is
-performed with em(long) integers; however, on certain systems where a
-em(long) has 4-byte precision, zsh may be compiled to use 8-byte precision
-instead.  This can be tested, for example, by giving the command
-`tt(print - $(( 12345678901 )))'; if the number appears unchanged, the
-precision is at least 8 bytes.
+or via a substitution of the form tt($((...))).  The shell is usually
+compiled to use 8-byte precision where this is available, otherwise
+precision is 4 bytes.  This can be tested, for example, by giving the
+command `tt(print - $(( 12345678901 )))'; if the number appears unchanged,
+the precision is at least 8 bytes.
 
 The tt(let) builtin command takes arithmetic expressions as arguments; each
 is evaluated separately.  Since many of the arithmetic operators, as well
@@ -85,7 +84,7 @@ Named parameters and subscripted arrays can be referenced by name within an
 arithmetic expression without using the parameter expansion syntax.  For
 example,
 
-example((((val2 = val1 * 2))))
+example(((val2 = val1 * 2)))
 
 assigns twice the value of tt($val1) to the parameter named tt(val2).
 
diff --git a/Doc/Zsh/builtins.yo b/Doc/Zsh/builtins.yo
index f6e24ab51..2f1f37258 100644
--- a/Doc/Zsh/builtins.yo
+++ b/Doc/Zsh/builtins.yo
@@ -39,7 +39,8 @@ cindex(expanding parameters)
 cindex(parameters, expanding)
 cindex(doing nothing)
 item(tt(:) [ var(arg) ... ])(
-This command only expands parameters.  A zero exit code is returned.
+This command does nothing, although normal argument expansions is performed
+which may have effects on shell parameters.  A zero exit code is returned.
 )
 findex(alias)
 cindex(aliases, defining)
@@ -161,8 +162,8 @@ causes tt(disable) to act on aliases.  The tt(-f) option causes
 tt(disable) to act on shell functions.  The tt(-r) options causes
 tt(disable) to act on reserved words.  Without arguments all disabled
 hash table elements from the corresponding hash table are printed.
-With the tt(-m) flag the arguments are taken as patterns (should be
-quoted to preserve them from being taken as glob patterns), and all hash
+With the tt(-m) flag the arguments are taken as patterns (which should be
+quoted to prevent them from undergoing filename expansion), and all hash
 table elements from the corresponding hash table matching these patterns
 are disabled.  Disabled objects can be enabled with the tt(enable)
 command.
@@ -221,7 +222,16 @@ item(tt(emulate) [ tt(-LR) ] {tt(zsh)|tt(sh)|tt(ksh)|tt(csh)})(
 Set up zsh options to emulate the specified shell as much as possible.
 bf(csh) will never be fully emulated.
 If the argument is not one of the shells listed above, tt(zsh)
-will be used as a default.  If the tt(-R) option is given, all options
+will be used as a default; more precisely, the tests performed on the
+argument are the same as those used to determine the emulation at startup
+based on the shell name, see
+ifzman(\
+the section `Compatibility' in zmanref(zshmisc)
+)\
+ifnzman(\
+noderef(Compatibility)
+)\
+.  If the tt(-R) option is given, all options
 are reset to their default value corresponding to the specified emulation
 mode, except for certain options describing the interactive
 environment; otherwise, only those options likely to cause portability
@@ -407,7 +417,7 @@ and for the named directory hash table this adds all users' home directories.
 These two options cannot be used with any arguments.
 
 The tt(-m) option causes the arguments to be taken as patterns
-(they should be quoted) and the elements of the hash table
+(which should be quoted) and the elements of the hash table
 matching those patterns are printed.  This is the only way to display
 a limited selection of hash table elements.
 
@@ -603,8 +613,8 @@ item(tt(-O))(
 Print the arguments sorted in descending order.
 )
 item(tt(-i))(
-If given together with tt(-o) or tt(-O), makes them work case
-independently.
+If given together with tt(-o) or tt(-O), sorting is performed
+case-independently.
 )
 item(tt(-c))(
 Print the arguments in columns.
@@ -810,8 +820,8 @@ Set the options for the shell.  All options specified either
 with flags or by name are set.  If no arguments are supplied,
 the names of all options currently set are printed.
 If the tt(-m) flag is given the arguments are taken as patterns
-(which should be quoted to preserve them from being interpreted as glob
-patterns), and all options with names matching these patterns are set.
+(which should be quoted to protect them from filename expansion), and all
+options with names matching these patterns are set.
 )
 findex(shift)
 cindex(parameters, positional)
@@ -882,7 +892,7 @@ For example,
 
 example(trap 'print $LINENO' DEBUG)
 
-will print the line number of command executed after it has run, while
+will print the line number of a command executed after it has run, while
 
 example(TRAPDEBUG() { print $LINENO; })
 
@@ -931,7 +941,7 @@ retain their special attributes when made local.
 
 For each var(name)tt(=)var(value) assignment, the parameter
 var(name) set to var(value).  Note that arrays currently cannot be
-assigned in tt(typeset) expressions; scalars and integers only.
+assigned in tt(typeset) expressions, only scalars and integers.
 
 For each remaining var(name) that refers to a parameter that is set, the
 name and value of the parameter are printed in the form of an assignment.
@@ -968,9 +978,9 @@ those parameters that have the specified attributes, and using `tt(PLUS())'
 rather than `tt(-)' to introduce the flag suppresses printing of the values
 of parameters when there is no parameter name.  Also, if the option list
 ends with `tt(PLUS())', values will not be printed.  If only the tt(-m)
-flag is given the arguments are taken as patterns (should be quoted) and
-all parameters (or functions with the tt(-f) flag) with matching names are
-printed.  If no attribute flags and no tt(-m) flag is present, the
+flag is given the arguments are taken as patterns (which should be quoted)
+and all parameters (or functions with the tt(-f) flag) with matching names
+are printed.  If no attribute flags and no tt(-m) flag is present, the
 parameter names will be preceded by a list of any attributes (tt(array),
 tt(association), tt(exported), tt(integer), tt(readonly)).
 
diff --git a/Doc/Zsh/compctl.yo b/Doc/Zsh/compctl.yo
index 8f7c23f25..eaf257660 100644
--- a/Doc/Zsh/compctl.yo
+++ b/Doc/Zsh/compctl.yo
@@ -317,7 +317,7 @@ item(tt(-i) var(function))(
 Like tt(-K), but the function is invoked in a context like that for
 completion widgets, see 
 ifzman(zmanref(zshzle))\
-ifnzman(noderef(The zle Module))\
+ifnzman(noderef(The zle Module))
 for more information.
 )
 item(tt(-H) var(num pattern))(
@@ -422,7 +422,7 @@ tt(-K) option) which can examine the word components passed to it
 (or via the tt(read) builtin's tt(-c) and tt(-l) flags) and
 use its own criteria to decide what matches.  If there is no
 completion, the original word is retained.  Since the produced 
-possible completions seldom seldom have interesting common prefixes
+possible completions seldom have interesting common prefixes
 and suffixes, menucompletion is started immediately if tt(AUTO_MENU) is
 set and this flag is used.
 )
@@ -513,7 +513,7 @@ before all variables.
 item(tt(-V) var(name))(
 Like tt(-J), but matches within the group will not be sorted in listings
 nor in menucompletion. These unsorted groups are in a different name
-space than the sorted ones, so groups defined as tt(-J files) and tt(-V
+space from the sorted ones, so groups defined as tt(-J files) and tt(-V
 files) are distinct.
 )
 item(tt(-M) var(match-spec))(
diff --git a/Doc/Zsh/compsys.yo b/Doc/Zsh/compsys.yo
index cca636cdc..29f83da4a 100644
--- a/Doc/Zsh/compsys.yo
+++ b/Doc/Zsh/compsys.yo
@@ -1,6 +1,6 @@
 texinode(Completion System)(Zftp Function System)(Zsh Modules)(Top)
 chapter(Completion System)
-cindex(completion, system)
+cindex(completion system)
 cindex(completion, programmable)
 cindex(completion, controlling)
 sect(Description)
@@ -22,6 +22,8 @@ endmenu()
 
 texinode(Initialization)(Control Functions)()(Completion System)
 sect(Initialization)
+findex(compinstall)
+cindex(completion system, installing)
 
 The function tt(compinstall) can be run by a user to set up the completion
 system for use, which also provides options for more advanced usage.
@@ -60,6 +62,8 @@ Should you need to, you can still bind keys to the old functions by putting
 a `tt(.)' in front, e.g. `tt(.expand-or-complete)'.
 
 subsect(Use of compinit)
+findex(compinit)
+cindex(completion system, initializing)
 
 This section describes the use of tt(compinit) to initialize completion for
 the current session when run directly by the user; if you have run
@@ -77,9 +81,9 @@ configuration which will be read in on future invocations; this is the
 default, although it can be turned off by calling tt(compinit) with the
 option tt(-D).  The dumped file is tt(.zcompdump) in the same
 directory as the startup files (i.e. tt($ZDOTDIR) or tt($HOME));
-alternatively, an explicit file name can be given following the option
-tt(-d).  On the next call to tt(compinit -d), the dumped file will be read
-instead.
+alternatively, an explicit file name can be given by `tt(compinit -d)
+var(dumpfile)'.  On the next call to tt(compinit), the dumped file will be
+read instead of a full initialization.
 
 If the number of completion files changes, tt(compinit) will recognise this
 and produce a new dump file.  However, if the name of a function or the
@@ -97,6 +101,7 @@ where completion functions can be found; this is only necessary if they are
 not already in the function search path.
 
 subsect(Autoloaded files)
+cindex(completion system, autoloaded functions)
 
 The convention for autoloaded functions used in completion is that they
 start with an underscore; as already mentioned, the tt(fpath/FPATH)
@@ -146,7 +151,9 @@ tt(menu-expand-or-complete), or tt(reverse-menu-complete). If the
 tt(complist) module is loaded (see
 ifzman(zmanref(zshmodules))\
 ifnzman(noderef(The complist Module))\
-), the tt(menu-select) widget can be used, too.
+), the tt(menu-select) widget can be used, too.  If the option tt(-n) is
+also given, the bindings will not be used if the key is already bound (that
+is, is bound to something other than tt(undefined-key)).
 
 The widget is then bound to all the var(key-sequences) given, if any: when
 one of the var(key-sequences) is typed, the function in the file will
@@ -172,6 +179,8 @@ subsect(Functions)
 The tt(compinit) file defines the following functions, which may
 also be called directly by the user.
 
+findex(compdef)
+cindex(completion system, adding definitions)
 startitem()
 xitem(tt(compdef) [ tt(-an) ] var(function names...))
 xitem(tt(compdef -d) var(names...))
@@ -195,15 +204,21 @@ and will otherwise behave like the builtin widget whose name is given as
 the var(style) argument. The widgets usable for this are:
 tt(complete-word), tt(delete-char-or-list), tt(expand-or-complete),
 tt(expand-or-complete-prefix), tt(list-choices), tt(menu-complete),
-tt(menu-expand-or-complete), and tt(reverse-menu-complete).
+tt(menu-expand-or-complete), and tt(reverse-menu-complete), as well as
+tt(menu-select) if the tt(complist) module is loaded.  The option tt(-n)
+prevents the key being bound if it is already to bound to something other
+than tt(undefined-key).
 
 In each of the forms supporting it the tt(-a) option makes the
 var(function) autoloadable (exactly equivalent to
 tt(autoload )var(function)).
 )
+findex(compconf)
+cindex(completion system, configuring)
 xitem(tt(compconf) var(definitions...))
 xitem(tt(compconf) [ tt(-L) ] )
 item(tt(compconf) [ tt(-l) ] [ tt(-L) ] var(keys...))(
+vindex(compconfig)
 Several aspects of the completion system can be configured by the
 user. The configuration values are stored under the keys described
 below in the associative array `tt(compconfig)'.  After sourcing
@@ -228,6 +243,7 @@ enditem()
 
 texinode(Control Functions)(Completion Functions)(Initialization)(Completion System)
 sect(Control Functions)
+cindex(completion system, choosing completers)
 
 The initialization script tt(compinit) redefines all the widgets
 which perform completion to call the supplied widget
@@ -257,6 +273,7 @@ argument was given.
 The following completer functions are contained in the distribution (users
 may write their own):
 
+cindex(completion system, completers)
 startitem()
 item(tt(_complete))(
 This completer generates all possible completions in a context-sensitive
@@ -587,7 +604,7 @@ otherwise, the standard completion list will be generated:  this is the
 default behaviour of tt(_oldlist). However, if there is an old list
 and this key contains the name of the completer function that
 generated the list, then the old list will be used even if it was
-generated by a widget which does not listing.
+generated by a widget which does not do listing.
 
 For example, suppose you type tt(^Xc) to use the tt(_correct_word)
 widget, which generates a list of corrections for the word under the
@@ -606,7 +623,7 @@ matches generated on the first attempt will be used again.
 )
 item(tt(oldlist_menu))(
 Controls how menu completion behaves when a completion has already been
-inserted and the user types a standard completion key type as tt(TAB).
+inserted and the user types a standard completion key type such as tt(TAB).
 The default behaviour of tt(_oldlist) is that menu completion always
 continues with the existing list of completions.  If this key is set to
 tt(never), however, a new completion is started if the old list was
@@ -625,6 +642,7 @@ enditem()
 
 texinode(Completion Functions)(Completion Directories)(Control Functions)(Completion System)
 sect(Utility Functions)
+cindex(completion system, utility functions)
 
 Descriptions follow for utility functions that may be
 useful when writing completion functions.  Most of these reside in the
@@ -798,6 +816,7 @@ enditem()
 
 texinode(Completion Directories)(Bindable Commands)(Completion Functions)(Completion System)
 sect(Completion Directories)
+cindex(completion system, directory structure)
 
 In the source distribution, the files are contained in various
 subdirectories of the tt(Completion) directory.  They may have been
@@ -832,6 +851,7 @@ enditem()
 
 texinode(Bindable Commands)()(Completion Directories)(Completion System)
 sect(Bindable Commands)
+cindex(completion system, bindable commands)
 
 In addition to the context-dependent completions provided, which are
 expected to work in an intuitively obvious way, there are a few widgets
@@ -841,8 +861,9 @@ following is a list of these and their default bindings.
 startitem()
 item(tt(_correct_filename (^XC)))(
 Correct the filename path at the cursor position.  Allows up to six errors
-in the name.  Can also be correctly called with an argument to correct
-a filepath, independently of zle.
+in the name.  Can also be called with an argument to correct
+a filepath, independently of zle; the correction is printed on standard
+output.
 )
 item(tt(_correct_word) (^Xc))(
 Performs correction of the current argument using the usual contextual
diff --git a/Doc/Zsh/compwid.yo b/Doc/Zsh/compwid.yo
index 62c243740..2497eb768 100644
--- a/Doc/Zsh/compwid.yo
+++ b/Doc/Zsh/compwid.yo
@@ -51,20 +51,24 @@ within the completion widget) to the values they had when the function was
 entered.
 
 startitem()
+vindex(words)
 item(tt(words))(
 This array contains the words present on the command line currently being
 edited.
 )
+vindex(CURRENT)
 item(tt(CURRENT))(
 This is the number of the current word, i.e. the word the cursor is
 currently on in the tt(words) array.  Note that this value is only
 correct if the tt(ksharrays) options is not set.
 )
+vindex(PREFIX)
 item(tt(PREFIX))(
 Initially this will be set to the part of the current word from the
 beginning of the word up to the position of the cursor; it may be altered
 to give a common prefix for all matches.
 )
+vindex(IPREFIX)
 item(tt(IPREFIX))(
 Initially this will be set to the empty string.  It functions like
 tt(PREFIX), and gives a string which precedes the one in tt(PREFIX) and is
@@ -76,8 +80,10 @@ example(IPREFIX=${PREFIX%%\=*}=
 PREFIX=${PREFIX#*=})
 
 causes the part of the prefix up to and including the first equal sign not
-to be treated as part of a matched string.
+to be treated as part of a matched string.  This can be done automatically
+by the tt(compset) builtin, see below.
 )
+vindex(QIPREFIX)
 item(tt(QIPREFIX))(
 This parameter is read-only and contains the quoted string up to the
 word being completed. E.g. when completing `tt("foo)', this parameter
@@ -85,6 +91,7 @@ contains the double quote. If the tt(-q) option of tt(compset) is used
 (see below), and the original string was `tt("foo bar)' with the
 cursor on the `tt(bar)', this parameter contains `tt("foo )'.
 )
+vindex(SUFFIX)
 item(tt(SUFFIX))(
 Initially this will be set to the part of the current word from the
 cursor position to the end; it may be altered to give a common suffix for
@@ -92,14 +99,18 @@ all matches.  It is most useful when the option tt(COMPLETE_IN_WORD) is
 set, as otherwise the whole word on the command line is treated as a
 prefix.
 )
+vindex(ISUFFIX)
 item(tt(ISUFFIX))(
 As tt(IPREFIX), but for a suffix that should not be considered part
 of the matches; note that the tt(ISUFFIX) string follows the tt(SUFFIX)
 string.
 )
+vindex(QISUFFIX)
 item(tt(QISUFFIX))(
 Like tt(QIPREFIX), but containing the suffix.
 )
+vindex(compstate)
+cindex(completion widgets, examining and setting state in)
 item(tt(compstate))(
 This is an associative array with various keys and values that the
 completion code uses to exchange information with the completion widget.
@@ -212,7 +223,7 @@ would normally cause them to be.  It will be set appropriately on entry to
 a completion widget and may be changed there.
 )
 item(tt(force_list))(
-If the value for the tt(list) key is tt(ambiguous), the list will
+If the value for the tt(list) key is tt(autolist) or tt(ambiguous), the list will
 normally be shown only if there are at least two matches in the
 list. Setting tt(force_list) to an non-empty string forces the list to be
 shown even if there is only one match.
@@ -236,7 +247,8 @@ matches is to be inserted; if set to tt(menu) or tt(automenu) the usual
 behaviour of the tt(MENU_COMPLETE) or tt(AUTO_MENU) options, respectively,
 is to be used.
 
-On exit it may be set to any of the values above, or to a number, in which
+On exit it may be set to any of the values above (where setting it to
+the empty string is the same as unsetting it), or to a number, in which
 case the match whose number is given will be inserted into the command line.
 It may also be set to a string of the form `var(group):var(match)' which
 specifies a match from a group of matches to be inserted, counting from 1
@@ -326,6 +338,7 @@ enditem()
 texinode(Builtin Commands)(Condition Codes)(Special Parameters)(Completion Widgets)
 sect(Builtin Commands)
 startitem()
+cindex(completion widgets, generating matches with flags)
 findex(compgen)
 item(tt(compgen) var(flags ...))(
 
@@ -351,6 +364,8 @@ builtin command.
 The return value is zero if at least one match was added and non-zero
 otherwise.
 )
+findex(compadd)
+cindex(completion widgets, adding specified matches)
 xitem(tt(compadd) [ tt(-qQfnUam) ] [ tt(-F) var(array) ])
 xitem([ tt(-P) var(prefix) ] [ tt(-S) var(suffix) ])
 xitem([ tt(-p) var(hidden-prefix) ] [ tt(-s) var(hidden-suffix) ])
@@ -556,6 +571,8 @@ hyphens.
 )
 enditem()
 )
+findex(compset)
+cindex(completion widgets, modifying special parameters)
 xitem(tt(compset -p) var(number))
 xitem(tt(compset -P) [ var(number) ] var(pattern))
 xitem(tt(compset -s) var(number))
@@ -662,6 +679,7 @@ enditem()
 
 texinode(Condition Codes)(Examples)(Builtin Commands)(Completion Widgets)
 sect(Condition Codes)
+cindex(completion widgets, condition codes)
 
 The following additional condition codes for use within the tt([[ ... ]])
 construct are available in completion widgets.  These work on the special
@@ -687,6 +705,7 @@ enditem()
 
 texinode(Examples)()(Condition Codes)(Completion Widgets)
 sect(Examples)
+cindex(completion widgets, examples)
 
 The first step is to define the widget:
 
@@ -711,3 +730,4 @@ source code distribution, see
 ifzman(zmanref(zshcompsys))\
 ifnzman(noderef(Completion System))\
 .
+
diff --git a/Doc/Zsh/cond.yo b/Doc/Zsh/cond.yo
index 0ff49b187..b24ebebc8 100644
--- a/Doc/Zsh/cond.yo
+++ b/Doc/Zsh/cond.yo
@@ -149,6 +149,20 @@ true if either var(exp1) or var(exp2) is true.
 )
 enditem()
 
+Normal shell expansion is performed on the var(file), var(string) and
+var(pattern) arguments, but the result of each expansion is constrained to
+be a single word, similar to the effect of double quotes.  However, pattern
+metacharacters are active for the var(pattern) arguments; the patterns
+are the same as those used for filename generation, see
+ifzman(\
+zmanref(zshexpn)
+)\
+ifnzman(\
+noderef(Filename Generation)
+)\
+, but there is no special behaviour
+of `tt(/)' nor initial dots, and no glob qualifiers are allowed.
+
 In each of the above expressions, if
 var(file) is of the form `tt(/dev/fd/)var(n)',
 where var(n) is an integer,
@@ -156,3 +170,14 @@ then the test applied to the open file whose
 descriptor number is var(n),
 even if the underlying system does not support
 the tt(/dev/fd) directory.
+
+In the forms which do numeric comparison, the expressions var(exp)
+undergo arithmetic expansion as if they were enclosed in tt($((...))).
+
+For example, the following:
+
+example([[ ( -f foo || -f bar ) && $report = y* ]] && print File exists.)
+
+tests if either file tt(foo) or file tt(bar) exists, and if so, if the
+value of the parameter tt(report) begins with `tt(y)'; if the complete
+condition is true, the message `tt(File exists.)' is printed.
diff --git a/Doc/Zsh/expn.yo b/Doc/Zsh/expn.yo
index bb75d4865..7eae493e0 100644
--- a/Doc/Zsh/expn.yo
+++ b/Doc/Zsh/expn.yo
@@ -185,9 +185,10 @@ resulting word doesn't change any more.
 item(tt(F:)var(expr)tt(:))(
 Like tt(f), but repeats only var(n) times if the expression
 var(expr) evaluates to var(n).  Any character can be used instead of
-the `tt(:)', if any of `tt(LPAR())', `tt([)', or `tt({)'
-is used as the opening delimiter
-the second one has to be 'tt(RPAR())', `tt(])', or `tt(})' respectively.
+the `tt(:)'; if `tt(LPAR())', `tt([)', or `tt({)'
+is used as the opening delimiter,
+the closing delimiter should be 'tt(RPAR())', `tt(])', or `tt(})',
+respectively.
 )
 item(tt(w))(
 Makes the immediately following modifier work on each word in the
@@ -246,7 +247,8 @@ will refer to the first and last words respectively, of the last command
 referenced on the current command line.  However, if they are the first history
 reference on the command line, then they refer to the previous command.
 
-The character sequence `tt(^)var(foo)tt(^)var(bar)'
+The character sequence `tt(^)var(foo)tt(^)var(bar)' (where `tt(^)' is
+actually the second charcter of the tt(histchars) parameter)
 repeats the last command, replacing the string var(foo) with var(bar).
 More precisely, the sequence `tt(^)var(foo)tt(^)var(bar)tt(^)' is
 synonymous with `tt(!!:s)tt(^)var(foo)tt(^)var(bar)tt(^)', hence other
@@ -290,7 +292,7 @@ Note that the file, which is passed as an argument to the command,
 is a system pipe, so programs that expect to lseek (see manref(lseek)(2))
 on the file will not work.
 Also note that the previous example can be more compactly and
-efficiently written as:
+efficiently written (provided the tt(MULTIOS) option is set) as:
 
 nofill(tt(paste <LPAR()cut -f1) var(file1)tt(RPAR() <LPAR()cut -f3) var(file2)tt(RPAR() > >LPAR())var(process1)tt(RPAR() > >LPAR())var(process2)tt(RPAR()))
 
@@ -320,7 +322,7 @@ and subscript notation to access individual array elements.
 
 In the expansions discussed below that require a pattern, the form of
 the pattern is the same as that used for filename generation;
-see noderef(Filename Generation).  Note that this pattern, along with
+see noderef(Filename Generation).  Note that these patterns, along with
 the replacement text of any substitutions, are themselves subject to
 parameter expansion, command substitution, and arithmetic expansion.
 In addition to the following operations, the file modifiers described in
@@ -340,11 +342,12 @@ modifiers appearing after the name, or any of the characters `tt(^)',
 `tt(=)', `tt(~)', `tt(#)' or `tt(+)' appearing before the name, all of
 which work with or without braces.
 
-If var(name) is an array parameter, then the value of each
-element of var(name) is substituted, one element per word.
-Otherwise, the expansion results in one word only; no field
-splitting is done on the result unless the tt(SH_WORD_SPLIT)
-option is set.
+If var(name) is an array parameter, and the tt(KSH_ARRAYS) option is not
+set, then the value of each
+element of var(name) is substituted, one element per word.  Otherwise, the
+expansion results in one word only; with tt(KSH_ARRAYS), this is the first
+element of an array.  No field splitting is done on the result unless the
+tt(SH_WORD_SPLIT) option is set.
 )
 item(tt(${PLUS())var(name)tt(}))(
 If var(name) is the name of a set parameter `tt(1)' is substituted,
@@ -363,9 +366,9 @@ set var(name) to var(word).  In both forms, the value of
 the parameter is then substituted.
 )
 item(tt(${)var(name)tt(:?)var(word)tt(}))(
-If var(name) is set and is non-null, then substitute
+If var(name) is set and is non-null then substitute
 its value; otherwise, print var(word) and exit from the shell.
-Interactive shells do not exit.
+Interactive shells instead return to the prompt.
 If var(word) is omitted, then a standard message is printed.
 )
 item(tt(${)var(name)tt(:PLUS())var(word)tt(}))(
@@ -413,8 +416,8 @@ remove the non-matched elements).
 )
 xitem(tt(${)var(name)tt(/)var(pattern)tt(/)var(repl)tt(}))
 item(tt(${)var(name)tt(//)var(pattern)tt(/)var(repl)tt(}))(
-Replace by string var(repl), the longest possible match of
-var(pattern) in the expansion of parameter var(name).  The first form
+Replace the longest possible match of var(pattern) in the expansion of
+parameter var(name) by string var(repl).  The first form
 replaces just the first occurrence, the second form all occurrences.
 The var(pattern) may begin with a `tt(#)', in which case the
 var(pattern) must match at the start of the string, or `tt(%)', in
@@ -534,8 +537,8 @@ If this flag is repeated (as in tt(AA)), create an associative
 array parameter.  Assignment is made before sorting or padding.
 The var(name) part may be a subscripted range for ordinary
 arrays; the var(word) part em(must) be converted to an array, for
-example by using tt(${(AA)=)...tt(}) to activate word splitting,
-when creating an associative array.
+example by using tt(${(AA)=)var(name)tt(=)...tt(}) to activate word
+splitting, when creating an associative array.
 )
 item(tt(@))(
 In double quotes, array elements are put into separate words.
@@ -548,13 +551,12 @@ em(arithmetic expansion) on the result. Such expansions can be
 nested but too deep recursion may have unpredictable effects.
 )
 item(tt(P))(
-This makes the value of the parameter var(name) be taken as a
-parameter name on which to work. If it is used with a tt(${)...tt(})
-type parameter expression or a tt($LPAR())...tt(RPAR()) type command
-substitution in place of the parameter name this flag makes the result
-of the expansion be taken as a parameter name which is then
-used. E.g. if you have `tt(foo=bar)' and `tt(bar=baz)', the strings
-tt(${(P)foo}) and tt(${(P)${foo}}) will be expanded to `tt(baz)'.
+This forces the value of the parameter var(name) to be interpreted as a
+further parameter name, whose value will be used where appropriate. If used
+with a nested parameter or command substitution, the result of that will be
+taken as a parameter name in the same way.  For example, if you have
+`tt(foo=bar)' and `tt(bar=baz)', the strings tt(${(P)foo}),
+tt(${(P)${foo}}), and tt${(P)$(echo bar)} will be expanded to `tt(baz)'.
 )
 item(tt(o))(
 Sort the resulting words in ascending order.
@@ -637,41 +639,44 @@ Split the result of the expansion to lines. This is a shorthand
 for `tt(ps:\n:)'.
 )
 item(tt(t))(
-Don't work on the value of the parameter, but on a string describing
-the type of the parameter. This string consists of keywords separated
-by hyphens (`tt(-)'). The first keyword in the string describes the
-main type, it can be one of `tt(scalar)', `tt(array)', `tt(integer)',
+Use a string describing the type of the parameter where the value
+of the parameter would usually appear. This string consists of keywords
+separated by hyphens (`tt(-)'). The first keyword in the string describes
+the main type, it can be one of `tt(scalar)', `tt(array)', `tt(integer)',
 or `tt(association)'. The other keywords describe the type in more
 detail:
 
 startitem()
-item(`tt(left)')(
+item(tt(local))(
+for local parameters
+)
+item(tt(left))(
 for left justified parameters
 )
-item(`tt(right_blanks)')(
+item(tt(right_blanks))(
 for right justified parameters with leading blanks
 )
-item(`tt(right_zeros)')(
+item(tt(right_zeros))(
 for right justified parameters with leading zeros
 )
-item(`tt(lower)')(
+item(tt(lower))(
 for parameters whose value is converted to all lower case when it is
 expanded
 )
-item(`tt(upper)')(
+item(tt(upper))(
 for parameters whose value is converted to all upper case when it is
 expanded
 )
-item(`tt(readonly)')(
+item(tt(readonly))(
 for readonly parameters
 )
-item(`tt(tag)')(
+item(tt(tag))(
 for tagged parameters
 )
-item(`tt(export)')(
+item(tt(export))(
 for exported parameters
 )
-item(`tt(unique)')(
+item(tt(unique))(
 for arrays which keep only the first occurrence of duplicated values
 )
 enditem()
@@ -809,7 +814,7 @@ enditem()
 
 subsect(Examples)
 The flag tt(f) is useful to split a double-quoted substitution line by
-line.  For example, tt("${(f)$LPAR()<)var(file)tt(RPAR()}")
+line.  For example, tt(${(f)"$LPAR()<)var(file)tt(RPAR()"})
 substitutes the contents of var(file) divided so that each line is
 an element of the resulting array.  Compare this with the effect of
 tt($)tt(LPAR()<)var(file)tt(RPAR()) alone, which divides the file
@@ -1077,8 +1082,8 @@ Match anything that matches the pattern var(x) but does not match var(y).
 This has lower precedence than any operator except `tt(|)', so
 `tt(*/*~foo/bar)' will search for all files in all directories in `tt(.)'
 and then exclude `tt(foo/bar)' if there was such a match.
-It groups left-to-right, so multiple patterns can be excluded by
-`var(foo)tt(~)var(bar)tt(~)var(baz)'.
+Multiple patterns can be excluded by
+`var(foo)tt(~LPAR())var(bar)tt(|)var(baz)tt(RPAR())'.
 In the exclusion pattern (var(y)), `tt(/)' and `tt(.)' are not treated
 specially the way they usually are in globbing.
 )
@@ -1124,8 +1129,8 @@ subsect(Globbing Flags)
 There are various flags which affect any text to their right up to the
 end of the enclosing group or to the end of the pattern; they require
 the tt(EXTENDED_GLOB) option. All take the form
-tt(LPAR()#)var(X)tt(RPAR()) where var(X) may be one of the following
-characters:
+tt(LPAR()#)var(X)tt(RPAR()) where var(X) may have one of the following
+forms:
 
 startitem()
 item(i)(
@@ -1194,7 +1199,7 @@ in character ranges: hence tt(LPAR()#a1)tt(RPAR()???)  matches strings of
 length four, by applying rule 4 to an empty part of the pattern, but not
 strings of length two, since all the tt(?) must match.  Other characters
 which must match exactly are initial dots in filenames (unless the
-tt(GLOB_DOTS) option is set), and all slashes in file names, so that
+tt(GLOB_DOTS) option is set), and all slashes in filenames, so that
 tt(a/bc) is two errors from tt(ab/c) (the slash cannot be transposed with
 another character).  Similarly, errors are counted separately for
 non-contiguous strings in the pattern, so that tt(LPAR()ab|cd)tt(RPAR()ef)
@@ -1353,7 +1358,7 @@ Thus, `tt(*(f70?))' gives the files for which the owner has read,
 write, and execute permission, and for which other group members have
 no rights, independent of the permissions for other users. The pattern
 `tt(*(f-100))' gives all files for which the owner does not have
-execute permission, and `tt(*(f:gu+w,o-rx))' gives the files for which 
+execute permission, and `tt(*(f:gu+w,o-rx:))' gives the files for which 
 the owner and the other members of the group have at least write
 permission, and for which other users don't have read or execute
 permission.
@@ -1421,7 +1426,7 @@ sets the tt(MARK_DIRS) option for the current pattern
 pindex(MARK_DIRS, setting in pattern)
 )
 item(tt(T))(
-appends a trailing qualifier mark to the file names, analogous to the
+appends a trailing qualifier mark to the filenames, analogous to the
 tt(LIST_TYPES) option, for the current pattern (overrides tt(M))
 )
 item(tt(N))(
@@ -1434,16 +1439,15 @@ pindex(GLOB_DOTS, setting in pattern)
 )
 item(tt(o)var(c))(
 specifies how the names of the files should be sorted. If var(c) is
-tt(n) they are sorted by name (the default), if var(c) is tt(L) they
-are sorted depending on the size (length) of the files, tt(l) makes
-them be sorted by the number of links, and tt(a), tt(m), and tt(c)
-make them be sorted by the time of the last access, modification, and
+tt(n) they are sorted by name (the default), if it is tt(L) they
+are sorted depending on the size (length) of the files, if tt(l) 
+they are sorted by the number of links, and if tt(a), tt(m), and tt(c)
+they are sorted by the time of the last access, modification, or
 inode change respectively. Note that tt(a), tt(m), and tt(c) compare
-the age to the current time, so the first name in the list is the 
-one of the youngest file. Also note that the modifiers tt(^) and tt(-) are 
+the age against the current time, hence the first name in the list is the 
+the youngest file. Also note that the modifiers tt(^) and tt(-) are 
 used, so `tt(*(^-oL))' gives a list of all files sorted by file size in 
-descending order working not on symbolic links but on the files they
-point to.
+descending order, following any symbolic links.
 )
 item(tt(O)var(c))(
 like `tt(o)', but sorts in descending order; i.e. `tt(*(^oc))' is the
diff --git a/Doc/Zsh/files.yo b/Doc/Zsh/files.yo
index 54fa800dc..df2ae8d35 100644
--- a/Doc/Zsh/files.yo
+++ b/Doc/Zsh/files.yo
@@ -11,9 +11,10 @@ Commands are first read from tt(/etc/zshenv); this cannot be overridden.
 Subsequent behaviour is modified by the tt(RCS) and
 tt(GLOBAL_RCS) options; the former affects all startup files, while the
 second only affects those in the tt(/etc) directory.  If one of the options
-is unset at any point, the corresponding startup file(s) will not be read.
-It is also possible for a file in tt($ZDOTDIR) to re-enable
-tt(GLOBAL_RCS). Both tt(RCS) and tt(GLOBAL_RCS) are set by default.
+is unset at any point, any subsequent startup file(s) of the corresponding
+type will not be read.  It is also possible for a file in tt($ZDOTDIR) to
+re-enable tt(GLOBAL_RCS). Both tt(RCS) and tt(GLOBAL_RCS) are set by
+default.
 
 Commands are then read from tt($ZDOTDIR/.zshenv).
 pindex(LOGIN, use of)
@@ -37,5 +38,11 @@ saved.
 If tt(ZDOTDIR) is unset, tt(HOME) is used instead.
 Those files listed above as being in tt(/etc) may be in another
 directory, depending on the installation.
+
+As tt(/etc/zshenv) is run for all instances of zsh, it is important that
+it be kept as small as possible.  In particular, it is a good idea to
+put code that does not need to be run for every single shell behind
+a test of the form `tt(if [[ -o rcs ]]; then ...)' so that it will not
+be executed when zsh is invoked with the `tt(-f)' option.
 ifnzman(includefile(Zsh/filelist.yo))
 
diff --git a/Doc/Zsh/func.yo b/Doc/Zsh/func.yo
index aa905b600..847381c8d 100644
--- a/Doc/Zsh/func.yo
+++ b/Doc/Zsh/func.yo
@@ -35,25 +35,45 @@ A function can be marked as em(undefined) using the tt(autoload) builtin
 (or `tt(functions -u)' or `tt(typeset -fu)').  Such a function has no
 body.  When the function is first executed, the tt(fpath)
 variable will be searched for a file with the same name as the
-function.
+function.  The usual alias expansion during reading will be suppressed if
+the tt(autoload) builtin or its equivalent is given the option tt(-U);
+this is recommended for the use of functions supplied with the zsh
+distribution.  Thus to define functions for autoloading, a typical sequence
+is:
+
+example(fpath=(~/myfuncs $fpath)
+autoload myfunc1 myfunc2 ...)
 
 pindex(KSH_AUTOLOAD, use of)
 If the tt(KSH_AUTOLOAD) option is set, or the file contains only a simple
 definition of the function, the file's contents will be
-executed.  It would normally define the function in question, but may
-also perform initialization.
-It is executed in the context of the function
-execution, and may therefore define local parameters.
+executed.  It will normally define the function in question, but may
+also perform initialization:  this
+is executed in the context of the function
+execution, and may therefore define local parameters.  It is an error if
+the function is not defined by loading the file.
+
+Otherwise, the function is defined such that its body is the complete
+contents of the file.  This form allows the file to be used directly as an
+executable shell script.  If processing of the file results in the function
+being re-defined, the function itself is not re-executed. To force the
+function to perform initialization and be called, the file should contain
+initialization code (which will be discarded) in addition to a complete
+function definition (which will be retained for subsequent calls to the
+function), and a call to the shell function at the end.
+
+For example, suppose the autoload file tt(func) contains
 
-Otherwise, the function is defined such that its body is the
-complete contents of the file.  This form allows the file to be
-used directly as an executable shell script.
-Initialization code can be executed, but only as part of the first
-function execution, so the function would have to redefine itself to
-avoid reinitializing on the next execution.
+example(func() { print This is func; }
+print func is initialized
+)
+
+then `tt(func; func)' with tt(KSH_AUTOLOAD) set will produce both messages
+on the first call, and just the message `tt(This is func)' on the second
+and any subsequent calls.  Without tt(KSH_AUTOLOAD) set, it will produce
+the initialization message on the first call, and the other message on the
+second and subsequent calls.
 
-If this processing of the file results in the function being
-fully defined, the function itself is then executed.
 sect(Special Functions)
 The following functions, if defined, have special meaning to
 the shell:
@@ -106,3 +126,8 @@ item(tt(TRAPZERR))(
 Executed whenever a command has a non-zero exit status.
 )
 enditem()
+
+The functions beginning `tt(TRAP)' may alternatively be defined with the
+tt(trap) builtin:  this may be preferable for some uses, as they are then
+run in the environment of the calling process, rather than in their own
+function environment.
diff --git a/Doc/Zsh/grammar.yo b/Doc/Zsh/grammar.yo
index 80c132ab7..5ae28dba1 100644
--- a/Doc/Zsh/grammar.yo
+++ b/Doc/Zsh/grammar.yo
@@ -25,6 +25,11 @@ If a command name is given, the parameter assignments modify
 the environment of the command when it is executed.
 The value of a simple command is its exit status,
 or 128 plus the signal number if terminated by a signal.
+For example,
+
+example(echo foo)
+
+is a simple command with arguments.
 
 cindex(pipeline)
 A em(pipeline) is either a simple command, or a sequence of two or more
@@ -37,6 +42,12 @@ command to the standard input of the next.  The value of a pipeline
 is the value of the last command, unless the pipeline is preceded by
 `tt(!)' in which case the value is the logical inverse of the value of the
 last command.
+For example,
+
+example(echo foo | sed 's/foo/bar/')
+
+is a pipeline, where the output (`tt(foo)' plus a newline) of the first
+command will be passed to the input of the second.
 
 findex(coproc)
 cindex(coprocess)
@@ -45,6 +56,8 @@ a two-way pipe is established between it and the parent shell.  The
 shell can read from or write to the coprocess by means of the `tt(>&p)'
 and `tt(<&p)' redirection operators or with `tt(print -p)' and `tt(read -p)'.
 A pipeline cannot be preceded by both `tt(coproc)' and `tt(!)'.
+If job control is active, the coprocess can be treated in other than input
+and output as an ordinary background job.
 
 cindex(sublist)
 A em(sublist) is either a single pipeline, or a sequence of two or more
@@ -54,6 +67,14 @@ by `tt(&&)', the second pipeline is executed only if the first succeeds
 second is executed only if the first fails (returns a nonzero value).
 Both operators have equal precedence and are left associative.
 The value of the sublist is the value of the last pipeline executed.
+For example,
+
+example(dmesg | grep panic && print yes)
+
+is a sublist consisting of two piplines, the second just a simple command
+which will be executed if and only if the tt(grep) command returns a zero
+value.  If it does not, the value of the sublist is that return value, else
+it is the value returned by the tt(print) (almost certainly zero).
 
 cindex(list)
 A em(list) is a sequence of zero or more sublists, in which each sublist
@@ -65,9 +86,15 @@ or `tt({)...tt(})'.  When a
 sublist is terminated by `tt(;)' or newline, the shell waits for it to
 finish before executing the next sublist.  If a sublist is terminated
 by a `tt(&)', `tt(&|)', or `tt(&!)',
-the shell executes it in the background, and
-does not wait for it to finish.
-A backgrounded sublist returns a status of zero.
+the shell executes the last pipeline in it in the background, and
+does not wait for it to finish (note the difference from other shells
+which execute the whole sublist in the background).
+A backgrounded pipeline returns a status of zero.
+
+More generally, a list can be seen as a set of any shell commands
+whatsoever, including the complex commands below; this is implied wherever
+the word `list' appears in later descriptions.  For example, the commands
+in a shell function form a special sort of list.
 texinode(Precommand Modifiers)(Complex Commands)(Simple Commands & Pipelines)(Shell Grammar)
 sect(Precommand Modifiers)
 cindex(precommand modifiers)
@@ -87,7 +114,9 @@ Filename generation (globbing) is not performed on any of
 the words.
 )
 item(tt(nocorrect))(
-Spelling correction is not done on any of the words.
+Spelling correction is not done on any of the words.  This must appear
+before any other precommand modifier, as it is interpreted immediately,
+before any parsing is done.  It has no effect in non-interactive shells.
 )
 item(tt(exec))(
 The command is executed in the parent shell without forking.
@@ -173,7 +202,7 @@ findex(select)
 cindex(user selection)
 cindex(selection, user)
 item(tt(select) var(name) [ tt(in) var(word) ... var(term) ] tt(do) var(list) tt(done))(
-where var(term) is one ore more newline or tt(;).
+where var(term) is one or more newline or tt(;) to terminate the var(word)s.
 Print the set of var(word)s, each preceded by a number.
 If the tt(in) var(word) is omitted, use the positional parameters.
 The tt(PROMPT3) prompt is printed and a line is read from standard
@@ -333,7 +362,13 @@ string by using the `tt(\')' escape.
 
 All characters enclosed between a pair of single quotes (tt('')) that
 is not preceded by a `tt($)' are quoted.  A single quote cannot appear
-within single quotes.
+within single quotes unless the option tt(RC_QUOTES) is set, in which case
+a pair of single quotes are turned into a single quote.  For example,
+
+example(print '''')
+
+outputs nothing apart from a newline if tt(RC_QUOTES) is not set, but one
+single quote if it is set.
 
 Inside double quotes (tt("")), parameter and
 command substitution occurs, and `tt(\)' quotes the characters
diff --git a/Doc/Zsh/invoke.yo b/Doc/Zsh/invoke.yo
index 40a5513d0..7add05b38 100644
--- a/Doc/Zsh/invoke.yo
+++ b/Doc/Zsh/invoke.yo
@@ -21,3 +21,14 @@ item(tt(-s))(
 Read command from the standard input.
 )
 enditem()
+
+For further options, which are common to invocation and the tt(set)
+builtin, see
+ifzman(zmanref(zshoptions))\
+ifnzman(noderef(Options))\
+.  Flags may be specified by name using the tt(-o) option.  For example,
+
+example(zsh -x -o shwordsplit scr)
+
+runs the script tt(scr), setting the tt(XTRACE) option by the corresponding
+letter `tt(-x)' and the tt(SH_WORD_SPLIT) option by name.
diff --git a/Doc/Zsh/jobs.yo b/Doc/Zsh/jobs.yo
index 62e945f23..2a5ee69d8 100644
--- a/Doc/Zsh/jobs.yo
+++ b/Doc/Zsh/jobs.yo
@@ -20,7 +20,8 @@ does not have a place in the job table, and is not subject
 to the job control features described here.
 
 If you are running a job and wish to do something else you may hit the key
-^Z (control-Z) which sends a tt(TSTP) signal to the current job.
+^Z (control-Z) which sends a tt(TSTP) signal to the current job:  this key
+may be redefined by the tt(susp) option of the external tt(stty) command.
 cindex(jobs, suspending)
 cindex(suspending jobs)
 The shell will then normally indicate that the job has been `suspended',
diff --git a/Doc/Zsh/metafaq.yo b/Doc/Zsh/metafaq.yo
index c8273da47..c27f4f152 100644
--- a/Doc/Zsh/metafaq.yo
+++ b/Doc/Zsh/metafaq.yo
@@ -80,7 +80,6 @@ tt(ftp://sunsite.org.uk/packages/zsh/))
 item(USA)(
 nofill(tt(ftp://ftp.math.gatech.edu/pub/zsh/)
 tt(ftp://uiarchive.uiuc.edu/pub/packages/shells/zsh/)
-tt(ftp://ftp.sterling.com/zsh/)  em((G))  em((H))
 tt(ftp://ftp.rge.com/pub/shells/zsh/)
 tt(ftp://foad.org/pub/zsh/)
 tt(http://foad.org/zsh/))
diff --git a/Doc/Zsh/mod_complist.yo b/Doc/Zsh/mod_complist.yo
index b37252582..23f8bee2e 100644
--- a/Doc/Zsh/mod_complist.yo
+++ b/Doc/Zsh/mod_complist.yo
@@ -1,6 +1,7 @@
 texinode(The complist Module)(The deltochar Module)(The compctl Module)(Zsh Modules)
 sect(The complist Module)
 cindex(completion, listing)
+cindex(completion, coloured listings)
 The tt(complist) module offers two extensions to completion listings:
 the ability to highlight matches in such a list and a different
 style of menu-completion.
@@ -12,6 +13,8 @@ not automatically be loaded if it is not linked in:  on systems with
 dynamic loading, `tt(zmodload complist)' is required.
 
 subsect(Parameters)
+vindex(ZLS_COLORS)
+vindex(ZLS_COLOURS)
 The parameters tt(ZLS_COLORS) and tt(ZLS_COLOURS) describe how matches
 are highlighted. To turn on highlighting an empty value suffices, in
 which case all the default values given below will be used. The format of the
@@ -78,6 +81,9 @@ vt100 compatible terminals such as tt(xterm)s. On monochrome terminals
 the default values will have no visual effect.
 
 subsect(Menu selection)
+cindex(completion, selecting by cursor)
+vindex(SELECTMIN)
+tindex(menu-select)
 The tt(complist) module also offers an alternative style of selecting
 matches from a list, called menu-selection, which can be used if the
 shell is set up to return to the last prompt after showing a
diff --git a/Doc/Zsh/mod_stat.yo b/Doc/Zsh/mod_stat.yo
index a8551d8e9..d0c7acfe1 100644
--- a/Doc/Zsh/mod_stat.yo
+++ b/Doc/Zsh/mod_stat.yo
@@ -85,10 +85,10 @@ item(tt(-A) var(array))(
 Instead of displaying the results on standard
 output, assign them to an var(array), one tt(struct stat) element per array
 element for each file in order.  In this case neither the name
-of the element nor the name of the files is provided unless the
-tt(-t) or tt(-n) options are provided, respectively.  In the
-former case the element name appears as a prefix to the
-appropriate array element and in the latter case the file name
+of the element nor the name of the files appears in var(array) unless the
+tt(-t) or tt(-n) options were given, respectively.  If tt(-t) is given,
+the element name appears as a prefix to the
+appropriate array element; if tt(-n) is given, the file name
 appears as a separate array element preceding all the others.
 Other formatting options are respected.
 )
diff --git a/Doc/Zsh/mod_zftp.yo b/Doc/Zsh/mod_zftp.yo
index 7b64882b4..f5d165083 100644
--- a/Doc/Zsh/mod_zftp.yo
+++ b/Doc/Zsh/mod_zftp.yo
@@ -240,6 +240,7 @@ The following shell parameters are used by tt(zftp).  Currently none
 of them are special.
 
 startitem()
+vindex(ZFTP_TMOUT)
 item(tt(ZFTP_TMOUT))(
 Integer.  The time in seconds to wait for a network operation to
 complete before returning an error.  If this is not set when the
@@ -374,14 +375,14 @@ subsect(Functions)
 cindex(zftp, functions)
 
 startitem()
-findex(zftp_chpwd)
+findex(zftp_chpwd, specification)
 item(tt(zftp_chpwd))(
 If this function is set by the user, it is called every time the
 directory changes on the server, including when a user is logged
 in, or when a connection is closed.  In the last case, tt($ZFTP_PWD)
 will be unset; otherwise it will reflect the new directory.
 )
-findex(zftp_progress)
+findex(zftp_progress, specification)
 item(tt(zftp_progress))(
 If this function is set by the user, it will be called during
 a tt(get), tt(put) or tt(append) operation each time sufficient data
diff --git a/Doc/Zsh/mod_zle.yo b/Doc/Zsh/mod_zle.yo
index 7d438a5d4..95aa27535 100644
--- a/Doc/Zsh/mod_zle.yo
+++ b/Doc/Zsh/mod_zle.yo
@@ -41,11 +41,9 @@ and does not otherwise count as an argument.
 )
 enditem()
 
-Some operations do not permit a keymap to be selected.
 If a keymap selection is required and none of the options above are used, the
-`tt(main)' keymap is used.  These operations do not permit a keymap to be
-selected:
-
+`tt(main)' keymap is used.  Some operations do not permit a keymap to be
+selected, namely:
 startitem()
 item(tt(-l))(
 List all existing keymap names.  If the tt(-L)
@@ -137,7 +135,10 @@ sitem(tt(^)var(X))(control character)
 endsitem()
 
 In all other cases, `tt(\)' escapes the following character.  Delete is
-written as `tt(^?)'.  Note that `tt(\M^?)' and `tt(^\M?)' are not the same.
+written as `tt(^?)'.  Note that `tt(\M^?)' and `tt(^\M?)' are not the same,
+and that (unlike emacs), the bindings `tt(\M-)var(X)' and `tt(\e)var(X)'
+are entirely distinct, although they are initialized to the same bindings
+by `tt(bindkey -m)'.
 )
 findex(vared)
 cindex(parameters, editing)
@@ -218,8 +219,9 @@ ifzman(zmanref(zshzle))\
 ifnzman(noderef(Zsh Line Editor))\
 .
 )
+citem(completion widgets, creating)
 item(tt(-C) var(widget) var(completion-widget) var(function))(
-Create a user-defined completion widget names var(widget). The 
+Create a user-defined completion widget named var(widget). The 
 completion widget will behave like the built-in completion-widget
 whose name is given as var(completion-widget). To generate the
 completions, the shell function var(function) will be called.
@@ -254,7 +256,7 @@ sets the numerical argument temporarily to var(num), while `tt(-N)' sets it
 to the default, i.e. as if there were none.
 
 Any further arguments will be passed to the widget.  If it is a shell
-function, these are passed down as postional parameters; for builtin
+function, these are passed down as positional parameters; for builtin
 widgets it is up to the widget in question what it does with them.
 Currently arguments are only handled by the incremental-search commands,
 the tt(history-search-forward) and tt(-backward) and the corresponding
diff --git a/Doc/Zsh/options.yo b/Doc/Zsh/options.yo
index bfd7bc201..c5be29064 100644
--- a/Doc/Zsh/options.yo
+++ b/Doc/Zsh/options.yo
@@ -40,9 +40,18 @@ trailing whitespace will be ignored; for example the string `tt(-f    )'
 will be treated just as `tt(-f)', but the string `tt(-f i)' is an error.
 This is because many systems which implement the `tt(#!)' mechanism for
 calling scripts do not strip trailing whitespace.
+
 texinode(Description of Options)(Option Aliases)(Specifying Options)(Options)
 sect(Description of Options)
 cindex(options, description)
+In the following list, options set by default in all emulations are marked
+<D>; those set by default only in csh, ksh, sh, or zsh emulations are marked
+<C>, <K>, <S>, <Z> as appropriate.  When listing options (by `tt(setopt)',
+`tt(unsetopt)', `tt(set -o)' or `tt(set +o)'), those turned on by default
+appear in the list prefixed with `tt(no)'.  Hence (unless
+tt(KSH_OPTION_PRINT) is set), `tt(setopt)' shows all options whose settings
+are changed from the default.
+
 startitem()
 pindex(ALL_EXPORT)
 cindex(export, automatic)
@@ -50,7 +59,7 @@ item(tt(ALL_EXPORT) (tt(-a), ksh: tt(-a)))(
 All parameters subsequently defined are automatically exported.
 )
 pindex(ALWAYS_LAST_PROMPT)
-item(tt(ALWAYS_LAST_PROMPT))(
+item(tt(ALWAYS_LAST_PROMPT) <D>)(
 If unset, key functions that list completions try to return to the last
 prompt if given a numeric argument. If set these functions try to
 return to the last prompt if given em(no) numeric argument.
@@ -64,7 +73,7 @@ a single match is inserted or menu completion is performed.
 )
 pindex(APPEND_HISTORY)
 cindex(history, appending to a file)
-item(tt(APPEND_HISTORY))(
+item(tt(APPEND_HISTORY) <D>)(
 If this is set, zsh sessions will append their history list to
 the history file, rather than overwrite it. Thus, multiple parallel
 zsh sessions will all have their history lists added to the
@@ -79,12 +88,12 @@ command to that directory.
 )
 pindex(AUTO_LIST)
 cindex(completion, listing choices)
-item(tt(AUTO_LIST) (tt(-9)))(
+item(tt(AUTO_LIST) (tt(-9)) <D>)(
 Automatically list choices on an ambiguous completion.
 )
 pindex(AUTO_MENU)
 cindex(completion, menu)
-item(tt(AUTO_MENU))(
+item(tt(AUTO_MENU) <D>)(
 Automatically use menu completion after the second consecutive request for
 completion, for example by pressing the tab key repeatedly. This option
 is overridden by tt(MENU_COMPLETE).
@@ -100,7 +109,7 @@ is performed on a word starting with `tt(~)'.
 (Otherwise, the parameter must be used in the form `tt(~)var(param)' first.)
 )
 pindex(AUTO_PARAM_KEYS)
-item(tt(AUTO_PARAM_KEYS))(
+item(tt(AUTO_PARAM_KEYS) <D>)(
 If a parameter name was completed and a following character
 (normally a space) automatically
 inserted, and the next character typed is one
@@ -111,7 +120,7 @@ Completion in a brace expansion is affected similarly: the added character
 is a `tt(,)', which will be removed if `tt(})' is typed next.
 )
 pindex(AUTO_PARAM_SLASH)
-item(tt(AUTO_PARAM_SLASH))(
+item(tt(AUTO_PARAM_SLASH) <D>)(
 If a parameter is completed whose content is the name of a directory,
 then add a trailing slash instead of a space.
 )
@@ -123,7 +132,7 @@ Make tt(cd) push the old directory onto the directory stack.
 )
 pindex(AUTO_REMOVE_SLASH)
 cindex(slash, removing trailing)
-item(tt(AUTO_REMOVE_SLASH))(
+item(tt(AUTO_REMOVE_SLASH) <D>)(
 When the last character resulting from a completion is a slash and the next
 character typed is a word delimiter, a slash, or a character that ends 
 a command (such as a semicolon or an ampersand), remove the slash.
@@ -138,21 +147,21 @@ as candidates for resumption of an existing job.
 pindex(BAD_PATTERN)
 cindex(globbing, bad pattern)
 cindex(filename generation, bad pattern)
-item(tt(BAD_PATTERN) (tt(PLUS()2)))(
+item(tt(BAD_PATTERN) (tt(PLUS()2)) <C> <Z>)(
 If a pattern for filename generation is badly formed, print an error message.
 (If this option is unset, the pattern will be left unchanged.)
 )
 pindex(BANG_HIST)
 cindex(history, enable substitution)
 cindex(enable history substitution)
-item(tt(BANG_HIST) (tt(PLUS()K)))(
+item(tt(BANG_HIST) (tt(PLUS()K)) <C> <Z>)(
 Perform textual history expansion, bf(csh)-style,
 treating the character `tt(!)' specially.
 )
 pindex(BARE_GLOB_QUAL)
 cindex(globbing qualifiers, enable)
 cindex(enable globbing qualifiers)
-item(tt(BARE_GLOB_QUAL))(
+item(tt(BARE_GLOB_QUAL) <Z>)(
 In a glob pattern, treat a trailing set of parentheses as a qualifier
 list, if it contains no `tt(|)', `tt(LPAR())' or (if special) `tt(~)'
 characters.  See noderef(Filename Generation).
@@ -171,14 +180,14 @@ through the list in that case.
 pindex(BEEP)
 cindex(beep, enabling)
 cindex(enabling the beep)
-item(tt(BEEP) (tt(PLUS()B)))(
+item(tt(BEEP) (tt(PLUS()B)) <D>)(
 Beep on error in ZLE.
 )
 pindex(BG_NICE)
 cindex(jobs, background priority)
 cindex(background jobs, priority of)
 cindex(priority of background jobs)
-item(tt(BG_NICE) (tt(-6)))(
+item(tt(BG_NICE) (tt(-6)) <C> <Z>)(
 Run all background jobs at a lower priority.  This option
 is set by default.
 )
@@ -192,7 +201,7 @@ noderef(Brace Expansion).
 )
 pindex(BSD_ECHO)
 cindex(echo, BSD compatible)
-item(tt(BSD_ECHO))(
+item(tt(BSD_ECHO) <S>)(
 Make the tt(echo) builtin compatible with the BSD manref(echo)(1) command.
 This disables backslashed escape sequences in echo strings unless the
 tt(-e) option is specified.
@@ -233,7 +242,7 @@ path segment is a symbolic link.
 pindex(CLOBBER)
 cindex(clobbering, of files)
 cindex(file clobbering, allowing)
-item(tt(CLOBBER) (tt(PLUS()C), ksh: tt(PLUS()C)))(
+item(tt(CLOBBER) (tt(PLUS()C), ksh: tt(PLUS()C)) <D>)(
 Allows `tt(>)' redirection to truncate existing files,
 and `tt(>>)' to create files.
 Otherwise `tt(>!)' or `tt(>|)' must be used to truncate a file,
@@ -264,7 +273,7 @@ Try to correct the spelling of all arguments in a line.
 pindex(CSH_JUNKIE_HISTORY)
 cindex(csh, history style)
 cindex(history style, csh)
-item(tt(CSH_JUNKIE_HISTORY))(
+item(tt(CSH_JUNKIE_HISTORY) <C>)(
 A history reference without an event specifier will always refer to the
 previous command.  Without this option, such a history reference refers
 to the same event as the previous history reference, defaulting to the
@@ -273,14 +282,14 @@ previous command.
 pindex(CSH_JUNKIE_LOOPS)
 cindex(csh, loop style)
 cindex(loop style, csh)
-item(tt(CSH_JUNKIE_LOOPS))(
+item(tt(CSH_JUNKIE_LOOPS) <C>)(
 Allow loop bodies to take the form `var(list); tt(end)' instead of
 `tt(do) var(list); tt(done)'.
 )
 pindex(CSH_JUNKIE_QUOTES)
 cindex(csh, quoting style)
 cindex(quoting style, csh)
-item(tt(CSH_JUNKIE_QUOTES))(
+item(tt(CSH_JUNKIE_QUOTES) <C>)(
 Changes the rules for single- and double-quoted text to match that of
 bf(csh).  These require that embedded newlines be preceded by a backslash;
 unescaped newlines will cause an error message.
@@ -292,7 +301,7 @@ pindex(CSH_NULL_GLOB)
 cindex(csh, null globbing style)
 cindex(null globbing style, csh)
 cindex(globbing, null, style, csh)
-item(tt(CSH_NULL_GLOB))(
+item(tt(CSH_NULL_GLOB) <C>)(
 If a pattern for filename generation has no matches,
 delete the pattern from the argument list;
 do not report an error unless all the patterns
@@ -301,7 +310,7 @@ Overrides tt(NULL_GLOB).
 )
 pindex(EQUALS)
 cindex(filename expansion, =)
-item(tt(EQUALS))(
+item(tt(EQUALS) <Z>)(
 Perform tt(=) filename expansion.
 (See noderef(Filename Expansion).)
 )
@@ -314,7 +323,7 @@ scripts.
 )
 pindex(EXEC)
 cindex(command execution, enabling)
-item(tt(EXEC) (tt(PLUS()n), ksh: tt(PLUS()n)))(
+item(tt(EXEC) (tt(PLUS()n), ksh: tt(PLUS()n)) <D>)(
 Do execute commands.  Without this option, commands are
 read and checked for syntax errors, but not executed.
 )
@@ -327,7 +336,7 @@ always produces named directory expansion.)
 )
 pindex(EXTENDED_HISTORY)
 cindex(history, timestamping)
-item(tt(EXTENDED_HISTORY))(
+item(tt(EXTENDED_HISTORY) <C>)(
 Save each command's beginning timestamp (in seconds since the epoch)
 and the duration (in seconds) to the history file.  The format of
 this prefixed data is:
@@ -336,35 +345,35 @@ this prefixed data is:
 )
 pindex(FLOW_CONTROL)
 cindex(flow control)
-item(tt(FLOW_CONTROL))(
+item(tt(FLOW_CONTROL) <D>)(
 If this option is unset,
 output flow control via start/stop characters (usually assigned to
 ^S/^Q) is disabled in the shell's editor.
 )
 pindex(FUNCTION_ARGZERO)
 cindex($0, setting)
-item(tt(FUNCTION_ARGZERO))(
+item(tt(FUNCTION_ARGZERO) <C> <Z>)(
 When executing a shell function or sourcing a script, set tt($0)
 temporarily to the name of the function/script.
 )
 pindex(GLOB)
 cindex(globbing, enabling)
 cindex(enabling globbing)
-item(tt(GLOB) (tt(PLUS()F), ksh: tt(PLUS()f)))(
+item(tt(GLOB) (tt(PLUS()F), ksh: tt(PLUS()f)) <D>)(
 Perform filename generation (globbing).
 (See noderef(Filename Generation).)
 )
 pindex(GLOBAL_RCS)
 cindex(startup files, global, inhibiting)
 cindex(files, global startup, inhibiting)
-item(tt(GLOBAL_RCS) (tt(-d)))(
+item(tt(GLOBAL_RCS) (tt(-d)) <D>)(
 If this option is unset, the startup files tt(/etc/zprofile),
 tt(/etc/zshrc), tt(/etc/zlogin) and tt(/etc/zlogout) will not be run.  It
 can be disabled and re-enabled at any time, including inside local startup
 files (tt(.zshrc), etc.).
 )
 pindex(GLOB_ASSIGN)
-item(tt(GLOB_ASSIGN))(
+item(tt(GLOB_ASSIGN) <C>)(
 If this option is set, filename generation (globbing) is
 performed on the right hand side of scalar parameter assignments of
 the form `var(name)tt(=)var(pattern) (e.g. `tt(foo=*)').
@@ -392,7 +401,7 @@ item(tt(GLOB_DOTS) (tt(-4)))(
 Do not require a leading `tt(.)' in a filename to be matched explicitly.
 )
 pindex(GLOB_SUBST)
-item(tt(GLOB_SUBST))(
+item(tt(GLOB_SUBST) <C> <K> <S>)(
 Treat any characters resulting from parameter expansion as being
 eligible for file expansion and filename generation, and any
 characters resulting from command substitution as being eligible for
@@ -401,7 +410,7 @@ filename generation.
 pindex(HASH_CMDS)
 cindex(hashing, of commands)
 cindex(command hashing)
-item(tt(HASH_CMDS))(
+item(tt(HASH_CMDS) <D>)(
 Note the location of each command the first time it is executed.
 Subsequent invocations of the same command will use the
 saved location, avoiding a path search.
@@ -410,13 +419,13 @@ If this option is unset, no path hashing will be done at all.
 pindex(HASH_DIRS)
 cindex(hashing, of directories)
 cindex(directories, hashing)
-item(tt(HASH_DIRS))(
+item(tt(HASH_DIRS) <D>)(
 Whenever a command is executed, hash the directory containing it,
 as well as all directories that occur earlier in the path.
 Has no effect if tt(HASH_CMDS) is unset.
 )
 pindex(HASH_LIST_ALL)
-item(tt(HASH_LIST_ALL))(
+item(tt(HASH_LIST_ALL) <D>)(
 Whenever a command completion is attempted, make sure the entire
 command path is hashed first.  This makes the first completion slower.
 )
@@ -428,7 +437,7 @@ references to clobber files even when tt(CLOBBER) is unset.
 pindex(HIST_BEEP)
 cindex(history beeping)
 cindex(beep, history)
-item(tt(HIST_BEEP))(
+item(tt(HIST_BEEP) <D>)(
 Beep when an attempt is made to access a history entry which
 isn't there.
 )
@@ -490,7 +499,7 @@ history expansion and reload the line into the editing buffer.
 )
 pindex(HUP)
 cindex(jobs, HUP)
-item(tt(HUP))(
+item(tt(HUP) <Z>)(
 Send the tt(HUP) signal to running jobs when the
 shell exits.
 )
@@ -498,7 +507,7 @@ pindex(IGNORE_BRACES)
 cindex(disabling brace expansion)
 cindex(brace expansion, disabling)
 cindex(expansion, brace, disabling)
-item(tt(IGNORE_BRACES) (tt(-I)))(
+item(tt(IGNORE_BRACES) (tt(-I)) <S>)(
 Do not perform brace expansion.
 )
 pindex(IGNORE_EOF)
@@ -529,14 +538,14 @@ The value of this option cannot be changed anywhere other than the command line.
 )
 pindex(INTERACTIVE_COMMENTS)
 cindex(comments, in interactive shells)
-item(tt(INTERACTIVE_COMMENTS) (tt(-k)))(
+item(tt(INTERACTIVE_COMMENTS) (tt(-k)) <K> <S>)(
 Allow comments even in interactive shells.
 )
 pindex(KSH_ARRAYS)
 cindex(arrays, ksh style)
 cindex(array style, ksh)
 cindex(ksh, array style)
-item(tt(KSH_ARRAYS))(
+item(tt(KSH_ARRAYS) <K> <S>)(
 Emulate bf(ksh) array handling as closely as possible.  If this option
 is set, array elements are numbered from zero, an array parameter
 without subscript refers to the first element instead of the whole array,
@@ -544,7 +553,7 @@ and braces are required to delimit a subscript (`tt(${path[2]})' rather
 than just `tt($path[2])').
 )
 pindex(KSH_AUTOLOAD)
-item(tt(KSH_AUTOLOAD))(
+item(tt(KSH_AUTOLOAD) <K> <S>)(
 Emulate bf(ksh) function autoloading.  This means that when a function is
 autoloaded, the corresponding file is merely executed, and must define
 the function itself.  (By default, the function is defined to the contents
@@ -553,7 +562,7 @@ containing only a simple definition of the function - is always handled
 in the bf(ksh)-compatible manner.)
 )
 pindex(KSH_GLOB)
-item(tt(KSH_GLOB))(
+item(tt(KSH_GLOB) <K>)(
 In pattern matching, the interpretation of parentheses is affected by
 a preceding `tt(@)', `tt(*)', `tt(+)', `tt(?)' or `tt(!)'.
 See noderef(Filename Generation).
@@ -562,13 +571,15 @@ pindex(KSH_OPTION_PRINT)
 cindex(option printing, ksh style)
 cindex(option printing style, ksh)
 cindex(ksh, option printing style)
-item(tt(KSH_OPTION_PRINT))(
-Alters the way options settings are printed.
+item(tt(KSH_OPTION_PRINT) <K>)(
+Alters the way options settings are printed: instead of separate lists of
+set and unset options, all options are shown, marked `on' if
+they are in the non-default state, `off' otherwise.
 )
 pindex(LIST_AMBIGUOUS)
 cindex(ambiguous completion)
 cindex(completion, ambiguous)
-item(tt(LIST_AMBIGUOUS))(
+item(tt(LIST_AMBIGUOUS) <D>)(
 This option works when tt(AUTO_LIST) or tt(BASH_AUTO_LIST) is also
 set.  If there is an unambiguous prefix to insert on the command line,
 that is done without a completion list being displayed; in other
@@ -579,7 +590,7 @@ will be delayed to the third call of the function.
 pindex(LIST_BEEP)
 cindex(beep, ambiguous completion)
 cindex(completion, beep on ambiguous)
-item(tt(LIST_BEEP))(
+item(tt(LIST_BEEP) <D>)(
 Beep on an ambiguous completion.  More accurately, this forces the
 completion widgets to return status 1 on an ambiguous completion, which
 causes the shell to beep if the option tt(BEEP) is also set; this may
@@ -588,12 +599,12 @@ be modified if completion is called from a user-defined widget.
 pindex(LIST_TYPES)
 cindex(marking file types)
 cindex(files, marking type of)
-item(tt(LIST_TYPES) (tt(-X)))(
+item(tt(LIST_TYPES) (tt(-X)) <D>)(
 When listing files that are possible completions, show the
 type of each file with a trailing identifying mark.
 )
 pindex(LOCAL_OPTIONS)
-item(tt(LOCAL_OPTIONS))(
+item(tt(LOCAL_OPTIONS) <K>)(
 If this option is set at the point of return from a shell function,
 all the options (including this one) which were in force upon entry to
 the function are restored.  Otherwise, only this option and the
@@ -605,7 +616,7 @@ with a formulation like `tt(emulate -L zsh)'; the tt(-L) activates
 tt(LOCAL_OPTIONS).
 )
 pindex(LOCAL_TRAPS)
-item(tt(LOCAL_TRAPS))(
+item(tt(LOCAL_TRAPS) <K>)(
 If this option is set when a signal trap is set inside a function, then the
 previous status of the trap for that signal will be restored when the
 function exits.  Note that this option must be set em(prior) to altering the
@@ -671,13 +682,13 @@ item(tt(MONITOR) (tt(-m), ksh: tt(-m)))(
 Allow job control.  Set by default in interactive shells.
 )
 pindex(MULTIOS)
-item(tt(MULTIOS))(
+item(tt(MULTIOS) <Z>)(
 Perform implicit bf(tee)s or bf(cat)s when multiple
 redirections are attempted (see noderef(Redirection)).
 )
 pindex(NOMATCH)
 cindex(globbing, no matches)
-item(tt(NOMATCH) (tt(PLUS()3)))(
+item(tt(NOMATCH) (tt(PLUS()3)) <C> <Z>)(
 If a pattern for filename generation has no matches,
 print an error, instead of
 leaving it unchanged in the argument list.
@@ -687,7 +698,7 @@ of an initial `tt(~)' or `tt(=)'.
 pindex(NOTIFY)
 cindex(background jobs, notification)
 cindex(notification of background jobs)
-item(tt(NOTIFY) (tt(-5), ksh: tt(-b)))(
+item(tt(NOTIFY) (tt(-5), ksh: tt(-b)) <Z>)(
 Report the status of background jobs immediately, rather than
 waiting until just before printing a prompt.
 )
@@ -723,7 +734,7 @@ This also applies to the tt(.) builtin,
 and to searches for modules performed by the tt(zmodload) builtin.
 )
 pindex(POSIX_BUILTINS)
-item(tt(POSIX_BUILTINS))(
+item(tt(POSIX_BUILTINS) <K> <S>)(
 When this option is set the tt(command) builtin can be used to execute
 shell builtin commands.  Parameter assignments specified before shell
 functions and special builtins are kept after the command completes unless
@@ -778,25 +789,26 @@ option.
 )
 pindex(PROMPT_BANG)
 cindex(prompt, ! expansion)
-item(tt(PROMPT_BANG))(
+item(tt(PROMPT_BANG) <K>)(
 If set, `tt(!)' is treated specially in prompt expansion.
 See noderef(Prompt Expansion).
 )
 pindex(PROMPT_CR)
 cindex(prompt, with CR)
-item(tt(PROMPT_CR) (tt(PLUS()V)))(
+item(tt(PROMPT_CR) (tt(PLUS()V)) <D>)(
 Print a carriage return just before printing
-a prompt in the line editor.
+a prompt in the line editor.  This is on by default as multi-line editing
+is only possible if the editor knows where the start of the line appears.
 )
 pindex(PROMPT_PERCENT)
 cindex(prompt, % expansion)
-item(tt(PROMPT_PERCENT))(
+item(tt(PROMPT_PERCENT) <C> <Z>)(
 If set, `tt(%)' is treated specially in prompt expansion.
 See noderef(Prompt Expansion).
 )
 pindex(PROMPT_SUBST)
 cindex(prompt, parameter expansion)
-item(tt(PROMPT_SUBST))(
+item(tt(PROMPT_SUBST) <K>)(
 If set, em(parameter expansion), em(command substitution) and
 em(arithmetic expansion) are performed in prompts.
 )
@@ -840,7 +852,7 @@ within singly quoted strings.
 )
 pindex(RCS)
 cindex(startup files, sourcing)
-item(tt(RCS) (tt(PLUS()f)))(
+item(tt(RCS) (tt(PLUS()f)) <D>)(
 After tt(/etc/zshenv) is sourced on startup, source the
 tt(.zshenv), tt(/etc/zprofile), tt(.zprofile),
 tt(/etc/zshrc), tt(.zshrc), tt(/etc/zlogin), tt(.zlogin), and tt(.zlogout)
@@ -867,7 +879,7 @@ noderef(Restricted Shell).
 pindex(RM_STAR_SILENT)
 cindex(rm *, querying before)
 cindex(querying before rm *)
-item(tt(RM_STAR_SILENT) (tt(-H)))(
+item(tt(RM_STAR_SILENT) (tt(-H)) <K> <S>)(
 Do not query the user before executing `tt(rm *)' or `tt(rm path/*)'.
 )
 pindex(RM_STAR_WAIT)
@@ -883,7 +895,7 @@ avoided by expanding the `tt(*)' in ZLE (with tab).
 pindex(SHARE_HISTORY)
 cindex(share history)
 cindex(history, sharing)
-item(tt(SHARE_HISTORY))(
+item(tt(SHARE_HISTORY) <K>)(
 
 This option both imports new commands from the history file, and also
 causes your typed commands to be appended to the history file (the
@@ -906,7 +918,7 @@ commands whenever you need them using `tt(fc -RI)'.
 pindex(SH_FILE_EXPANSION)
 cindex(sh, expansion style)
 cindex(expansion style, sh)
-item(tt(SH_FILE_EXPANSION))(
+item(tt(SH_FILE_EXPANSION) <K> <S>)(
 Perform filename expansion (e.g., ~ expansion) em(before)
 parameter expansion, command substitution, arithmetic expansion
 and brace expansion.
@@ -917,7 +929,7 @@ brace expansion, so things like `tt(~$USERNAME)' and
 pindex(SH_GLOB)
 cindex(sh, globbing style)
 cindex(globbing style, sh)
-item(tt(SH_GLOB))(
+item(tt(SH_GLOB) <K> <S>)(
 Disables the special meaning of `tt(LPAR())', `tt(|)', `tt(RPAR())'
 and 'tt(<)' for globbing the result of parameter and command substitutions,
 and in some other places where
@@ -944,20 +956,20 @@ cindex(sh, single letter options style)
 cindex(ksh, single letter options style)
 cindex(single letter options, ksh style)
 cindex(options, single letter, ksh style)
-item(tt(SH_OPTION_LETTERS))(
+item(tt(SH_OPTION_LETTERS) <K> <S>)(
 If this option is set the shell tries to interpret single letter options
 (which are used with tt(set) and tt(setopt)) like bf(ksh) does.
 This also affects the value of the tt(-) special parameter.
 )
 pindex(SHORT_LOOPS)
-item(tt(SHORT_LOOPS))(
+item(tt(SHORT_LOOPS) <D>)(
 Allow the short forms of tt(for), tt(select),
 tt(if), and tt(function) constructs.
 )
 pindex(SH_WORD_SPLIT)
 cindex(field splitting, sh style)
 cindex(sh, field splitting style)
-item(tt(SH_WORD_SPLIT) (tt(-y)))(
+item(tt(SH_WORD_SPLIT) (tt(-y)) <K> <S>)(
 Causes field splitting to be performed on unquoted parameter expansions.
 Note that this option has nothing to do with word splitting.
 (See noderef(Parameter Expansion).)
@@ -973,7 +985,7 @@ The value of this option cannot be changed anywhere other than the command line.
 )
 pindex(SINGLE_LINE_ZLE)
 cindex(editor, single line mode)
-item(tt(SINGLE_LINE_ZLE) (tt(-M)))(
+item(tt(SINGLE_LINE_ZLE) (tt(-M)) <K>)(
 Use single-line command line editing instead of multi-line.
 )
 pindex(SUN_KEYBOARD_HACK)
@@ -988,7 +1000,7 @@ too small, and the backquote key lies annoyingly close to it.
 pindex(UNSET)
 cindex(parameters, substituting unset)
 cindex(unset parameters, substituting)
-item(tt(UNSET) (tt(PLUS()u), ksh: tt(PLUS()u)))(
+item(tt(UNSET) (tt(PLUS()u), ksh: tt(PLUS()u)) <K> <S> <Z>)(
 Treat unset parameters as if they were empty when substituting.
 Otherwise they are treated as an error.
 )
@@ -1008,7 +1020,8 @@ pindex(ZLE)
 cindex(editor, enabling)
 cindex(enabling the editor)
 item(tt(ZLE) (tt(-Z)))(
-Use the zsh line editor.
+Use the zsh line editor.  Set by default in interactive shells connected to
+a terminal.
 )
 enditem()
 texinode(Option Aliases)(Single Letter Options)(Description of Options)(Options)
diff --git a/Doc/Zsh/params.yo b/Doc/Zsh/params.yo
index 2dbff771e..f8089faf8 100644
--- a/Doc/Zsh/params.yo
+++ b/Doc/Zsh/params.yo
@@ -107,9 +107,6 @@ parentheses the string up to the matching closing one is considered to
 be a list of flags. The flags currently understood are:
 
 startitem()
-item(tt(e))(
-This option has no effect and retained for backward compatibility only.
-)
 item(tt(w))(
 If the parameter subscripted is a scalar than this flag makes
 subscripting work on words instead of characters.  The default word
@@ -162,6 +159,9 @@ if combined with `tt(r)', `tt(R)', `tt(i)' or `tt(I)', makes them begin
 at the var(n)th or var(n)th last element, word, or character (if var(expr)
 evaluates to var(n)).  This flag is ignored when the array is associative.
 )
+item(tt(e))(
+This option has no effect and retained for backward compatibility only.
+)
 enditem()
 texinode(Positional Parameters)(Local Parameters)(Array Parameters)(Parameters)
 sect(Positional Parameters)
@@ -431,7 +431,7 @@ The following parameters are used by the shell:
 startitem()
 vindex(ARGV0)
 item(tt(ARGV0))(
-If exported, its value is used as tt(argv[0]) of external commands.
+If exported, its value is used as the tt(argv[0]) of external commands.
 Usually used in constructs like `tt(ARGV0=emacs nethack)'.
 )
 vindex(BAUD)
@@ -888,8 +888,8 @@ vindex(ZBEEP)
 item(tt(ZBEEP))(
 If set, this gives a string of characters, which can use all the same codes
 as the tt(bindkey) command as described in
-ifzman(zmanref(zshzle))\
-ifnzman(noderef(Zsh Line Editor))\
+ifzman(the zle module entry in zmanref(zshmodules))\
+ifnzman(noderef(The zle Module))\
 , that will be output to the terminal
 instead of beeping.  This may have a visible instead of an audible effect;
 for example, the string `tt(\e[?5h\e[?5l)' on a vt100 or xterm will have
diff --git a/Doc/Zsh/redirect.yo b/Doc/Zsh/redirect.yo
index b44b07e63..3f30b75a1 100644
--- a/Doc/Zsh/redirect.yo
+++ b/Doc/Zsh/redirect.yo
@@ -173,11 +173,23 @@ example(echo foo > bar > baz)
 
 when tt(MULTIOS) is unset will truncate bar, and write `tt(foo)' into baz.
 
+sect(Redirections with no command)
+vindex(NULLCMD, use of)
+vindex(READNULLCMD, use of)
 If a simple command consists of one or more redirection operators
-and zero or more parameter assignments, but no command name,
-the command named in the shell variable tt(READNULLCMD) is assumed.
-(If tt(READNULLCMD) is empty or not set, `tt(cat)' is used.)  Thus
+and zero or more parameter assignments, but no command name, and the
+parameter tt(NULLCMD) is not set, an error is caused.  If the parameter
+tt(NULLCMD) is set, its value will be inserted as a command with the
+given redirections.  If both tt(NULLCMD) and tt(READNULLCMD) are set, then
+the value of the latter will be used instead of that of the former when the
+redirection is an input.  The default for tt(NULLCMD) is `tt(cat)' and for
+tt(READNULLCMD) is `tt(more)'. Thus
 
 example(< file)
 
-copies the contents of tt(file) to the standard output.
+shows the contents of tt(file) on standard output, with paging if that is a
+terminal.  tt(NULLCMD) and tt(READNULLCMD) may refer to shell functions.
+
+The standard Bourne shell behaviour is obtained by setting tt(NULLCMD) and
+tt(READNULLCMD) to `tt(:)'.  This is the default when zsh is emulating bf(sh)
+or bf(ksh).
diff --git a/Doc/Zsh/zftpsys.yo b/Doc/Zsh/zftpsys.yo
index d806a49b5..b99604d44 100644
--- a/Doc/Zsh/zftpsys.yo
+++ b/Doc/Zsh/zftpsys.yo
@@ -1,6 +1,7 @@
 texinode(Zftp Function System)()(Completion System)(Top)
 chapter(Zftp Function System)
-cindex(zftp, function system)
+cindex(zftp function system)
+cindex(FTP, functions for using shell as client)
 sect(Description)
 
 This describes the set of shell functions supplied with the source
@@ -70,6 +71,7 @@ same as that in a standard FTP client.
 
 subsect(Opening a connection)
 startitem()
+findex(zfparams)
 item(tt(zfparams [ var(host) [ var(user) [ var(password) ... ] ] ]))(
 Set or show the parameters for a future tt(zfopen) with no arguments.  If
 no arguments are given, the current parameters are displayed (the password
@@ -80,6 +82,7 @@ parameter given as `tt(?)' will be prompted for.
 As tt(zfopen) calls tt(zfparams) to store the parameters, this usually need
 not be called directly.
 )
+findex(zfopen)
 item(tt(zfopen [ -1 ] [ var(host) [ var(user) [ var(password) [ var(account) ] ] ] ]))(
 If var(host) is present, open a connection to that host under username
 var(user) with password var(password) (and, on the rare occasions when it
@@ -97,6 +100,7 @@ recorded for later re-opening, either by a tt(zfopen) with no arguments, or
 automatically (see below).  With the option `tt(-1)', no information is
 stored.
 )
+findex(zfanon)
 item(tt(zfanon [ -1 ] var(host)))(
 Open a connection var(host) for anonymous FTP.  The username used is
 tt(anonymous).  The password (which will be reported the first time) is
@@ -108,6 +112,7 @@ enditem()
 
 subsect(Directory management)
 startitem()
+findex(zfcd)
 xitem(tt(zfcd [ var(dir) ]))
 xitem(tt(zfcd -))
 item(tt(zfcd var(old) var(new)))(
@@ -137,12 +142,14 @@ tt(~/foo), so that the `tt(~)' will be expanded by the server to the
 correct remote host directory.  Other named directories of the form
 `tt(~name)' are not treated in this fashion.
 )
+findex(zfhere)
 item(tt(zfhere))(
 Change directory on the remote server to the one corresponding to the
 current local directory, with special handling of `tt(~)' as in tt(zfcd).
 For example, if the current local directory is tt(~/foo/bar), then
 tt(zfhere) performs the effect of `tt(zfcd ~/foo/bar)'.
 )
+findex(zfdir)
 item(tt(zfdir [ -rfd ] [ - ] [ var(dir-options) ] [ var(dir) ]))(
 Produce a long directory listing.  The arguments var(dir-options) and
 var(dir) are passed directly to the server and their effect is
@@ -161,6 +168,7 @@ tt(zfdir), the tt(-f) option can be used to force the cache to be flushed.
 Also, the option tt(-d) will delete both caches without showing a directory
 listing.
 )
+findex(zfdir)
 item(tt(zfls) [ var(ls-options) ] [ var(dir) ])(
 List files on the remote server.  With no arguments, this will produce a
 simple list of file names for the current remote directory.  Any arguments
@@ -170,12 +178,14 @@ enditem()
 
 subsect(Status commands)
 startitem()
+findex(zftype)
 item(tt(zftype) [ var(type) ])(
 With no arguments, show the type of data to be transferred, usually ASCII
 or binary.  With an argument, change the type: the types `tt(A)' or
 `tt(ASCII)' for ASCII data and `tt(B)' or `tt(BINARY)', `tt(I)' or
 `tt(IMAGE)' for binary data are understood case-insensitively.
 )
+findex(zfstat)
 item(tt(zfstat) [ -v ])(
 Show the status of the current or last connection, as well as the status of
 some of tt(zftp)'s status variables.  With the tt(-v) option, a more
@@ -193,12 +203,14 @@ this requires version 5 of tt(perl), see the description of the function
 tt(zfrtime) below for more information.
 
 startitem()
+findex(zfget)
 item(tt(zfget [ -Gt ] var(file1) ...))(
 Retrieve all the listed files var(file1) ... one at a time from the remote
 server.  If a file contains a `tt(/)', the full name is passed to the
 remote server, but the file is stored locally under the name given by the
 part after the final `tt(/)'.
 )
+findex(zfuget)
 item(tt(zfuget [ -Gvst ] var(file1) ...))(
 As tt(zfget), but only retrieve files where the version on the remote
 server is newer (has a later modification time), or where the local file
@@ -209,6 +221,7 @@ and will always retrieve the file in either of those two cases.  With the
 option tt(-v), the command prints more information about the files while it
 is working out whether or not to transfer them.
 )
+findex(zfcget)
 item(tt(zfcget [ -Gt ] var(file1) ...))(
 As tt(zfget), but if any of the local files exists, and is shorter than
 the corresponding remote file, the command assumes that it is the result of
@@ -218,6 +231,7 @@ file.  This is useful on a poor connection which keeps failing.
 Note that this requires a commonly implemented, but non-standard, version
 of the FTP protocol, so is not guaranteed to work on all servers.
 )
+findex(zfgcp)
 xitem(tt(zfgcp [ -Gt ] var(remote-file) var(local-file)))
 item(tt(zfgcp [ -Gt ] var(rfile1) ... var(ldir)))(
 This retrieves files from the remote server with arguments behaving
@@ -234,16 +248,19 @@ enditem()
 
 subsect(Sending files)
 startitem()
+findex(zfput)
 item(tt(zfput var(file1) ...))(
 Send all the var(file1) ... given separately to the remote server.  If a
 filename contains a `tt(/)', the full filename is used locally to find the
 file, but only the basename is used for the remote file name.
 )
+findex(zfuput)
 item(tt(zfuput [ -vs ] var(file1) ...))(
 As tt(zfput), but only send files which are newer than their local
 equivalents, or if the remote file does not exist.  The logic is the same
 as for tt(zfuget), but reversed between local and remote files.
 )
+findex(zfcput)
 item(tt(zfcput var(file1) ...))(
 As tt(zfput), but if any remote file already exists and is shorter than the
 local equivalent, assume it is the result of an incomplete transfer and
@@ -251,6 +268,7 @@ send the rest of the file to append to the existing part.  As the FTP
 append command is part of the standard set, this is in principle more
 likely to work than tt(zfcget).
 )
+findex(zfpcp)
 xitem(tt(zfpcp var(local-file) var(remote-file)))
 item(tt(zfpcp var(lfile1) ... var(rdir)))(
 This sends files to the remote server with arguments behaving similarly to
@@ -277,6 +295,7 @@ enditem()
 
 subsect(Closing the connection)
 startitem()
+findex(zfclose)
 item(tt(zfclose))(
 Close the connection.
 )
@@ -291,6 +310,7 @@ functions is called, it will be set to the file tt(.zfbfmarks) in the
 directory where your zsh startup files live (usually tt(~)).
 
 startitem()
+findex(zfmark)
 item(tt(zfmark [ )var(bookmark)tt( ]))(
 If given an argument, mark the current host, user and directory under the
 name var(bookmark) for later use by tt(zfgoto).  If there is no connection
@@ -301,6 +321,7 @@ under the same name will be silently replaced.
 If not given an argument, list the existing bookmarks and the points to
 which they refer in the form var(user)tt(@)var(host)tt(:)var(directory).
 )
+findex(zfgoto)
 item(tt(zfgoto [ -n ] )var(bookmark))(
 Return to the location given by var(bookmark), as previously set by
 tt(zfmark).  If the location has user `tt(ftp)' or `tt(anonymous)', open
@@ -323,11 +344,13 @@ tt(zfinit)), but are described here for completeness.  You may wish to
 alter tt(zftp_chpwd) and tt(zftp_progress), in particular.
 
 startitem()
+findex(zfinit)
 item(tt(zfinit [ -n ]))(
 As described above, this is used to initialize the zftp function system.
 The tt(-n) option should be used if the zftp command is already built into
 the shell.
 )
+findex(zfautocheck)
 item(tt(zfautocheck [ -dn ]))(
 This function is called to implement automatic reopening behaviour, as
 described in more detail below.  The options must appear in the first
@@ -338,6 +361,7 @@ transfer.  The host and directory for the last session are stored in the
 variable tt($zflastsession), but the internal host/user/password parameters
 must also be correctly set.
 )
+findex(zfcd_match)
 item(tt(zfcd_match var(prefix) var(suffix)))(
 This performs matching for completion of remote directory names.  If the
 remote server is UNIX, it will attempt to persuade the server to list the
@@ -346,6 +370,7 @@ guaranteed.  On other hosts it simply calls tt(zfget_match) and hence
 completes all files, not just directories.  On some systems, directories
 may not even look like filenames.
 )
+findex(zfget_match)
 item(tt(zfget_match var(prefix) var(suffix)))(
 This performs matching for completion of remote filenames.  It caches files
 for the current directory (only) in the shell parameter tt($zftp_fcache).
@@ -353,12 +378,14 @@ It is in the form to be called by the tt(-K) option of tt(compctl), but
 also works when called from a widget-style completion function with
 var(prefix) and var(suffix) set appropriately.
 )
+findex(zfrglob)
 item(tt(zfrglob var(varname)))(
 Perform remote globbing, as describes in more detail below.  var(varname)
 is the name of a variable containing the pattern to be expanded; if there
 were any matches, the same variable will be set to the expanded set of
 filenames on return.
 )
+findex(zfrtime)
 item(tt(zfrtime var(lfile) var(rfile) [ var(time) ]))(
 Set the local file var(lfile) to have the same modification time as the
 remote file var(rfile), or the explicit time var(time) in FTP format
@@ -368,6 +395,7 @@ Currently this requires tt(perl) version 5 to perform the conversion from
 GMT to local time.  This is unfortunately difficult to do using shell code
 alone.
 )
+findex(zftp_chpwd, supplied version)
 item(tt(zftp_chpwd))(
 This function is called every time a connection is opened, or closed, or
 the remote directory changes.  This version alters the title bar of an
@@ -385,6 +413,7 @@ example(chpwd() {
 
 fits in well.
 )
+findex(zftp_progress, supplied version)
 item(tt(zftp_progress))(
 This function shows the status of the transfer as the percentage of the
 total so far transferred.  It will not write anything unless the output is
@@ -399,6 +428,7 @@ texinode(Miscellaneous Features)()(Zftp Functions)(Zftp Function System)
 sect(Miscellaneous Features)
 
 subsect(Remote globbing)
+cindex(zftp function system, remote globbing)
 
 The commands for retrieving files usually perform filename expansion
 (globbing) on their arguments; this can be turned off by passing the option
@@ -422,6 +452,7 @@ patterns.  This may in some cases be faster, as it avoids retrieving the
 entire list of directory contents.
 
 subsect(Automatic and temporary reopening)
+cindex(zftp function system, automatic reopening)
 
 As described for the tt(zfopen) command, a subsequent tt(zfopen) with no
 parameters will reopen the connection to the last host (this includes
diff --git a/Doc/Zsh/zle.yo b/Doc/Zsh/zle.yo
index 60c003533..e04737da9 100644
--- a/Doc/Zsh/zle.yo
+++ b/Doc/Zsh/zle.yo
@@ -4,9 +4,9 @@ cindex(line editor)
 cindex(editor, line)
 sect(Description)
 pindex(ZLE, use of)
-If the tt(ZLE) option is set (it is by default)
+If the tt(ZLE) option is set (which it is by default in interactive shells)
 and the shell input is attached to the terminal, the user
-is allowed to edit command lines.
+is able to edit command lines.
 
 There are two display modes.  The first, multiline mode, is the
 default.  It only works if the tt(TERM) parameter is set to a valid
@@ -67,7 +67,8 @@ that is bound to some command and is also a prefix of a longer bound string.
 In this case ZLE will wait a certain time to see if more characters
 are typed, and if not (or they don't match any longer string) it will
 execute the binding.  This timeout is defined by the tt(KEYTIMEOUT) parameter;
-its default is 0.4 sec.  No timeout is done if the prefix string is not bound.
+its default is 0.4 sec.  There is no timeout if the prefix string is not
+itself bound to a command.
 
 As well as ZLE commands, key sequences can be bound to other strings, by using
 `tt(bindkey -s)'.
@@ -83,7 +84,7 @@ simply to perform some small action.  The ZLE commands that key sequences
 in keymaps are bound to are in fact widgets.  Widgets can be user-defined
 or built in.
 
-There are 162 standard widgets built in to ZLE (see Standard Widgets below).
+The standard widgets built in to ZLE are listed in Standard Widgets below.
 Other built-in widgets can be defined by other modules (see
 ifzman(zmanref(zshmodules))\
 ifnzman(noderef(Zsh Modules))\
@@ -163,7 +164,7 @@ item(tt(NUMERIC) (integer))(
 The numeric argument. If no numeric argument was given, this parameter
 is unset. When this is set inside a widget function, builtin widgets
 called with the tt(zle) builtin command will use the value
-assigned. If it is unset inside awidget function, builtin widgets
+assigned. If it is unset inside a widget function, builtin widgets
 called behave as if no numeric argument was given.
 )
 vindex(HISTNO)
@@ -508,7 +509,10 @@ Insert the last word from the previous history event at the
 cursor position.  If a positive numeric argument is given,
 insert that word from the end of the previous history event.
 If the argument is zero or negative insert that word from the
-left (zero inserts the previous command word).
+left (zero inserts the previous command word).  Repeating this command
+replaces the word just inserted with the last word from the
+history event prior to the one just used; numeric arguments can be used in
+the same way to pick a word from that event.
 )
 tindex(vi-repeat-search)
 item(tt(vi-repeat-search) (unbound) (n) (unbound))(
diff --git a/Doc/zman.yo b/Doc/zman.yo
index 657e046a6..d1366bc23 100644
--- a/Doc/zman.yo
+++ b/Doc/zman.yo
@@ -61,8 +61,9 @@ COMMENT(--- section divisions ---)
 
 def(chapter)(1)(CMT())
 
+COMMENT(--- the "" works around a yodl bug ---)
 def(sect)(1)(\
-  NOTRANS(.SH ")UPPERCASE(ARG1)(0)"NL()\
+  NOTRANS(.SH )UPPERCASE(ARG1)(0)""NL()\
   STDPAR()\
   CMT()\
 )
diff --git a/Doc/ztexi.yo b/Doc/ztexi.yo
index 971947ac6..96985539d 100644
--- a/Doc/ztexi.yo
+++ b/Doc/ztexi.yo
@@ -217,9 +217,9 @@ def(example)(1)(\
 )
 
 def(indent)(1)(\
-  NOTRANS(@display)NL()\
+  NOTRANS(@quotation)NL()\
   ARG1\
-  NL()NOTRANS(@end display)\
+  NL()NOTRANS(@end quotation)\
 )
 
 COMMENT(--- hyperlink menus ---)
diff --git a/Etc/CONTRIBUTORS b/Etc/CONTRIBUTORS
index 7064ef742..171b3f1a0 100644
--- a/Etc/CONTRIBUTORS
+++ b/Etc/CONTRIBUTORS
@@ -24,7 +24,7 @@ Version 3.1.6
   control code changes; parameters code changes; parameter module;
   additional autoloading code; general code changes for extra efficiency;
   subscripting and ordering of globbing lists.
-  
+
 * Peter Stephenson <pws@ibmth.df.unipi.it>: zftp and mapfile modules and
   zf* functions; local parameters and typeset changes; changes in autoconf
   system; case-independent and approximate pattern matching; various
@@ -33,10 +33,10 @@ Version 3.1.6
 * Bart Schaefer <schaefer@candle.brasslantern.com>: associative array
   implementation; other parameter changes; keeping track of missing
   patches; function autoloading changes.
-  
+
 * Wayne Davison <wayne@clari.net>:  History code novelties and improvements
   with new options.
-  
+
 * Geoff Wing <mason@primenet.com.au>:  Zle display code fixes, mailing
   list and patch archive.
 
@@ -47,7 +47,11 @@ Version 3.1.6
 Other improvements, bug fixes and design suggestions from all the above
 plus Andrej Borsenkow, Oliver Kiddle, Tanaka Akira, Naoki Wakamatsu, Tatuso
 Furukawa, Ville Herva, Will Day, Lehti Rahmi, Larry P. Schrof, Helmut
-Jarausch, Phil Pennock, Wilfredo Sanchez, Bruce Stephens.
+Jarausch, Phil Pennock, Wilfredo Sanchez, Bruce Stephens, Gene Cohler,
+Ollivier Robert.
+
+Previous versions of zsh 3 were maintained by Zoltán Hidvégi and Andrew
+Main (Zefram).
 
 Version 3.0
 -----------
diff --git a/Etc/FAQ.yo b/Etc/FAQ.yo
index 840a17196..05c16fc17 100644
--- a/Etc/FAQ.yo
+++ b/Etc/FAQ.yo
@@ -13,7 +13,7 @@ def(mybf)(1)(\
   whenhtml(bf(ARG1))\
   whenlatex(bf(ARG1))\
   whenms(bf(ARG1))\
-  whensgml(bf(ARG1)))
+  whensgml(bf(ARG1)))\
 def(myem)(1)(\
   whentxt(_ARG1_)\
   whenhtml(em(ARG1))\
@@ -45,15 +45,23 @@ whenms(report(ARG1)(ARG2)(ARG3))\
 whensgml(report(ARG1)(ARG2)(ARG3)))
 myreport(Z-Shell Frequently-Asked Questions)(Peter Stephenson)(1999/05/24)
 COMMENT(-- the following are for Usenet and must appear first)\
-description(
+description(\
 mydit(Archive-Name:) unix-faq/shell/zsh
-mydit(Last-Modified:) 1999/05/24
+mydit(Last-Modified:) 1999/07/24
 mydit(Submitted-By:) email(pws@ibmth.df.unipi.it (Peter Stephenson))
-mydit(Version:) $Id: FAQ.yo,v 1.1.1.7 1999/07/03 13:17:25 akr Exp $
+mydit(Version:) $Id: FAQ.yo,v 1.1.1.8 1999/07/24 14:02:44 akr Exp $
 mydit(Posting-Frequency:) Monthly
 mydit(Copyright:) (C) P.W. Stephenson, 1995--1999 (see end of document)
 )
 
+bf(Changes since issue posted June 1999:)
+description(
+mydit(1.6)  FTP site changes
+mydit(3.9)  delete bogus claim that ttyctl code may be updated some day;
+     add note about possible termcap deinitialization sequences
+mydit(5.1)  80-column display bug.
+)
+
 This document contains a list of frequently-asked (or otherwise
 significant) questions concerning the Z-shell, a command interpreter
 for many UNIX systems which is freely available to anyone with FTP
@@ -356,6 +364,8 @@ url(ftp://ftp.math.technion.ac.il/mirror/ftp.zsh.org/pub/zsh/)
     mydit()          \
 url(http://www.math.technion.ac.il/mirror/ftp.zsh.org/pub/zsh/)
 (http://www.math.technion.ac.il/mirror/ftp.zsh.org/pub/zsh/)
+    mydit(Italy)     url(ftp://ftp.unina.it/pub/Unix/pkgs/shell/zsh/)
+(ftp://ftp.unina.it/pub/Unix/pkgs/shell/zsh/)
     mydit(Japan)     url(ftp://ftp.tohoku.ac.jp/mirror/zsh/)
 (ftp://ftp.tohoku.ac.jp/mirror/zsh/)
     mydit()          url(ftp://ftp.nisiq.net/pub/shells/zsh/)
@@ -379,8 +389,6 @@ url(http://www.math.technion.ac.il/mirror/ftp.zsh.org/pub/zsh/)
 (ftp://ftp.math.gatech.edu/pub/zsh/)
     mydit()          url(ftp://uiarchive.uiuc.edu/pub/packages/shells/zsh/)
 (ftp://uiarchive.uiuc.edu/pub/packages/shells/zsh/)
-    mydit()          url(ftp://ftp.sterling.com/zsh/)
-(ftp://ftp.sterling.com/zsh/)
     mydit()          url(ftp://ftp.rge.com/pub/shells/zsh/)
 (ftp://ftp.rge.com/pub/shells/zsh/)
     mydit()          url(ftp://foad.org/pub/zsh/)
@@ -1210,6 +1218,13 @@ sect(Why does my terminal act funny in some way?)
   from hiccups introduced by other programmes (kermit has been known to
   do this).
 
+  A problem I have experienced myself (on an AIX 3.2 workstation with
+  xterm) is that termcap deinitialization sequences sent by `less'
+  were causing automargins to be turned off --- not actually a shell
+  problem, but you might have thought it was.  The fix is to put `tt(X)'
+  into the environment variable tt(LESS) to stop the sequences being sent.
+  Other programs (though not zsh) may also send that sequence.
+
   If myem(that)'s not the problem, and you are having difficulties with
   external commands (not part of zsh), and you think some terminal
   setting is wrong (e.g. tt(^V) is getting interpreted as `literal next
@@ -1223,12 +1238,6 @@ sect(Why does my terminal act funny in some way?)
   modes it uses itself and a number of special processing characters
   (see the tt(stty(1)) manual page).
 
-  At some point there may be an overhaul which allows the terminal
-  modes used by the shell to be modified separately from those seen by
-  external programmes.  This is partially implemented already: from 2.5,
-  the shell is less susceptible to mode changes inherited from
-  programmes than it used to be.
-
 
 sect(Why does zsh not work in an Emacs shell mode any more?)
 
@@ -1917,6 +1926,8 @@ this applies
 
   itemize(
   it() mytt(time) is ignored with builtins and can't be used with mytt({...}).
+  it() When showing completion lists with exactly 80 columns, some
+       terminals print an extra newline which messes up zsh's logic.  
   it() mytt(set -x) (mytt(setopt xtrace)) still has a few glitches; these
      are mostly fixed in 3.1.6.
   it() Zsh's notion of the current line number (via tt($LINENO)) is
@@ -1927,7 +1938,8 @@ this applies
   it() The mytt(r) command does not work inside mytt($(...)) or mytt(`...`)
      expansions.   This is fixed in 3.1.
   it() mytt(typeset) handling is non-optimal, particularly with regard to
-     flags, and is ksh-incompatible in unpredictable ways. 
+     flags, and is ksh-incompatible in unpredictable ways.  3.1.6 has
+     been overhauled, but remaining glitches are to be expected.
   it() Nested closures in extended globbing and pattern matching, such as
   verb(
       [[ fofo = (fo#)# ]]
@@ -1960,7 +1972,7 @@ this applies
      mytt(compress file) any more.  For this reason, mytt(\M-n) and
      mytt(\M-p) use tt(history-beginning-search-{forward,backward}) which
      search for a line with the same prefix up to the cursor position.
-     From 3.1.6, there is likely to be a different implementation which
+     From 3.1.6, there will be a different implementation which
      makes this closer (though not identical) to the old behaviour.
      The story for the tt({up,down}-line-or-search) commands is similar.
   it() In vi insert mode, the cursor keys no longer work.  The following
diff --git a/Etc/MACHINES b/Etc/MACHINES
index 038340e79..223b4a8f3 100644
--- a/Etc/MACHINES
+++ b/Etc/MACHINES
@@ -1,3 +1,4 @@
+
 -----------------------------
 ZSH ON SPECIFIC ARCHITECTURES
 -----------------------------
@@ -43,8 +44,9 @@ DEC: OSF/1 1.2, 1.3, 2.0, 3.*, DEC Unix 4.* (Alpha)
         with debugging enabled:
           DLLD=gcc LDFLAGS='-g -rpath <path-to-.so-files>' ./configure ...
 
-FreeBSD: FreeBSD 2.2.7 [3.1.4]
-	Should build `out-of-the-box'.
+FreeBSD: FreeBSD 2.2.7, 3.x, 4.x
+	Should build `out-of-the-box'.  On FreeBSD 2.2, dynamic	loading
+	does not work, but it does with 3.x and 4.x.
 
 HP: HP-UX 9, 10.20, 11.0
 	Should build `out-of-the-box'.
@@ -59,6 +61,8 @@ IBM: AIX
 	--enable-zsh-mem will not work.
 
 Linux: Linux (i386) [3.1.4]
+	Should build `out-of-the-box'.
+
 	If you are using an early minor version of libc 5, then a bug
 	in the auto-configuration process may cause zsh to think that
 	your system doesn't support the lstat function.  If the configure
@@ -111,8 +115,3 @@ Sun: Solaris 2.*
 	To avoid this, make sure you compile zsh without any reference
 	to /usr/ucblib in your LD_LIBRARY_PATH.  You can easily do this
 	by just unsetting LD_LIBRARY_PATH before building zsh.
-
-	Under Solaris 2.7, problems have been reported with dynamically
-        loaded library support using --enable-dynamic.  However, other
-        users have been successful with the standard Sun compiler.
-        More details of any problems would be appreciated.
diff --git a/Etc/NEWS b/Etc/NEWS
index aad7ccceb..bba3283e6 100644
--- a/Etc/NEWS
+++ b/Etc/NEWS
@@ -12,6 +12,8 @@ programmability and configurability:
  - control over matching for case-independence, partial word completion, etc.
  - menu selection:  choose a completion by moving the cursor
  - coloured completion lists
+ - completion of filenames in quotes is now more reliable; splitting
+   quoted strings into command arguments is also possible.
 
 Other editing changes:
   - enhancements to function/editing interface:  new parameters, numeric
diff --git a/INSTALL b/INSTALL
index 5e61f0795..5c9ecae06 100644
--- a/INSTALL
+++ b/INSTALL
@@ -66,13 +66,23 @@ have already run make, then after adding or removing the modules run:
 Controlling what is compiled into the main zsh binary
 -----------------------------------------------------
 
-By default the comp1, compctl, zle, sched and rlimits modules are compiled
-into non-dynamic zsh and no modules are compiled into the main binary if
-dynamic loading is available.  This can be overridden by creating the file
-mymods.conf in the compilation directory (Src, unless you have told
-configure to use another directory) with the list of modules which are to
-be compiled into the main binary.  See the zshmodules manual page for the
-list of available modules.
+By default the comp1, compctl, zle, complist, sched and rlimits modules are
+compiled into non-dynamic zsh and no modules are compiled into the main
+binary if dynamic loading is available.  This can be overridden by creating
+the file mymods.conf in the compilation directory (Src, unless you have
+told configure to use another directory) with the list of modules which are
+to be compiled into the main binary, one module name per line with no
+punctuation and no suffix.  See the zshmodules manual page for the list of
+available modules.
+
+On systems which do not allow symbols in one dynamically loaded library to
+be visible from another, comp1 will be compiled in to the base executable
+when dynamic loading is used to provide a link between the compctl and zle
+modules.  However, the modules depending on zle (complist and deltochar)
+cannot be loaded dynamically on such systems; this is true, for example, of
+version 4 of SunOS.  The most convenient workaround is to compile zle into
+the base executable by including it (as well as comp1) in mymods.conf as
+described above.
 
 Compiler Options or Using a Different Compiler
 ----------------------------------------------
diff --git a/README b/README
index 6a591b263..6b47a99ce 100644
--- a/README
+++ b/README
@@ -7,7 +7,7 @@ Version
 
 This is zsh version 3.1 (beta)
 
-Note that this is a beta version.  The latest stable version is zsh-3.0.5.
+Note that this is a beta version.  The latest stable version is zsh-3.0.6.
 
 Installing Zsh
 --------------
@@ -20,7 +20,34 @@ Features
 --------
 
 Zsh is a shell with lots of features.  For a list of these, see the
-file Etc/FEATURES.  For more details, see the documentation.
+file Etc/FEATURES, and for the latest changes see Etc/NEWS.  For more
+details, see the documentation.
+
+Possibile incompatibilities
+---------------------------
+
+If you have been using recent versions of zsh 3.1, the following changes in
+the shell may affect you:
+- The traditional bindings of \M-n (history-search-backward) and
+  \M-p (history-search-forward) in older versions of zsh have returned,
+  as has the traditional behaviour of those functions and the functions
+  up-line-or-search and down-line-or-search.  In 3.1.5, the functions
+  behaved differently and \M-n and \M-p were bound by default to
+  history-beginning-search-backward and history-beginning-search-forward.
+- Prompt truncation behaviour via %<...< and %>...> (or %[<...] etc.) has
+  changed slightly:  the string to be truncated runs to the end of the
+  prompt or to the next truncation sequence; %<< will turn off truncation.
+  Previously it only covered individual prompt escapes.  So for example the
+  prompt `%10<...<%~%% ' will now include the `%% ' in the string to be
+  truncated, and you should change the prompt to `%10<...<%~%<<%% ' to turn
+  off truncation immediately after the `%~'.
+- If for some reason you have `setopt norcs' or `unsetopt rcs' anywhere in
+  your startup files (e.g. to stop .zlogout being run), this will now
+  take effect immediately, preventing later startup files from being
+  run.  It is safe to put `setopt norcs' in .zlogin as this is always
+  the last run.
+
+See the FAQ for a discussion of changes over the longer term.
 
 Documentation
 -------------
@@ -65,7 +92,7 @@ The distribution also contains a Perl script in Utils/helpfiles which
 can be used to extract the descriptions of builtin commands from the
 zshbuiltins manual page.  See the comments at the beginning of the
 script about its usage.  The files created by this script can be used
-by example function run-help located in the subdirectory Functions to
+by example function run-help located in the subdirectory Functions/Misc to
 show information about zsh builtins and run `man' on external commands.
 For this the shell variable HELPDIR should point to a directory containing
 the fileles generated by the helpfiles script.  run-help should be
@@ -101,8 +128,8 @@ Zsh Maintenance and Bug Reports
 -------------------------------
 
 Zsh is currently maintained by the members of the zsh-workers mailing list
-and coordinated by Andrew Main (Zefram) <zefram@zsh.org>.  Please send
-any feedback and bugs reports to <zsh-workers@math.gatech.edu>.
+and coordinated by Peter Stephenson <pws@zsh.org>.  Please send
+any feedback and bugs reports to <zsh-workers@sunsite.auc.dk>.
 
 There is a script "reporter" in the subdirectory Util which will print
 out your current shell environment/setup.  If you report a bug, please
diff --git a/Src/Modules/clone.c b/Src/Modules/clone.c
index e2cfea8d9..d9dd6c316 100644
--- a/Src/Modules/clone.c
+++ b/Src/Modules/clone.c
@@ -61,7 +61,7 @@ bin_clone(char *nam, char **args, char *ops, int func)
 	    zwarnnam(nam, "failed to create new session: %e", NULL, errno);
 #endif
 #ifdef TIOCNOTTY
-	    if (ioctl(SHTTY, TIOCNOTTY))
+	    if (ioctl(SHTTY, TIOCNOTTY, 0))
 		zwarnnam(nam, "%e", NULL, errno);
 	    setpgrp(0L, mypid);
 #endif
diff --git a/Src/Modules/mapfile.c b/Src/Modules/mapfile.c
index 41cae80b8..31265c0de 100644
--- a/Src/Modules/mapfile.c
+++ b/Src/Modules/mapfile.c
@@ -143,6 +143,9 @@ setpmmapfile(Param pm, char *value)
 	 */
 	ftruncate(fd, len);
 	memcpy(mmptr, value, len);
+#ifndef MS_SYNC
+#define MS_SYNC 0
+#endif
 	msync(mmptr, len, MS_SYNC);
 	/*
 	 * Then we need to truncate again, since mmap() always maps complete
diff --git a/Src/Modules/parameter.c b/Src/Modules/parameter.c
index 908a05ce9..10f61c0a5 100644
--- a/Src/Modules/parameter.c
+++ b/Src/Modules/parameter.c
@@ -91,6 +91,8 @@ paramtypestr(Param pm)
 	}
 	DPUTS(!val, "BUG: type not handled in parameter");
 	val = dupstring(val);
+	if (pm->level)
+	    val = dyncat(val, "-local");
 	if (f & PM_LEFT)
 	    val = dyncat(val, "-left");
 	if (f & PM_RIGHT_B)
diff --git a/Src/Zle/complist.c b/Src/Zle/complist.c
index 4bf3fec0e..9fe5f37cb 100644
--- a/Src/Zle/complist.c
+++ b/Src/Zle/complist.c
@@ -159,17 +159,15 @@ getcoldef(Listcols c, char *s)
 	n = ++s;
 	while (*s && *s != '=')
 	    s++;
-	if (!*s )
+	if (!*s)
 	    return s;
 	*s++ = '\0';
 	p = getcolval(s);
-	if (*n) {
-	    ec = (Extcol) zhalloc(sizeof(*ec));
-	    ec->ext = n;
-	    ec->col = s;
-	    ec->next = c->exts;
-	    c->exts = ec;
-	}
+	ec = (Extcol) zhalloc(sizeof(*ec));
+	ec->ext = n;
+	ec->col = s;
+	ec->next = c->exts;
+	c->exts = ec;
 	if (*p)
 	    *p++ = '\0';
 	return p;
@@ -460,6 +458,7 @@ complistmatches(Hookdef dummy, Chdata dat)
 	}
     }
     /* Now print the matches. */
+    last_col = COL_NO - 1;
     g = amatches;
     while (g) {
 	char **pp = g->ylist;
diff --git a/Src/Zle/zle_tricky.c b/Src/Zle/zle_tricky.c
index b678a5cad..9c7a19d87 100644
--- a/Src/Zle/zle_tricky.c
+++ b/Src/Zle/zle_tricky.c
@@ -565,8 +565,9 @@ acceptlast(void)
 	cs = minfo.pos + minfo.len + minfo.insc;
 	iremovesuffix(' ', 1);
 	l = cs;
-	cs = minfo.pos + minfo.len - (*(minfo.cur))->qisl;
-	foredel(l - cs);
+	cs = minfo.pos + minfo.len + minfo.insc - (*(minfo.cur))->qisl;
+	if (cs < l)
+	    foredel(l - cs);
 	inststrlen(" ", 1, 1);
 	if (parpre)
 	    inststr(parpre);
@@ -801,11 +802,12 @@ check_param(char *s, int set, int test)
 		parq = eparq = 0;
 
 	    /* Save the prefix. */
-	    sav = *b;
-	    *b = '\0';
-	    untokenize(parpre = ztrdup(s));
-	    *b = sav;
-
+	    if (incompfunc) {
+		sav = *b;
+		*b = '\0';
+		untokenize(parpre = ztrdup(s));
+		*b = sav;
+	    }
 	    /* And adjust wb, we, and offs again. */
 	    offs -= b - s;
 	    wb = cs - offs;
@@ -3527,7 +3529,9 @@ add_match_data(int alt, char *str, Cline line,
 		p->next = qsl;
 	}
     }
-    /* And the same for the prefix. */
+    /* The prefix is handled differently because the completion code
+     * is much more eager to insert the -P prefix than it is to insert
+     * the -S suffix. */
     if (qipre)
 	palen = (qipl = strlen(qipre));
     if (ipre)
@@ -3537,7 +3541,49 @@ add_match_data(int alt, char *str, Cline line,
     if (ppre)
 	palen += (ppl = strlen(ppre));
 
-    if (palen) {
+    if (pl) {
+	if (ppl) {
+	    Cline lp, p = bld_parts(ppre, ppl, ppl, &lp);
+
+	    if (lp->prefix && !(line->flags & (CLF_SUF | CLF_MID))) {
+		lp->prefix->next = line->prefix;
+		line->prefix = lp->prefix;
+		lp->prefix = NULL;
+
+		free_cline(lp);
+
+		if (p != lp) {
+		    Cline q;
+
+		    for (q = p; q->next != lp; q = q->next);
+
+		    q->next = line;
+		    line = p;
+		}
+	    } else {
+		lp->next = line;
+		line = p;
+	    }
+	}
+	if (pl) {
+	    Cline lp, p = bld_parts(pre, pl, pl, &lp);
+
+	    lp->next = line;
+	    line = p;
+	}
+	if (ipl) {
+	    Cline lp, p = bld_parts(ipre, ipl, ipl, &lp);
+
+	    lp->next = line;
+	    line = p;
+	}
+	if (qipl) {
+	    Cline lp, p = bld_parts(qipre, qipl, qipl, &lp);
+
+	    lp->next = line;
+	    line = p;
+	}
+    } else if (palen) {
 	char *apre = (char *) zhalloc(palen);
 	Cline p, lp;
 
@@ -4434,7 +4480,10 @@ docompletion(char *s, int lst, int incmd)
 		minfo.cur = NULL;
 		minfo.asked = 0;
 		do_single(m->matches[0]);
-		invalidatelist();
+		if (compforcelist && *compforcelist && uselist)
+		    showinglist = -2;
+		else
+		    invalidatelist();
 	    }
 	} else {
 	    invalidatelist();
@@ -4561,8 +4610,11 @@ callcompfunc(char *s, char *fn)
 		kset |= CP_PARAMETER;
 		if (!clwpos) {
 		    clwpos = 1;
+		    clwnum = 2;
 		    zsfree(clwords[1]);
 		    clwords[1] = ztrdup(s);
+		    zsfree(clwords[2]);
+		    clwords[2] = NULL;
 		}
 		aadd = 1;
 		break;
@@ -6697,8 +6749,9 @@ invalidatelist(void)
 	listmatches();
     if (validlist)
 	freematches();
-    lastambig = menucmp = menuacc = validlist = showinglist =
-	fromcomp = listshown = 0;
+    lastambig = menucmp = menuacc = validlist = showinglist = fromcomp = 0;
+    if (listshown < 0)
+	listshown = 0;
     minfo.cur = NULL;
     minfo.asked = 0;
     compwidget = NULL;
diff --git a/Src/exec.c b/Src/exec.c
index dc281675f..eab846540 100644
--- a/Src/exec.c
+++ b/Src/exec.c
@@ -2922,7 +2922,7 @@ doshfunc(char *name, List list, LinkList doshargs, int flags, int noreturnval)
 
 	tab = pparams;
 	oldscriptname = scriptname;
-	scriptname = name;
+	scriptname = dupstring(name);
 	oldzoptind = zoptind;
 	zoptind = 1;
 
@@ -3145,6 +3145,7 @@ cancd2(char *s)
 {
     struct stat buf;
     char *us, *us2 = NULL;
+    int ret;
 
     /*
      * If CHASEDOTS and CHASELINKS are not set, we want to rationalize the
@@ -3159,9 +3160,10 @@ cancd2(char *s)
 	fixdir(us2 = us);
     } else
 	us = unmeta(s);
-    return !(access(us, X_OK) || stat(us, &buf) || !S_ISDIR(buf.st_mode));
+    ret = !(access(us, X_OK) || stat(us, &buf) || !S_ISDIR(buf.st_mode));
     if (us2)
 	free(us2);
+    return ret;
 }
 
 /**/
diff --git a/Src/subst.c b/Src/subst.c
index 18d815404..2a25d3e4b 100644
--- a/Src/subst.c
+++ b/Src/subst.c
@@ -1031,6 +1031,8 @@ paramsubst(LinkList l, LinkNode n, char **str, int qt, int ssub)
 		case PM_HASHED:  val = "association"; break;
 		}
 		val = dupstring(val);
+		if (v->pm->level)
+		    val = dyncat(val, "-local");
 		if (f & PM_LEFT)
 		    val = dyncat(val, "-left");
 		if (f & PM_RIGHT_B)
diff --git a/Util/zsh-development-guide b/Util/zsh-development-guide
index 6e8eb1b2d..d96cc1a04 100644
--- a/Util/zsh-development-guide
+++ b/Util/zsh-development-guide
@@ -659,13 +659,13 @@ Documentation
     it should be included within `example(...)'.  The text will be
     indented, will not be filled and will be put into a fixed width font.
   - If the text includes mixed fonts, it should be included within
-    `indent(...)'.  As with `example()', the text is not filled, but now
-    explicit font-changing commands are required inside.
+    `indent(...)'.  The text is now filled unless `nofill(...)' is also
+    used, and explicit font-changing commands are required inside.
   - If the text appears inside some other format, such as for example the
     `item()' list structure, then the instruction `nofill(...)', which
     simply turns off filling should be used; as with `indent(...)',
-    explicit font changing commands are required.  This is also an
-    alternative to `indent()' when no identation is required, e.g. if the
+    explicit font changing commands are required.  This can be used
+    without `indent()' when no identation is required, e.g. if the
     accumulated indentation would otherwise be too long.
   All the above should appear on their own, separated by newlines from the
   surrounding text.  No extra newlines after the opening or before the
diff --git a/configure.in b/configure.in
index 1452d8c2d..93a03d30d 100644
--- a/configure.in
+++ b/configure.in
@@ -1187,7 +1187,7 @@ char *argv[];
   fi
   case "$host_os" in
     hpux*)        DLLDFLAGS="${DLLDFLAGS=-b}" ;;
-    linux*|irix*|osf*) DLLDFLAGS="${DLLDFLAGS=-shared}" ;;
+    freebsd*|linux*|irix*|osf*) DLLDFLAGS="${DLLDFLAGS=-shared}" ;;
     sunos*)       DLLDFLAGS="${DLLDFLAGS=-assert nodefinitions}" ;;
     sysv4*|esix*) DLLDFLAGS="${DLLDFLAGS=-G $ldflags}" ;;
     netbsd*)      DLLDFLAGS="${DLLDFLAGS=${DLLDARG}-x -shared --whole-archive}" ;;
@@ -1196,7 +1196,7 @@ char *argv[];
   esac
   case "$host" in
     *-hpux*)  EXTRA_LDFLAGS="${EXTRA_LDFLAGS=-Wl,-E}" ;;
-    *-linux*) EXTRA_LDFLAGS="${EXTRA_LDFLAGS=-rdynamic}" ;;
+    *-freebsd3*|*-freebsd4*|*-linux*) EXTRA_LDFLAGS="${EXTRA_LDFLAGS=-rdynamic}" ;;
     mips-sni-sysv4)
       #
       # unfortunately, we have different compilers