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

Re: _approximate doesn't work



On Tue, 19 Feb 2008 00:29:35 -0800
Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
> The problem is that at the line above in _path_commands, PREFIX is
> always "xsane_g" (using PWS's test) and never "(#a1)xsane_g".
> 
> Looking through the output, PREFIX gets set by the replacement compadd
> created via _approximate -- but that doesn't happen until *inside* the
> call to _wanted, long after the test in _path_commands.

You're right this is happening quite late, and I think PREFIX is being
restored automatically (by the compstate[restore]=auto mechanism), which is
what I missed (a previously modified version of PREFIX wouldn't be picked
up).

However, this is an extremely general problem.  Very many completion
functions assume quite reasonably that testing PREFIX tests what the
completer is trying to match.

Perhaps we need to make approximation/correction more visible by
introducing parameters that are local to the completion system and only
contain text in the appropriate case (e.g. APPROX="(#a1)")?

-- 
Peter Stephenson <pws@xxxxxxx>                  Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK                          Tel: +44 (0)1223 692070



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