From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11741 invoked from network); 24 Jan 2000 09:11:01 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 24 Jan 2000 09:11:01 -0000 Received: (qmail 11738 invoked by alias); 24 Jan 2000 09:10:54 -0000 Mailing-List: contact zsh-workers-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 9414 Received: (qmail 11730 invoked from network); 24 Jan 2000 09:10:54 -0000 Date: Mon, 24 Jan 2000 10:10:53 +0100 (MET) Message-Id: <200001240910.KAA02702@beta.informatik.hu-berlin.de> From: Sven Wischnowsky To: zsh-workers@sunsite.auc.dk In-reply-to: Tanaka Akira's message of 22 Jan 2000 03:11:48 +0900 Subject: Re: PATCH: Re: completion after ../ Tanaka Akira wrote: > ... > > The updated _comp_ignore is not used. Ouch. The patch should fix this. > > 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 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 ../../../', 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 `../'. [ This should be quite easy using undo... but, see below. ] > I hope a style to automatic > switching to list-only. Although I tried to do it, I couldn't find a > way. I have several problems with this. First, at least for me, this is probably quite irritating. Second: how to do it. It is possible, of course, but we would have to set some flag when parent directories have been ignored, and test that flag at the very end of completion because only then do we know if there is only one match. I.e. the code for it would be scattered between _path_files and, say, _main_complete. Maybe it is enough if we add a special value to ignore_parents so that the special-dirs (`..' and `.' are added to the alternate set if there were ignored directories (we could also do that only if ignore-parents leaves the normal set empty and the alternate set with only one string, but if _path_files is called more than once or any other completion function is called, the result may again be not what one wants). Or maybe we write a completer (a real, top-level completer) that registers a post-completion function which checks if there are only alternate matches (or only one alternate match) and no normal one and, if this is the case, makes a list be shown instead of the match(es) be used. That would be quite easy (set compstate[insert]='', compstate[list]='list force'), , but I'm not sure if this is enough or the right thing at all. Bye Sven diff -ru ../z.old/Completion/Core/_path_files Completion/Core/_path_files --- ../z.old/Completion/Core/_path_files Mon Jan 24 09:58:01 2000 +++ Completion/Core/_path_files Mon Jan 24 09:59:14 2000 @@ -326,6 +326,8 @@ [[ "$i" -ef "$PWD" ]] && _comp_ignore=( "$_comp_ignore[@]" "${(q)i}" ) done fi + (( $#_comp_ignore )) && (( $expl[(I)-F] )) || + expl=( "$expl[@]" -F _comp_ignore ) fi if [[ "$sopt" = *[/f]* && ( -o globdots || "$PREFIX" = .* ) ]] && zstyle -s ":completion${curcontext}:paths" special-dirs atmp; then -- Sven Wischnowsky wischnow@informatik.hu-berlin.de