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

PATCH: use of _path_commands



Here are the tweaks to put _path_commands into use.

Index: Completion/Zsh/Command/_command
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Zsh/Command/_command,v
retrieving revision 1.1
diff -u -r1.1 _command
--- Completion/Zsh/Command/_command	2 Apr 2001 11:26:50 -0000	1.1
+++ Completion/Zsh/Command/_command	19 Aug 2007 23:21:01 -0000
@@ -1,10 +1,12 @@
 #compdef command
 
+local ret
+
 if [[ CURRENT -ge 3 ]]; then
   compset -n 2
-  _normal
+  _normal && ret=0
 else
-  local expl
-
-  _wanted commands expl 'external command' compadd "$@" -k commands
+  _path_commands "$@" && ret=0
 fi
+
+return ret
Index: Completion/Zsh/Command/_hash
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Zsh/Command/_hash,v
retrieving revision 1.3
diff -u -r1.3 _hash
--- Completion/Zsh/Command/_hash	25 Jun 2003 09:03:06 -0000	1.3
+++ Completion/Zsh/Command/_hash	19 Aug 2007 23:21:01 -0000
@@ -33,7 +33,8 @@
   elif compset -P 1 '*='; then
     _wanted -C value values expl 'executable file' _files -g '*(-*)' && ret=0
   else
-    _wanted -C name commands expl command compadd -q -S '=' -k commands && ret=0
+    curcontext="${curcontext%:*}:name"
+    _path_commands -q -S '=' && ret=0
   fi
 fi
 
Index: Completion/Zsh/Command/_which
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Zsh/Command/_which,v
retrieving revision 1.3
diff -u -r1.3 _which
--- Completion/Zsh/Command/_which	25 Jun 2003 09:03:06 -0000	1.3
+++ Completion/Zsh/Command/_which	19 Aug 2007 23:21:01 -0000
@@ -28,7 +28,7 @@
   args=( "$@" )
 
   _alternative -O args \
-    'commands:external command:compadd -k commands' \
+    'commands:external command:_path_commands' \
     'builtins:builtin command:compadd -k builtins' \
     'functions:shell function:compadd -k functions' \
     'aliases:alias:compadd -k aliases' \
Index: Completion/Zsh/Context/_equal
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Zsh/Context/_equal,v
retrieving revision 1.3
diff -u -r1.3 _equal
--- Completion/Zsh/Context/_equal	8 Jun 2005 05:33:48 -0000	1.3
+++ Completion/Zsh/Context/_equal	19 Aug 2007 23:21:01 -0000
@@ -1,5 +1,3 @@
 #compdef -equal-
 
-local expl
-
-_wanted commands expl command compadd -k commands
+_path_commands
Index: Completion/Zsh/Type/_command_names
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Zsh/Type/_command_names,v
retrieving revision 1.8
diff -u -r1.8 _command_names
--- Completion/Zsh/Type/_command_names	6 Mar 2006 11:36:04 -0000	1.8
+++ Completion/Zsh/Type/_command_names	19 Aug 2007 23:21:01 -0000
@@ -9,7 +9,7 @@
 zstyle -t ":completion:${curcontext}:commands" rehash && rehash
 
 defs=(
-  'commands:external command:compadd -k commands'
+  'commands:external command:_path_commands'
 )
 
 [[ -n "$path[(r).]" || $PREFIX = */* ]] &&



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