From: Sven Wischnowsky <wischnow@informatik.hu-berlin.de>
To: zsh-workers@sunsite.auc.dk
Subject: Re: Having different completion widgets
Date: Tue, 25 Apr 2000 10:18:44 +0200 (MET DST) [thread overview]
Message-ID: <200004250818.KAA01299@beta.informatik.hu-berlin.de> (raw)
In-Reply-To: Felix Rosencrantz's message of Sun, 23 Apr 2000 19:18:58 -0700 (PDT)
Felix Rosencrantz wrote:
> ...
>
> I tried writing a simple completion widget, _alt_complete, which can
> change the function field to the name of the current widget. Using zle -C,
> and zstyle it would be possible to get a lot of different completion behaviors:
>
> zle -C widget1 .complete-word _alt_complete
> zle -C widget2 .complete-word _alt_complete
> zle -C widget3 .complete-word _alt_complete
> zstyle ':completion:widget1:*' completer _oldlist _complete '_correct'
> '_approximate' _complete _prefix _history
> zstyle ':completion:widget2:*' completer _oldlist _menu _complete _correct
> '_approximate'
> zstyle ':completion:widget3:*' completer _oldlist _complete '_prefix'
>
> _alt_complete () {
> local curcontext="$curcontext"
>
> [[ -z "$curcontext" ]] && curcontext=:::
> curcontext="$WIDGET:${curcontext#*:}"
>
> _main_complete "$@"
> }
>
> This works fine. Though, I was thinking that it would be possible to provide
> even more flexibility by putting a call into _main_complete with _funcall
> to a hook function that could decide on how to change curcontext based on
> whatever criteria the user wants. We could provide some simple example
> hook functions that would set the function field based on things like
> the current widget, the value of a shell variable, hostname, OS, etc.
>
> ...
>
> It seems that this would provide an easy way to provide some useful
> alternatives to the command widgets (e.g. _correct_word, most_recent_file)
> using the main completion widget.
>
> Does this seem useful? Is it useful enough to include in the distribution?
> Is there a better or more appropriate way to offer this functionality?
I don't have any strong feelings about this (which means I'm not
against it ;-). But I always like extensibility and I hadn't thought
about customizing key bindings more than we can do now...
Hm, I think I would either put everything into _main_complete,
something like (untested):
[[ $#funcstack -eq 1 && $WIDGET != _main_complete ]] &&
{ _funcall ... || curcontext=... }
Or put everything, including the _funcall in the _alt_complete
bindable command. Dunno.
Bye
Sven
--
Sven Wischnowsky wischnow@informatik.hu-berlin.de
next reply other threads:[~2000-04-25 8:19 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2000-04-25 8:18 Sven Wischnowsky [this message]
-- strict thread matches above, loose matches on Subject: below --
2000-04-24 2:18 Felix Rosencrantz
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=200004250818.KAA01299@beta.informatik.hu-berlin.de \
--to=wischnow@informatik.hu-berlin.de \
--cc=zsh-workers@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).