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

Re: file completion of ~user/... stats wrong directory



On Thu, 9 Jul 2009 13:53:25 -0400
Greg Klanderman <gak@xxxxxxxxxxxxxx> wrote:
> Looking at _path_files, I'm guessing it has something to do with
> setting prepaths=( '' ) in the logic dealing with ~ prefixed strings.
> But I don't understand what prepaths is supposed to be doing.  It
> worries me a bit that it is set to that same value in a number of
> other cases.  Maybe it should be setting prepaths=() instead?

prepaths comes from the -W option (see the zparseopts call), which is used
when you want the file matcher to behave as if there was a path
prefix---for example, to complete folders in your mail directory, you might
use "-W ~/Mail".

I think the reason it's not an empty array is that matches are eventually
generated in a loop over all -W paths.  If there are none, we still want to
execute that loop once, but with an empty prepath (at line 340):

for prepath in "$prepaths[@]"; do

-- 
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