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

PATCH: RE: _path_files and _cd with explicit glob pattern



Andrej Borsenkow wrote:

> Ehem ... cd first looks in the current directory. So
> 
> bor@itsrm2:~/test%> ls -l cd
> total 0
> drwxr-xr-x   2 bor      sinix         96 Mar 19 12:55 foo
> bor@itsrm2:~/test%> echo $cdpath
> /home/bor/test/cd
> bor@itsrm2:~/test%> cd c/*oTAB
>   Beeps, but
> bor@itsrm2:~/test%> cd cd/foo
> bor@itsrm2:~/test/cd/foo%>
> 
> So, it looks, like cd completion ignores current directory

Right. The patch fixes also a little problem I just stumbled over in
`_path_files' (it was too eager to switch on menu-behavior).

Bye
 Sven

diff -u oc/Builtins/_cd Completion/Builtins/_cd
--- oc/Builtins/_cd	Mon Mar 15 10:08:49 1999
+++ Completion/Builtins/_cd	Fri Mar 19 11:59:54 1999
@@ -59,7 +59,7 @@
 
   return ret
 elif [[ $PREFIX != (\~|/|./|../)* && $#cdpath -ne 0 ]]; then
-  _path_files -W cdpath -/
+  _path_files -W "(. $cdpath)" -/
 else
   _path_files -/
 fi
diff -u oc/Core/_path_files Completion/Core/_path_files
--- oc/Core/_path_files	Mon Mar 15 12:51:38 1999
+++ Completion/Core/_path_files	Fri Mar 19 11:57:25 1999
@@ -111,7 +111,7 @@
 
 [[ $compstate[insert] = *menu || -n "$_comp_correct" ||
    ( $#compstate[pattern_match] -ne 0 &&
-     "$orig" != "${orig:q}" ) ]] && menu=yes
+     "${orig#\~}" != "${${orig#\~}:q}" ) ]] && menu=yes
 
 
 # We will first try normal completion called with `compgen', but only if we

--
Sven Wischnowsky                         wischnow@xxxxxxxxxxxxxxxxxxxxxxx



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