Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: PATCH: Re: completion after ../
- X-seq: zsh-workers 9414
- From: Sven Wischnowsky <wischnow@xxxxxxxxxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxxxxxxxxx
- Subject: Re: PATCH: Re: completion after ../
- Date: Mon, 24 Jan 2000 10:10:53 +0100 (MET)
- In-reply-to: Tanaka Akira's message of 22 Jan 2000 03:11:48 +0900
- Mailing-list: contact zsh-workers-help@xxxxxxxxxxxxxx; run by ezmlm
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 <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 `../'.
[ 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@xxxxxxxxxxxxxxxxxxxxxxx
Messages sorted by:
Reverse Date,
Date,
Thread,
Author