zsh-users
 help / color / mirror / code / Atom feed
From: Peter Stephenson <pws@csr.com>
To: "zsh-users Mailinglist" <zsh-users@sunsite.dk>
Subject: Re: HASH_LIST_ALL does not work as expected
Date: Fri, 03 Mar 2006 11:56:59 +0000	[thread overview]
Message-ID: <EXCHANGE03wBnsyR9NE00012af2@exchange03.csr.com> (raw)
In-Reply-To: <6F0CB04509C11D46A54232E852E390ACF230C1@MCHP7R6A.ww002.siemens.net>

"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@csr.com>                  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


  reply	other threads:[~2006-03-03 11:57 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-03-03  8:41 Com MN PG P E B Consultant 3
2006-03-03 11:56 ` Peter Stephenson [this message]
2006-03-03 16:46   ` Wayne Davison

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=EXCHANGE03wBnsyR9NE00012af2@exchange03.csr.com \
    --to=pws@csr.com \
    --cc=zsh-users@sunsite.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).