From: Peter Stephenson <pws@ibmth.df.unipi.it>
To: zsh-workers@sunsite.auc.dk (Zsh hackers list)
Subject: Completion dumpfile
Date: Mon, 07 Jun 1999 16:40:46 +0200 [thread overview]
Message-ID: <9906071440.AA34420@ibmth.df.unipi.it> (raw)
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
reply other threads:[~1999-06-07 15:09 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=9906071440.AA34420@ibmth.df.unipi.it \
--to=pws@ibmth.df.unipi.it \
--cc=zsh-workers@sunsite.auc.dk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).