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

PATCH: Completion for AUTO_CD



This should be pretty self-explanatory, except for the fact that it's
named _autocd because _command is pre-empted for the `command' builtin.

There doesn't seem to be a lot of documentation for the context funcs.
Some of them get mentioned in a few places as if people should know that
they exist (e.g. _default in the use-compctl entry) but that's all, so
I didn't document this one either.

May I add this to 4.0.2?

On a semi-related note, why doesn't _command call `_command_names -e'?

Index: Completion/Zsh/Context/_autocd
===================================================================
RCS file: _autocd
diff -N _autocd
--- /dev/null	Tue May  5 13:32:27 1998
+++ Completion/Zsh/Context/_autocd	Thu Jun 21 01:55:18 2001
@@ -0,0 +1,5 @@
+#compdef -command-
+
+_command_names
+local ret=$?
+[[ -o autocd ]] && _cd || return ret
Index: Completion/Zsh/Command/_cd
===================================================================
RCS file: /extra/cvsroot/zsh/zsh-4.0/Completion/Zsh/Command/_cd,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 _cd
--- Completion/Zsh/Command/_cd	2001/04/09 20:14:09	1.1.1.1
+++ Completion/Zsh/Command/_cd	2001/06/21 08:48:03
@@ -24,7 +24,7 @@
   rep=(${${rep#${PWD%%$words[2]*}}%${PWD#*$words[2]}})
   (( $#rep )) && _wanted -C replacement strings expl replacement compadd -a rep
 else
-  _directory_stack && ret=0
+  [[ CURRENT -gt 1 ]] && _directory_stack && ret=0
 
   if [[ $PREFIX != (\~|/|./|../)* && $#cdpath -ne 0 ]]; then
     local tdir tdir2
Index: Completion/Zsh/Type/_command_names
===================================================================
RCS file: /extra/cvsroot/zsh/zsh-4.0/Completion/Zsh/Type/_command_names,v
retrieving revision 1.2
diff -u -r1.2 _command_names
--- Completion/Zsh/Type/_command_names	2001/06/18 18:01:55	1.2
+++ Completion/Zsh/Type/_command_names	2001/06/21 08:54:50
@@ -1,4 +1,4 @@
-#compdef -command-
+#autoload
 
 # The option `-e' if given as the first argument says that we should
 # complete only external commands and executable files. This and a

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com

Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net   



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