Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: HASH_LIST_ALL does not work as expected
- X-seq: zsh-users 9987
- From: Peter Stephenson <pws@xxxxxxx>
- To: "zsh-users Mailinglist" <zsh-users@xxxxxxxxxx>
- Subject: Re: HASH_LIST_ALL does not work as expected
- Date: Fri, 03 Mar 2006 11:56:59 +0000
- In-reply-to: <6F0CB04509C11D46A54232E852E390ACF230C1@xxxxxxxxxxxxxxxxxxxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <6F0CB04509C11D46A54232E852E390ACF230C1@xxxxxxxxxxxxxxxxxxxxxxxxxx>
"Com MN PG P E B Consultant 3" wrote:
> I understood that due to HASH_LIST_ALL, whenever I try to complete a
> command, the PATH is hashed for available commands first.
HASH_LIST_ALL means that the path is fully hashed *the first time* you
do completion, for efficiency. For the same efficiency reasons, it
isn't rehashed automatically thereafter, which is the effect you are
seeing.
What you might want is always to complete commands by searching rather
than by the hash table. I don't think that's currently supported.
(The implementation detail is that we use the zsh/parameter module's
special associative array commands to access the internal hash table.)
Actually, it would be trivial to make the shell issue a rehash on each
command search and nowadays (unlike the days when hashing of commands
was really useful) it doesn't take that long, at least unless you have
an NFS disk on a dial-up line from Ulaanbaatar. This could be a style...
zstyle ":completion:*" rehash true
will turn it on.
Index: Completion/Zsh/Type/_command_names
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Zsh/Type/_command_names,v
retrieving revision 1.7
diff -u -r1.7 _command_names
--- Completion/Zsh/Type/_command_names 1 May 2004 05:47:39 -0000 1.7
+++ Completion/Zsh/Type/_command_names 3 Mar 2006 11:50:36 -0000
@@ -6,6 +6,8 @@
local args defs
+zstyle -t ":completion:${curcontext}:commands" rehash && rehash
+
defs=(
'commands:external command:compadd -k commands'
)
Index: Doc/Zsh/compsys.yo
===================================================================
RCS file: /cvsroot/zsh/zsh/Doc/Zsh/compsys.yo,v
retrieving revision 1.183
diff -u -r1.183 compsys.yo
--- Doc/Zsh/compsys.yo 28 Feb 2006 11:57:20 -0000 1.183
+++ Doc/Zsh/compsys.yo 3 Mar 2006 11:50:37 -0000
@@ -2101,6 +2101,14 @@
regular aliases will never be expanded. If it is set to `tt(always)',
regular aliases will be expanded even if not in command position.
)
+kindex(rehash, completion style)
+item(tt(rehash))(
+If this is set when completing external commands, the internal
+list (hash) of commands will be updated for each search by issuing
+the tt(rehash) command. There is a speed penalty for this which
+is only likely to be noticeable when directories in the path have
+slow file access.
+)
kindex(remote-access, completion style)
item(tt(remote-access))(
If set to tt(false), certain commands will be prevented from making
--
Peter Stephenson <pws@xxxxxxx> Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK Tel: +44 (0)1223 692070
To access the latest news from CSR copy this link into a web browser: http://www.csr.com/email_sig.php
Messages sorted by:
Reverse Date,
Date,
Thread,
Author