* Completion dumpfile
@ 1999-06-07 14:40 Peter Stephenson
0 siblings, 0 replies; only message in thread
From: Peter Stephenson @ 1999-06-07 14:40 UTC (permalink / raw)
To: Zsh hackers list
This will need checking on a wider range of installations than I can do.
This will fail if for some reason users are sharing a function directory
which is world-writeable (which is frightening), but you can work that out
from the documentation.
Note I've also made compinit not override any existing values of the
compconfig keys correct_accept, correct_prompt, completer.
--- Completion/Core/compinit.df Mon Jun 7 10:54:15 1999
+++ Completion/Core/compinit Mon Jun 7 16:35:40 1999
@@ -91,13 +91,31 @@
# We were told what directory to use.
compconfig[dumpfile]="$_i_fdir/compinit.dump"
else
- # Now we're stuck, but we'd better do something.
- compconfig[dumpfile]="$HOME/.compinit.dump"
+ compconfig[dumpfile]=''
fi
-compconfig[correct_accept]=2n
-compconfig[correct_prompt]='correct to:'
-compconfig[completer]=_complete
+if [[ -n $compconfig[dumpfile] ]]; then
+ # Check the file is writeable. If it doesn't exist, the
+ # only safe way is to try and create it.
+ if [[ -f $compconfig[dumpfile] ]]; then
+ [[ -w $compconfig[dumpfile] ]] || compconfig[dumpfile]=''
+ elif touch $compconfig[dumpfile] >& /dev/null; then
+ rm -f $compconfig[dumpfile]
+ else
+ compconfig[dumpfile]=''
+ fi
+fi
+
+if [[ -z $compconfig[dumpfile] ]]; then
+ # If no dumpfile given, or it was not writeable, then use
+ # user's ZDOTDIR.
+ compconfig[dumpfile]="${ZDOTDIR:-$HOME}/.zcompdump"
+fi
+
+(( ${+compconfig[correct_accept]} )) || compconfig[correct_accept]=2n
+(( ${+compconfig[correct_prompt]} )) ||
+ compconfig[correct_prompt]='correct to:'
+(( ${+compconfig[completer]} )) || compconfig[completer]=_complete
# This function is used to register or delete completion functions. For
# registering completion functions, it is invoked with the name of the
--- Doc/Zsh/compsys.yo.df Mon Jun 7 13:55:55 1999
+++ Doc/Zsh/compsys.yo Mon Jun 7 16:22:07 1999
@@ -89,9 +89,11 @@
configuration which will be read in on future invocations. The easiest way
to do this is by adding the option tt(-d) whenever tt(compinit) is sourced.
In this case the dumped file will have the same name as the sourced file,
-but with tt(.dump) appended to the end; alternatively, an explicit file
-name can be given following the tt(-d). On the next call to tt(compinit
--d), the dumped file will be read instead.
+but with tt(.dump) appended to the end, or, if that is not writeable by the
+user, the file 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 tt(-d). On the next call to tt(compinit -d), the
+dumped file will be read instead.
The other option accepted by tt(compinit) is tt(-f var(dir)), which gives
the directory in which tt(compinit) resides. If you source tt(compinit) by
--
Peter Stephenson <pws@ibmth.df.unipi.it> Tel: +39 050 844536
WWW: http://www.ifh.de/~pws/
Dipartimento di Fisica, Via Buonarroti 2, 56127 Pisa, Italy
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~1999-06-07 15:09 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-06-07 14:40 Completion dumpfile Peter Stephenson
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).