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

Re: "pws non-canonical hack" problems



On Aug 25,  5:47pm, Peter Stephenson wrote:
}
} On Sat, 23 Aug 2008 07:55:49 -0700
} > }
} > } _path_files:
} > } 387               if [[ -e "$tmp3${(Q)PREFIX}${(Q)SUFFIX}" ]] then
} > } 388                   tmp1+=("$tmp3${(Q)PREFIX}${(Q)SUFFIX}")
} > } 389               fi
} > } 
} > } When I completing directory, sometimes file is being completed.
} > 
} > The problem is that this code should not unconditionally append
} > something to tmp1. It has to test again (probably by using some
} > variant of the call to compfiles that appears 20 or so lines above)
} > that some new file really was created that matches the qualifiers in
} > the generated glob pattern.
} 
} Er, isn't that what the -e test does?  What I think you mean is there
} may be options to compfiles that don't get taken account of at this point.

I guess that's what I mean.  The -e test is not sufficient; compfiles
may have left tmp1 empty because "$tmp3${(Q)PREFIX}${(Q)SUFFIX}" names
a file that exists but is not a directory.  The -e test only confirms
that the name exists after attempting to access it, not that (a) that
name did not exist before and (b) it names the right type of object.
 
} Unfortunately, the file completion code was never very intelligible
} and there are way too many cases. If anyone can come up with a way of
} limiting this test in the right way, great.

It's pretty difficult for me to test because I don't have a file
system that behaves in this magical way.  But the answer, I think, is
to skip the tmp1+= inside the loop and call compfiles again after the
loop is finished.



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