Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
RE: PATCH: cleanup in zle_tricky.c
- X-seq: zsh-workers 5879
- From: Sven Wischnowsky <wischnow@xxxxxxxxxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxxxxxxxxx
- Subject: RE: PATCH: cleanup in zle_tricky.c
- Date: Mon, 22 Mar 1999 16:29:50 +0100 (MET)
- In-reply-to: "Andrej Borsenkow"'s message of Mon, 22 Mar 1999 17:09:48 +0300
- Mailing-list: contact zsh-workers-help@xxxxxxxxxxxxxx; run by ezmlm
Andrej Borsenkow wrote:
> Ahem ... With old good ZSH ...
>
> bor@itsmx1:~/tmp%> echo $ZSH_VERSION
> 3.1.4
> bor@itsmx1:~/tmp%> l foo
> a1 b1 x1y
> bor@itsmx1:~/tmp%> setopt globcomplete
> bor@itsmx1:~/tmp%> l foo/*1TAB
> bor@itsmx1:~/tmp%> l foo/a1
> foo/a1 foo/b1
> bor@itsmx1:~/tmp%> unsetopt globcomplete
> bor@itsmx1:~/tmp%> l foo/*1TAB
> bor@itsmx1:~/tmp%> l foo/a1 foo/b1
>
> With old style completion and with new style completion and
> > not setting compstate[pattern_match] to anything not starting with a
> > `*', glob completion will insert a `*' at the cursor position.
> > Globbing is only done if expand-or-complete is used and GLOB_COMPLETE
> > is not set, as always.
>
> Sorry? If I can believe manuals (and at least 3.1.4 as you see agrees with
> me :-), in case of expand-or-complete globbing is *always* done first. Only
> if it fails, we do completion. GLOB_COMPLETE tells a) how to insert matches
> and b) what to do if _first_ globbing fails. And I really like this, and I'd
> like to have it back :-)
We are discussion two different things simultaneously, let's separate
them:
1) expand-or-complete and GLOB_COMPLETE
When GLOB_COMPLETE is set, this always kept glob-patterns from being
expanded -- as one can see in the test with 3.1.4 you have shown
above. In fact, if globbing would always be used first,
GLOB_COMPLETE would be pretty useless, wouldn't it?
Also, it would have surprised me if my patches would have changed
this behavior (which I can confirm with 3.0.5 and 3.1.4) since I
didn't even come near the test that keeps globbing from being used
when GLOB_COMPLETE is set. And this at least was documented:
When the current word has a glob pattern, do not insert all the words
resulting from the expansion but generate matches as for completion
2) inserting a `*' with GLOB_COMPLETE
After trying it with 3.0.5 and 3.1.4 I can say that they really
behaved the same way it does now, always inserting the `*',
different from what you have shown above, and it works for me with
both old and new completion -- is your 3.1.4 some interim version?
> With brand new zsh (without your last patch) with GLOB_COMPLETE:
>
> bor@itsrm2:~/test%> touch cd/{a1,b1,x1y}
> bor@itsrm2:~/test%> l cd/*1TAB
> bor@itsrm2:~/test%> l cd/a1
> a1 b1 x1y
>
> Without GLOB_COMPLETE it simply beeps.
With GLOB_COMPLETE this is as it should be, without GLOB_COMPLETE I
get the filenames inserted when using expand-or-complete and nothing
with complete-word -- which is as it should be, too.
So, if you still get behavior different from the one I described, I'd
like to find out why, but can't do that without further information.
For now I'd just change the docs -- they where wrong, indeed.
Now we can discuss if we should change something, and how (although
that would be an incompatible change, so...).
Side note: we could easily implement a completer function that
temporarily switches on compstate[pattern_match] and then tries
completion, so that with `compconf completer=_complete:_glob_complete'
and GLOB_COMPLETE unset one would get globbing completion only if
non-globbing completion didn't generate any matches (I'm currently in
search of things we could use this completer stuff for...;-).
Bye
Sven
diff -u od/Zsh/options.yo Doc/Zsh/options.yo
--- od/Zsh/options.yo Mon Mar 22 13:45:07 1999
+++ Doc/Zsh/options.yo Mon Mar 22 15:51:09 1999
@@ -343,11 +343,11 @@
item(tt(GLOB_COMPLETE))(
When the current word has a glob pattern, do not insert all the words
resulting from the expansion but generate matches as for completion and
-cycle through them like tt(MENU_COMPLETE). If no matches are found, a
-`tt(*)' is added to the end of the word or inserted at the cursor if
-tt(COMPLETE_IN_WORD) is set, and completion is attempted again using
-pattern matching. Since this doesn't use globbing, it works not only for
-files but for all completions, such as options, user names, etc.
+cycle through them like tt(MENU_COMPLETE). The matches are generated
+as if a `tt(*)' is added to the end of the word or inserted at the cursor if
+tt(COMPLETE_IN_WORD) is set. Since this doesn't use globbing, it
+works not only for files but for all completions, such as options,
+user names, etc.
)
pindex(GLOB_DOTS)
cindex(globbing, of . files)
--
Sven Wischnowsky wischnow@xxxxxxxxxxxxxxxxxxxxxxx
Messages sorted by:
Reverse Date,
Date,
Thread,
Author