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

Re: File completion for co



Vincent Lefevre wrote:

> With zsh 3.1.9, file completion for co doesn't work. Why?

Because it only ever tried to complete files from the RCS
sub-directory (no attempt to complete all files per default).

Try this patch.

To workers: however wrote _rcs should have a look at these changes,
but ignoring the return value of _files and using $PREFIX*$SUFFIX for
matching wasn't the right thing to do.

Bye
 Sven

Index: Completion/User/_rcs
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/User/_rcs,v
retrieving revision 1.3
diff -u -r1.3 _rcs
--- Completion/User/_rcs	2000/05/31 09:38:26	1.3
+++ Completion/User/_rcs	2000/10/25 12:25:17
@@ -1,12 +1,14 @@
 #compdef co ci rcs
 
-local nm=$compstate[nmatches] cmd="${words[1]:t}"
+local nm=$compstate[nmatches] cmd="${words[1]:t}" ret=1
 
-[[ $cmd = ci || $cmd = rcs ]] && _files
-
 if [[ $compstate[nmatches] -eq nm && -d RCS && $cmd != ci ]]; then
   local rep expl
 
-  rep=(RCS/$PREFIX*$SUFFIX,v(:t:s/\,v//))
-  (( $#rep )) && _wanted files expl 'RCS file' compadd -a rep
+  rep=(RCS/*,v(:t:s/\,v//))
+  (( $#rep )) && _wanted files expl 'RCS file' compadd -a rep && ret=0
 fi
+
+[[ $cmd = ci || $cmd = rcs || ret -eq 1 ]] && _files && ret=0
+
+return ret

--
Sven Wischnowsky                         wischnow@xxxxxxxxxxxxxxxxxxxxxxx



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