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

Re: Buglet in zsh perforce completion function



On Sun, 10 Jun 2007 01:19:09 -0700
Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
> } Also you've said that -p and -W are the same string, which
> } by my reading means [...] it would test for
> } the file "$dir/$dir/..." which can't possibly be what you mean.
> 
> ... still stands.

I think they do different things, since normal file completion uses
this form, at least in the context in question:

compadd -Qf -J files -X 'Completing file' -F _comp_ignore -p \
macrame/ -W macrame/ -R _perforce_file_suffix -M 'r:|/=* r:|=*' -a tmp1

However, I'm just going to avoid the problem by commenting out the
code that's causing it, which doesn't do very much.  It ought to be
possible to replace it using fake or fake-files, but currently the tags in
_perforce aren't helpful enough.

Index: Completion/Unix/Command/_perforce
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Unix/Command/_perforce,v
retrieving revision 1.36
diff -u -r1.36 _perforce
--- Completion/Unix/Command/_perforce	28 Nov 2006 21:57:28 -0000	1.36
+++ Completion/Unix/Command/_perforce	11 Jun 2007 08:59:59 -0000
@@ -858,14 +858,20 @@
 }
 
 
-(( $+functions[_perforce_subdirs] )) ||
-_perforce_subdirs() {
-  # This has no other function than to offer to add the `...' used
-  # by Perforce to indicate a recursive search of directories.
-  # Bit pathetic, really.
-  compset -P '*/'
-  compadd "$@" '...'
-}
+# This has no other function than to offer to add the `...' used
+# by Perforce to indicate a recursive search of directories.
+# Bit pathetic, really.
+#
+# This has been causing odd effects with prefixes so is turned off.
+#(( $+functions[_perforce_subdirs] )) ||
+#_perforce_subdirs() {
+#  if [[ $PREFIX = */* ]]; then
+#    local dir=${PREFIX%%[^/]#}
+#    compadd "$@" -J subdirs -p $dir ...
+#  else
+#    compadd "$@" -J subdirs ...
+#  fi
+#}
 
 
 (( $+functions[_perforce_depot_dirs] )) ||
@@ -1076,7 +1082,8 @@
       altfiles+=("client-dirs:client directory:_perforce_client_dirs")
     fi
     altfiles+=("depot-dirs:directory in depot:_perforce_depot_dirs"
-      "subdirs:subdirectory search:_perforce_subdirs")
+#      "subdirs:subdirectory search:_perforce_subdirs"
+    )
     _alternative $altfiles
   elif [[ -n $unmaintained && -z $dodirs ]]; then
     # a la _cvs_nonentried_files: directories are never maintained,
@@ -1113,7 +1120,7 @@
       altfiles+=("$type-files:$type file:_perforce_${type}_files")
     done
 
-    altfiles+=("subdirs:subdirectory search:_perforce_subdirs")
+#    altfiles+=("subdirs:subdirectory search:_perforce_subdirs")
     if zstyle -t ":completion:${curcontext}:" depot-files; then
       altfiles+=("depot-dirs:directory in depot:_perforce_depot_dirs")
     else
@@ -1126,13 +1133,15 @@
       altfiles+=("depot-files:file in depot:_perforce_depot_files")
     fi
     altfiles+=("depot-dirs:directory in depot:_perforce_depot_dirs"
-      "subdirs:subdirectory search:_perforce_subdirs")
+#      "subdirs:subdirectory search:_perforce_subdirs"
+    )
     _alternative $altfiles
   else
     # Look locally.
-    _alternative \
-      "files:file:_path_files -R _perforce_file_suffix $dodirs" \
-      "subdirs:subdirectory search:_perforce_subdirs"
+#   _alternative \
+#      "files:file:_path_files -R _perforce_file_suffix $dodirs" \
+#      "subdirs:subdirectory search:_perforce_subdirs"
+    _path_files -R _perforce_file_suffix $dodirs
   fi
 }
 


-- 
Peter Stephenson <pws@xxxxxxx>                  Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK                          Tel: +44 (0)1223 692070


To access the latest news from CSR copy this link into a web browser:  http://www.csr.com/email_sig.php

To get further information regarding CSR, please visit our Investor Relations page at http://ir.csr.com/csr/about/overview



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