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

Re: Update to _files in 27780 breaks chmod completion



Simon Ruderich wrote:
> On Thu, Mar 18, 2010 at 05:04:17PM +0000, Peter Stephenson wrote:
> > If you read that message, you'll find that's exactly what *didn't* work
> > for me before and *does* work now (as I just confirmed again).
> >
> > Are you sure you've got the latest executable as well as the latest
> > functions?  The code changed in the patch for users/14905.
> 
> Ah, that's the problem. I'm using Zsh 4.3.6 with a current
> checkout of the completion functions. Until now that always
> worked perfectly.
> 
> Is there any chance this can still be supported or should I just
> unapply the patch locally?

Generally there's never any guarantee that functions with one
distribution will work with another, since in all "production"
installations this isn't an issue as $fpath is set appropriately.

However, I think the following should work in both versions and I'd be
interested to hear about it going wrong...  In fact I'm not sure why the
code uses ":gs" instead off "//" which is a more obvious operator at
this point.  Possibly the latter used to be flakey.

Index: Completion/Unix/Type/_files
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Unix/Type/_files,v
retrieving revision 1.12
diff -p -u -r1.12 _files
--- Completion/Unix/Type/_files	15 Mar 2010 10:19:38 -0000	1.12
+++ Completion/Unix/Type/_files	18 Mar 2010 17:56:11 -0000
@@ -90,7 +90,7 @@ fi
 
 tried=()
 for def in "$pats[@]"; do
-  eval "def=( ${${def:gs/\\:/\\\\\\:}//(#b)([][()|*?^#~<>])/\\${match[1]}} )"
+  eval "def=( ${${def//\\:/\\\\\\:}//(#b)([][()|*?^#~<>])/\\${match[1]}} )"
 
   tmp="${(@M)def#*[^\\]:}"
   (( $tried[(I)${(q)tmp}] )) && continue


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