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

Re: Completing a unique prefix of "script" completes "script"



On 8/14/06, Peter Stephenson <pws@xxxxxxx> wrote:
"Nikolai Weibull" <now@xxxxxxxx> wrote:
> It seems that the hash table is initialized after .zshrc is read.  Is
> there a way to run some scripts after everything is initiaziled?

Hmm... I haven't looked at the source but in my case it seems to
be being hashed straight away...

zsh -f -c 'zmodload -i zsh/parameter
print $commands[script]
unhash script
print $commands[script]'

prints /usr/bin/script the first time and nothing the second time.
/etc/zshenv is empty.  Aha---it looks like zsh/parameter is filling the
hash table itself (based on the HASHLISTALL option which is on by default).
So maybe putting

zmodload -i zsh/parameter

early in your initialization file (it'll probably be loaded by the completion
system later anyway) is good enough.

Nope.  It seems zmodload returns before the hash table is fully
initialized.  If I put a "sleep 1" in there it works, but without it
it'll still complain about the command not being hashed.

Actually, a "sleep 0" seems to work as well...

That's /one/ thing /I/ don't understand...

 nikolai



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