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

Re: _path_files returning an error



On Fri, 8 Feb 2008 15:09:13 -0800
William Scott <wgscott@xxxxxxxxxxxxxxxxxx> wrote:
> It returns this error, new to  4.3.5:
> 
> zsh-% open -a TextMate <tab>
> _path_files:compfiles:357: too few arguments

Bill's sent me a trace (thanks) and I've traced it back... it's
an incorrect array index [0] which is no longer hacked to [1].

I finally had the presence of mind to search the completion code
for [0]'s to fix.  (bashcompinit's compgen uses "emulate -L sh".)


Index: Completion/Darwin/Type/_mac_files_for_application
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Darwin/Type/_mac_files_for_application,v
retrieving revision 1.1
diff -u -r1.1 _mac_files_for_application
--- Completion/Darwin/Type/_mac_files_for_application	12 Nov 2004 11:47:43 -0000	1.1
+++ Completion/Darwin/Type/_mac_files_for_application	11 Feb 2008 16:17:53 -0000
@@ -66,7 +66,7 @@
 
   case ${#glob_patterns} in
     0) return 1 ;;
-    1) _files "$opts[@]" -g "$glob_patterns[0]" ;;
+    1) _files "$opts[@]" -g "$glob_patterns[1]" ;;
     *) _files "$opts[@]" -g "{${(j/,/)glob_patterns}}" ;;
   esac
 }
Index: Completion/Unix/Command/_locate
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Unix/Command/_locate,v
retrieving revision 1.1
diff -u -r1.1 _locate
--- Completion/Unix/Command/_locate	27 Sep 2006 14:50:25 -0000	1.1
+++ Completion/Unix/Command/_locate	11 Feb 2008 16:17:53 -0000
@@ -1,7 +1,7 @@
 #compdef locate mlocate slocate
 
 # Decide if we are using mlocate or slocate.
-local ltype basename=${words[0]:t} input
+local ltype basename=${words[1]:t} input
 # If we can't, use this guess.
 local best_guess=mlocate
 
@@ -11,7 +11,7 @@
   ;;
 
   (locate)
-  input="$(_call_program locate $words[0] -V)"
+  input="$(_call_program locate $words[1] -V)"
   case $input in
     (*mlocate*)
     ltype=mlocate

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