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

Re: need help debugging cvs completion problem



On Sun, 28 Jun 2009 14:52:55 -0400
Greg Klanderman <gak@xxxxxxxxxxxxxx> wrote:
> this seems to work:
> 
> _cvs_existing_entries() {
>   local expl match linedir realdir files disp
>   match=()
>   : ${PREFIX:#(#b)(*/)(*)}
>   linedir="$match[1]"
>   realdir=${(e)~linedir}
>   [[ -f "$realdir"CVS/Entries ]] &&
>   disp=(${(@)${(@)${(@M)${(@f)"$(<"$realdir"CVS/Entries)"}:#/*}#/}%%/*})
>   files=( ${linedir}${(@)^disp} )
>   (( ${#disp} )) && _wanted files expl file compadd -d disp -a files
> }
> 
> except it now breaks when 'linedir' contains a parameter substitution,
> presumably the whole reason for the 'realdir' logic above, because the
> '$' in the parameter substitution gets escaped with '\'.  But
> presumably adding '-Q' to compadd would break completing files that
> contain characters that need to be escaped.  Should I do that, and
> escape characters that need it in $files?

That sounds plausible---I think you're on the right lines.  You might
need a -U argument to compadd in that case, too.

Basically, you are (anybody is) on your (their) own in this type of
thing---lots of us have been somewhere similar once or twice and it was
so complicated we've forgotten and won't remember again without devoting
hours to remembering why we thought it was better to forget in the first
place.

-- 
Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx>
Web page now at http://homepage.ntlworld.com/p.w.stephenson/



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