about summary refs log tree commit diff
diff options
context:
space:
mode:
authorTanaka Akira <akr@users.sourceforge.net>1999-07-27 08:31:45 +0000
committerTanaka Akira <akr@users.sourceforge.net>1999-07-27 08:31:45 +0000
commit244538985d16c4ac60c3aaf3eb65a804afdbf077 (patch)
tree3575bcdff1ad51523a368b8178b9a88ff475072d
parent8a1dbfa6d77dac5f2aa42633381b5488003773b2 (diff)
downloadzsh-244538985d16c4ac60c3aaf3eb65a804afdbf077.tar.gz
zsh-244538985d16c4ac60c3aaf3eb65a804afdbf077.tar.xz
zsh-244538985d16c4ac60c3aaf3eb65a804afdbf077.zip
zsh-workers:7284
-rw-r--r--Completion/Core/compdump23
1 files changed, 14 insertions, 9 deletions
diff --git a/Completion/Core/compdump b/Completion/Core/compdump
index 8288ccdd4..cd92ec56d 100644
--- a/Completion/Core/compdump
+++ b/Completion/Core/compdump
@@ -1,4 +1,4 @@
-# This is a file to be sourced to dump the definitions for new-style
+# This is a function to dump the definitions for new-style
 # completion defined by 'compinit' in the same directory.  The output
 # should be directed into the "compinit.dump" in the same directory as
 # compinit. If you rename init, just stick .dump onto the end of whatever
@@ -9,21 +9,21 @@
 # To do this, simply remove the .dump file, start a new shell, and
 # create the .dump file as before.  Again, compinit -d handles this
 # automatically.
-#
-# It relies on KSH_ARRAYS not being set.
 
 # Print the number of files used for completion. This is used in compinit
 # to see if auto-dump should re-dump the dump-file.
 
-_d_file=${compconfig[dumpfile]-${0:h}/compinit.dump}
+emulate -L zsh
+
+typeset _d_file _d_f _d_bks _d_line _d_als
+
+_d_file=${compconfig[dumpfile]-${0:h}/compinit.dump}.$HOST.$$
 
 typeset -U _d_files
 _d_files=( ${^~fpath}/_(|*[^~])(N:t) )
 
 print "#files: $#_d_files" > $_d_file
 
-unset _d_files
-
 # First dump the arrays _comps and _patcomps.  The quoting hieroglyphyics
 # ensure that a single quote inside a variable is itself correctly quoted.
 
@@ -44,11 +44,13 @@ print >> $_d_file
 # Now dump the key bindings. We dump all bindings for zle widgets
 # whose names start with a underscore.
 # We need both the zle -C's and the bindkey's to recreate.
+# We can ignore any zle -C which rebinds a standard widget (second
+# argument to zle does not begin with a `_').
 
 _d_bks=()
 zle -lL |
   while read -rA _d_line; do
-    if [[ ${_d_line[5]} = _* ]]; then
+    if [[ ${_d_line[3]} = _* && ${_d_line[5]} = _* ]]; then
       print -r - ${_d_line}
       _d_bks=($_d_bks ${_d_line[3]})
     fi
@@ -74,7 +76,7 @@ done))
 # print them out:  about five to a line looks neat
 
 while (( $#_d_als )); do
-  print -n autoload
+  print -n autoload -U
   for (( _i = 0; _i < 5; _i++ )); do
     if (( $#_d_als )); then
       print -n " $_d_als[1]"
@@ -86,4 +88,7 @@ done >> $_d_file
 
 print >> $_d_file
 
-unset _d_line _d_zle _d_bks _d_als _d_f _f_file
+mv $_d_file ${_d_file%.$HOST.$$}
+
+unfunction compdump
+autoload -U compdump