Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: need help with enhancement to prevent completion from stat'ing automounts
- X-seq: zsh-workers 27251
- From: Peter Stephenson <pws@xxxxxxx>
- To: zsh-workers@xxxxxxxxxx
- Subject: Re: need help with enhancement to prevent completion from stat'ing automounts
- Date: Tue, 8 Sep 2009 11:12:00 +0100
- In-reply-to: <m3bplmnpwv.fsf@xxxxxxxxxxxxxx>
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
- Organization: CSR
- References: <19106.55413.238410.101865@xxxxxxxxxxxxxxxxxx> <m3bplmnpwv.fsf@xxxxxxxxxxxxxx>
On Mon, 07 Sep 2009 22:14:40 -0400
Greg Klanderman <gak@xxxxxxxxxxxxxx> wrote:
> >>>>> Greg Klanderman <gak@xxxxxxxxxxxxxx> writes:
>
> > Now I just need some help to figure out what a reasonable way to
> > create a general configuration to support this would be.
>
> So it looks like a zstyle would not work, because I need to access the
> configuration from C. Seems like the only real option is to create an
> array parameter - does that make sense?
It's fairly easy to pass an array into C, particularly if it's going into
compfiles which is the accelerator for _path_files and so has its own
exclusive API, but if you really need to grope in compresult.c it's
trickier. I'm not sure what API you need to access; the core completion
system is heavily customized to make it possible to do clever things with
multiple sets of completions, so an array applying to all of them is
probably too gross. Still, if the stat is that low down in the system
you've got problems. It should be possible to add an option to compadd
giving an array of special things and store that in an appropriate group of
results, parallel to the various other things that go into compadd. This
is all quite hairy.
Is your case fixed by not passing the "-f" to compadd? Then the problem is
limited to _path_files and compfiles, which should be easier to trace.
Separating fake and real files into different compadd calls should be
possible (you're now using to advantage the facility for multiple matches
that I just explained above makes it harder to change the low level stuff).
There's a problem that if you're not statting the file you've completed you
obviously don't know if it's a directory, so if you complete /home/u to
/home/user you don't get the slash. Maybe (part of) the solution is a
fake-dirs style, for stuff that is added in as directory, i.e. with a /
suffix, but without the -f argument to compadd? That still needs code in
_path_files but possibly not elsewhere (I'm not clear what you need to do
with compfiles here).
I haven't seen an easier way around your original problem---unnecessarily
accessing files can be quite a big problem particular on some systems
(Cygwin in my case) so a fairly general solution to this would certainly be
a good thing.
--
Peter Stephenson <pws@xxxxxxx> Software Engineer
Tel: +44 (0)1223 692070 Cambridge Silicon Radio Limited
Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, UK
Member of the CSR plc group of companies. CSR plc registered in England and Wales, registered number 4187346, registered office Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, United Kingdom
Messages sorted by:
Reverse Date,
Date,
Thread,
Author