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

Re: PATCH: Re: completion after ../



In article <200001211339.OAA04917@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>,
  Sven Wischnowsky <wischnow@xxxxxxxxxxxxxxxxxxxxxxx> writes:

> Let's try it...

I tried it but it doesn't work for me even after one typo fix.

Z:akr@is27e1u11% Src/zsh -f
is27e1u11% bindkey -e; fpath=($PWD/Completion/*(/)); autoload -U compinit; compinit -D; compdef _tst tst
is27e1u11% mkdir -p tstdir/{foo,bar}
is27e1u11% cd tstdir
is27e1u11% ls
bar  foo
is27e1u11% zstyle '*' ignore-parents parent
is27e1u11% ls foo/../<TAB>
bar/  foo/

`foo/' shouldn't be listed, I think.

set -x says (after the patch in this message is applied):
is27e1u11% ls foo/../<TAB>
...
+_description:33> zstyle -a :completion:complete::ls::files ignored-patterns _comp_ignore
+_description:36> _comp_ignore=( ) 
...
+_path_files:344> compadd -D tmp1 -F _comp_ignore - bar foo
...
+_path_files:308> zstyle -s :completion:complete::ls::files ignore-parents rem
...
+_path_files:320> _comp_ignore=( foo/../foo ) 
...
+_path_files:474> compadd -Qf -p foo/../ -W foo/../ -M r:|/=* r:|=*  -J -default- - bar foo
...

The updated _comp_ignore is not used.

> Note however, that there is no automatic switching to list-only and no 
> way to get at the ignored directories on a second TAB or something
> like this. The ignored names are put in the alternate set so that one
> gets them if no other names match.
> 
> 
> I think what sometimes irritated me can be fixed with `pwd' or maybe
> `pwd ..' and Tanaka's with `parent' or `parent ..'. I hope.

Hm.  It's not enough for me.  Sometimes I hit <TAB> after a path which
contains only one directory.  Suppose zsh-3.1.6-dev-15 is installed
in its own prefix /app/zsh-3.1.6-dev-15 and the current working
directory is /app/zsh-3.1.6-dev-15/share/zsh/3.1.6-dev-15/functions.
When completion is tried as `cd ../../../<TAB>', the alternative set
has only one entry `zsh' and non-alternative set is empty if I
understand the style correctly and it works well.  So zsh completes
the line as `cd ../../../zsh/'.  But it frustrates me because I must
remove `zsh/' before adding `../'.  I hope a style to automatic
switching to list-only.  Although I tried to do it, I couldn't find a
way.

Index: Completion/Core/_path_files
===================================================================
RCS file: /projects/zsh/zsh/Completion/Core/_path_files,v
retrieving revision 1.1.1.61
diff -u -r1.1.1.61 _path_files
--- Completion/Core/_path_files	2000/01/21 16:33:49	1.1.1.61
+++ Completion/Core/_path_files	2000/01/21 17:28:33
@@ -311,7 +311,7 @@
         if [[ "$rem" = *parent* ]]; then
 	  for i in "$tmp2[@]"; do
 	    if [[ -d "$i" && "$i" = */* ]]; then
-	      remt="${i/*}"
+	      remt="${i%/*}"
 	      while [[ "$remt" = */* ]]; do
 		[[ "$remt" -ef "$i" ]] && break
 		remt="${remt%/*}"
-- 
Tanaka Akira



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