Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: completing automounts with fake-files setting hangs zsh
- X-seq: zsh-workers 26433
- From: Greg Klanderman <gak@xxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxxxxx
- Subject: Re: completing automounts with fake-files setting hangs zsh
- Date: Sun, 25 Jan 2009 11:40:35 -0500
- In-reply-to: <090125042005.ZM25079@xxxxxxxxxxxxxxxxxxxxxx> (Bart Schaefer's message of "Sun, 25 Jan 2009 04:20:05 -0800")
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
- References: <18811.39531.84244.341828@xxxxxxxxxxxxxxxxxx> <m3r62sjbfj.fsf@xxxxxxxxxxxxxx> <090125042005.ZM25079@xxxxxxxxxxxxxxxxxxxxxx>
- Reply-to: gak@xxxxxxxxxxxxxx
>>>>> Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> writes:
> So if you are able to push some of that filtering into the functions
> by use of hooks like "zstyle -e", you can optimize much better than
> the generic internal filters are able.
I don't think that's going to be a workable solution; if I or one of
my users ever have the misfortune to hit <tab> after an automount
point with not enough text to narrow the match list, then their shell
is just done. I've waited up to half an hour - it doesn't come back.
Here's what I have done for over 10 years in compctl, based on the
compctl-examples file:
function _comp_autonet () { ... } # parse etc/auto.net and return all completions
function _comp_autohome () { ... } # parse etc/auto.home and return all completions
compctl -T -x 's[/net/] C[0,^/net/[^/]#/*]' -K _comp_autonet -S/ -tn \
- 's[/home/] C[0,^/home/[^/]#/*]' -K _comp_autohome -S/ -tn
So compctl could deal with the full set of completions without
pre-filtering against the user text.
Under the new completion system, I have something like:
zstyle ':completion:*' fake-files \
'/net:foo bar baz ..' \
'/home:user1 user2 user3 ..'
The completion system is smart enough that this doesn't cause any
problem with several hundred fake files defined per automount point,
until I actually try to complete on those fake files. In fact it's
even fine if the set of completions is reasonably small, so it appears
to be filtering against the user input before stat'ing all the
completions. It's only when there are a large number of matches that
it gets completely wedged stat'ing them all.
I traced the code from the _path_files function into the compfiles
builtin in the zsh/computil module but then I'm getting pretty lost.
It seems that the compctl mechanism worked because it treated the
completions simply as strings rather than files, and set the -S/
suffix argument so they would behave as directory completions.
If I append a '/' to each file in the fake-files style setting, then
everything is fast, but it appends a space after the completion is
inserted (after the '/').
So maybe the right thing is to modify the compfiles builtin to treat
fake files ending in '/' as directories without stat'ing them? I'll
poke at that some more if you agree it's reasonable..
thanks,
Greg
Messages sorted by:
Reverse Date,
Date,
Thread,
Author