zsh-workers
 help / color / mirror / code / Atom feed
* Skipping certain completers -- how?
@ 2001-06-14 17:23 Bart Schaefer
  2001-06-15  7:07 ` Sven Wischnowsky
  0 siblings, 1 reply; 3+ messages in thread
From: Bart Schaefer @ 2001-06-14 17:23 UTC (permalink / raw)
  To: zsh-workers

I have:

zstyle ':completion:*' completer \
    _oldlist _expand _complete _match _ignored _approximate _prefix

I'd like to use only a subset of that list in certain instances, but the
completer style is looked up with context ':completion:::::' so it's not
possible to use the context to restrict the list.

A specific example:  When completing the cvs subcommand name (the first
word after `cvs' itself) I'd rather that _expand, _ignored, and _prefix
were NOT called.

My guess is that this can only be accomplished with a "control function"
similar to _prefix except operating sort of in reverse -- that is, you
make that function your only completer, then give the "real" completers
in a nother style that's looked up by the control function, which then
calls them.

We also have the avoid-completer style that could be used to give a list
of completers to skip in such a control function.

Can anyone think of anything else that would be involved, or of a better
way to accomplish this?

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com

Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net   


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

* Re: Skipping certain completers -- how?
  2001-06-14 17:23 Skipping certain completers -- how? Bart Schaefer
@ 2001-06-15  7:07 ` Sven Wischnowsky
  2001-06-15  9:39   ` Bart Schaefer
  0 siblings, 1 reply; 3+ messages in thread
From: Sven Wischnowsky @ 2001-06-15  7:07 UTC (permalink / raw)
  To: zsh-workers

Bart Schaefer wrote:

> I have:
> 
> zstyle ':completion:*' completer \
>     _oldlist _expand _complete _match _ignored _approximate _prefix
> 
> I'd like to use only a subset of that list in certain instances, but the
> completer style is looked up with context ':completion:::::' so it's not
> possible to use the context to restrict the list.
> 
> A specific example:  When completing the cvs subcommand name (the first
> word after `cvs' itself) I'd rather that _expand, _ignored, and _prefix
> were NOT called.
> 
> My guess is that this can only be accomplished with a "control function"
> similar to _prefix except operating sort of in reverse -- that is, you
> make that function your only completer, then give the "real" completers
> in a nother style that's looked up by the control function, which then
> calls them.
> 
> We also have the avoid-completer style that could be used to give a list
> of completers to skip in such a control function.
> 
> Can anyone think of anything else that would be involved, or of a better
> way to accomplish this?

There is the -e option to zstyle, of course (and I've added an example
for the `completer' style with it some time ago -- in the Overview
section in compsys.yo).  But I have been thinking about something
similar to what you describe above, too (maybe I even mentioned it here?
maybe not).

The problem is to decide which conditions we should make it be
conditional upon, there are so many things people might want to test.

Btw, I hope to find a way to do the context-check of the completion
system without generating completions one day (so that it can be called
from other widgets). That would then be a good candidate to put into
another pseudo-completer -- a little extra cost gives one a fully
specified context from the beginning (or maybe it should be triggered by
a style in _main_complete). I don't know when (or if) I'll find the time
to try to write that, though.

Bye
  Sven


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


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

* Re: Skipping certain completers -- how?
  2001-06-15  7:07 ` Sven Wischnowsky
@ 2001-06-15  9:39   ` Bart Schaefer
  0 siblings, 0 replies; 3+ messages in thread
From: Bart Schaefer @ 2001-06-15  9:39 UTC (permalink / raw)
  To: zsh-workers

On Jun 15,  9:07am, Sven Wischnowsky wrote:
}
} There is the -e option to zstyle, of course (and I've added an example
} for the `completer' style with it some time ago -- in the Overview
} section in compsys.yo).

Er, ahem, yes, ah, well ...

That does almost solve the specific cvs example, but it means writing
your own set of tests for what the context is.  That is, I want the
restriction to apply to the subcommand name, and it'd be OK if it also
applied to any options either of cvs or of the subcommand, but I don't
want to restrict the completers used for the actual file arguments.

} I have been thinking about something similar to [a control function.]
} The problem is to decide which conditions we should make it be
} conditional upon, there are so many things people might want to test.

There, zstyle -e can be used to even better effect.  The "hard part" has
been done by computing the context; the rest of the conditions can then
be included in the value of the style.

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com

Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net   


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

end of thread, other threads:[~2001-06-15  9:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-06-14 17:23 Skipping certain completers -- how? Bart Schaefer
2001-06-15  7:07 ` Sven Wischnowsky
2001-06-15  9:39   ` Bart Schaefer

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