zsh-workers
 help / color / mirror / code / Atom feed
* Completion widgets, bindkey and ZLE widgets
@ 1999-03-24 11:49 Andrej Borsenkow
  0 siblings, 0 replies; 3+ messages in thread
From: Andrej Borsenkow @ 1999-03-24 11:49 UTC (permalink / raw)
  To: ZSH workers mailing list

Currently we have to use bindkey to activate completion widgets. I
understand, that it was the simplest way in the beginning (and safest, must
I add :-) Unfortunately it means, that
you must select your keymap before loading completion and only one keymap is
modified. This is particulary annoying, when you change keymap after that. I
was very confused by the fact, that I have EDITOR=vim and bidkey -e by
default; this results in selecting vi mode with zsh -f - and after I
switched to emacs, all new completion was lost. And if on-the-fly keymap
switching will be implemented (actually, internally we already have it -
between viins and vicmd and from emacs to vi), this may be a real problem.

Now, that new completion is already proven fact, why not simply redefine
completion widgets? zle -C complete-word complete-word FUNCTION. The
original widget is always available (.complete-word) and you can change back
in any time. And this will make completion widgets available in any keymap.

A step further is to unify normal widgets (zle -N) and completion (zle -C).
Consider:

widgets are always called using standard interface described in ZLE (with
all parameters likes BUFFER, NUMERIC etc set).

if this is a completion widget, additional parameters (and arguments) are
setup.

We still need to designate widget as completion widget in this case, so
zle -N won't work - but -C can then be reduced to simple 'zle -C expand-word
function'. That will redefine complete-word and mark new widget as
completion widget.

Looks somewhat cleaner ... and, later, if we find the way to make ZLE
widgets more useful, that will be automatically available to completion
widgets as well.

cheers

/andrej


^ permalink raw reply	[flat|nested] 3+ messages in thread

* RE: Completion widgets, bindkey and ZLE widgets
  1999-03-24 12:17 Sven Wischnowsky
@ 1999-03-24 12:52 ` Andrej Borsenkow
  0 siblings, 0 replies; 3+ messages in thread
From: Andrej Borsenkow @ 1999-03-24 12:52 UTC (permalink / raw)
  To: zsh-workers


Well, I tried to redefine widgets instead of bindkey - and it works. And the
completion is available after switching keymaps as well.

>
> What if you want more than one completion widget behaving like one of
> the builtin widgets? (Just think of the special key completion widgets
> we already have.)
>

It was just an idea ... But, really, let's see, what builtin widgets
describe:

1. Should we first try to glob
2. should we complete prefix or whole word
3. should we list or insert matches
4. should we start menu completion or not

Most (if not all) of this can already be emulated by setting compstate
before calling main completion function. The case of delete-char-or-list is
somewhat hard ... but if it would be possible to call ZLE widget, that could
test, if we are not at the end and then call completion ...

>> Looks somewhat cleaner ... and, later, if we find the way to make ZLE
>> widgets more useful, that will be automatically available to completion
>> widgets as well.
> What are you thinking about here?

Calling one widget from other (like above), getting user input from inside
of widget ... mostly this all were discussed already.

cheers

/andrej


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Completion widgets, bindkey and ZLE widgets
@ 1999-03-24 12:17 Sven Wischnowsky
  1999-03-24 12:52 ` Andrej Borsenkow
  0 siblings, 1 reply; 3+ messages in thread
From: Sven Wischnowsky @ 1999-03-24 12:17 UTC (permalink / raw)
  To: zsh-workers


Andrej Borsenkow wrote:

> A step further is to unify normal widgets (zle -N) and completion (zle -C).
> Consider:
> 
> widgets are always called using standard interface described in ZLE (with
> all parameters likes BUFFER, NUMERIC etc set).
> 
> if this is a completion widget, additional parameters (and arguments) are
> setup.

It's actually a bit more than this that has to be done to start a
completion widget -- the completion code has to do quite a bit of
initialisation before the shell function can be called.

> We still need to designate widget as completion widget in this case, so
> zle -N won't work - but -C can then be reduced to simple 'zle -C expand-word
> function'. That will redefine complete-word and mark new widget as
> completion widget.

What if you want more than one completion widget behaving like one of
the builtin widgets? (Just think of the special key completion widgets 
we already have.)

> Looks somewhat cleaner ... and, later, if we find the way to make ZLE
> widgets more useful, that will be automatically available to completion
> widgets as well.

What are you thinking about here?

Bye
 Sven


--
Sven Wischnowsky                         wischnow@informatik.hu-berlin.de


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~1999-03-24 12:53 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-03-24 11:49 Completion widgets, bindkey and ZLE widgets Andrej Borsenkow
1999-03-24 12:17 Sven Wischnowsky
1999-03-24 12:52 ` Andrej Borsenkow

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).