From: Sven Wischnowsky <wischnow@informatik.hu-berlin.de>
To: zsh-users@sunsite.auc.dk
Subject: Re: completion with globbing, take 2
Date: Wed, 4 Oct 2000 13:14:20 +0200 (MET DST) [thread overview]
Message-ID: <200010041114.NAA09467@beta.informatik.hu-berlin.de> (raw)
In-Reply-To: "E. Jay Berkenbilt"'s message of Sun, 17 Sep 2000 19:03:05 -0400
E. Jay Berkenbilt wrote:
> ...
>
> _main_complete is called. It looks up my completers (_oldlist,
> _complete, _expand, and _match) and calls then in order. _oldlist
> returns nothing, _complete returns nothing (since no files start with
> '*'). Now it starts getting interesting. _expand is called. Since I
> have set the completions style for expand to true, it sets
> compstate[insert]=all which gives me the behavior I'm looking for with
> respect to the replacement. However, since the current context is not
> expand-word:*, it does not call _complete and thus just returns 1.
> Finally, _match is called. I don't follow exactly what's going on at
> the top of _match, but it doesn't matter. Since I don't have
> match-original set, _match sets compstate[pattern_match]='*' and calls
> _complete again. This time, since compstate[pattern_match] is set,
> _complete actually does find matches.
>
> So the right thing happens, but the path to the desired end seems
> quite convoluted and counterintuitive to me. I would never have
> figured this out without the significant hints without having to spend
> a lot of time grokking this code.
The first thing is that _expand is intended to be in the completer
list *before* _complete. And it was documented that way.
The other thing is that this kind of use, as you all found out,
doesn't really have anything to do with expansion and hence doesn't
need a pattern on the line -- which lead to _expand being used in
combination with _match and all that.
Hm. Maybe we should make the completer-handling of _expand with the
completions style set more clever. Or something. Probably together
with Bart's changes to _expand_word. I'll have a look.
I'll avoid digging through all the other messages in this thread
again, only one more remark:
Of course, the (implementation of the) completions style is a bit
hackish. And, more importantly, it was never intended to be set
unconditionally. Not too long a go, it was one of the mathematically-
conditional styles (if you don't know what that was, don't mind).
Nowadays it is intended to be used either with `zstyle -e' (where one
could, inter alia, have a look at the command line with $words,
$BUFFER or $PREFIX (to see if the word is a pattern or some such)) or
with, e.g., _generic, as in:
zle -C complete-all complete-word _generic
bindkey '^xa' complete-all
zstyle ':completion:complete-all:*' completer _expand _complete
zstyle ':completion:complete-all:*' completions yes
Bye
Sven
--
Sven Wischnowsky wischnow@informatik.hu-berlin.de
next reply other threads:[~2000-10-04 11:15 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2000-10-04 11:14 Sven Wischnowsky [this message]
-- strict thread matches above, loose matches on Subject: below --
2000-09-17 17:50 E. Jay Berkenbilt
2000-09-17 18:43 ` Bart Schaefer
2000-09-17 23:03 ` E. Jay Berkenbilt
2000-09-18 0:17 ` completion and globbing, part 2 E. Jay Berkenbilt
2000-09-18 6:07 ` completion with globbing, take 2 Andrej Borsenkow
2000-09-18 6:53 ` completion and globbing, part 2 Andrej Borsenkow
2000-09-18 9:59 ` insert-all-matches example " Andrej Borsenkow
2000-09-18 17:28 ` completion with globbing, take 2 Bart Schaefer
2000-09-18 18:08 ` Andrej Borsenkow
2000-09-19 2:02 ` Bart Schaefer
2000-09-20 15:06 ` Andrej Borsenkow
2000-09-20 16:12 ` Bart Schaefer
2000-09-18 22:07 ` E. Jay Berkenbilt
2000-09-19 2:14 ` Bart Schaefer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200010041114.NAA09467@beta.informatik.hu-berlin.de \
--to=wischnow@informatik.hu-berlin.de \
--cc=zsh-users@sunsite.auc.dk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).