Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Compctl completion tweaking

"Bart Schaefer" wrote:

> ...
> Yes; the confusion occurs when two or more of the "bunches of flags" both
> would apply if only both were tried.  Even extended completion performs
> an xor (it stops as soon as any pattern matches); how do you accomplish
> an -inclusive- or?  Suppose I want to express this:
>   If there is a word anywhere on the command line that begins with "co",
>   then complete file names.  In addition, if that word begins with "cons",
>   then complete directories as well.  Finally, if the word before the
>   current word is the name of a directory, then also complete commands.
> That is, if I have
>   zsh% foo cons /tmp z
> and I press C-d, I want to see a list of files, directories, and commands
> whose names begin with z, all in the same list.
> (Yes, I admit this is a highly contrived example.)

Currently the only way would be to use one `-x'-pattern for all three
of them, one for two of them, and one for the `co' alone (in this order).

So, if I understand you correctly, you really only want an an
inclusive or and that only with menucompletion and listing? Do you
want that to apply when automenu is used, too?

That last one is important for me. My examples played with the
difference between normal and menucompletion behaviour when automenu
is set. More precisely: I don't want it to suddenly switch from one
type of behaviour to the other.

A simple inclusive or is (of course) achieved by putting the flags
together without any `+', but that doesn't allow us to, e.g. define
multiple `-K' options or multiple combinations of flags with some of
the control-flags. If you wanted to point out this deficiency, I have
to agree, this is quite ugly. And of course the problem to write
down or'ed `-x'-patterns you mentioned sometimes makes compctls very
big and clumsy (i.e. there should be a way to...).

About the exclusively or'ed flags: my first example when I implemented
this (which is also what made me think of it and the example mentioned 
in the intro file) is the compctl for things like `latex'. Normally I
want `*.tex' files, but if there are none, I want something else (say
`-f' or whatever). But *if* there are any `*.tex' files I don't want
the completion code to use the xor'ed flags, I don't want to see them, 
I don't want to know about them (and thus, the completion code should
not even bother to look at them). Maybe the experience for people
using menucompletion is different here (I use only automenu), I would
like to know about that.


Sven Wischnowsky                         wischnow@xxxxxxxxxxxxxxxxxxxxxxx

Messages sorted by: Reverse Date, Date, Thread, Author