Zsh Mailing List Archive
Messages sorted by:
Re: Compctl completion tweaking
- X-seq: zsh-workers 4175
- From: "Bart Schaefer" <schaefer@xxxxxxxxxxxxxxxx>
- To: Sven Wischnowsky <wischnow@xxxxxxxxxxxxxxxxxxxxxxx>, zsh-workers@xxxxxxxxxxxxxxx
- Subject: Re: Compctl completion tweaking
- Date: Fri, 26 Jun 1998 11:59:08 -0700
- In-reply-to: <199806260544.HAA16475@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>
- References: <199806260544.HAA16475@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>
On Jun 26, 7:44am, Sven Wischnowsky wrote:
} Subject: Re: Compctl completion tweaking
} > 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.
} 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?
No, not quite. The "and that only with ..." part is extraneous. It
happens that the only time it makes very much difference is with menus
and listings, because those are the only opportunities to see the entire
list of possibilities. But it ought to behave consistently no matter
what kind of completion is being performed, automenu or otherwise.
Part of the confusion arises because I didn't immediately understand the
full ramifications of "alternative completion" being an xor. Consider:
compctl -k '(co college collie)' + -k '(command control console)' foo
If I type "foo co<C-d>" I'll see only "co college collie", but if I then
add 'n' and C-d again I'll see "control console". It seemed silly to me
that the first listing didn't include all six possibilities. But on
further study of compctl-examples, I see that most cases of alternative
completion there's no way to switch from one set of alternatives to the
next simply by lengthening the prefix; they all begin with a uniqifier.
So this brought me to the observation that an inclusive-or is missing.
Menucompletion and listings were part of the trail, but they don't have
much to do with the destination.
} 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.
Hrm. For myself, I'd rarely if ever want possible command flags hidden
just because there happened to be some files in the current directory
that didn't require them. I use completion (and particularly automenu)
as a memory aid; typically I already know what files are there, but I
can't remember what flags I might want for a given command. I might in
some cases want to affect the *order* in which the completions were
presented, so that I see all the files first and then the flags; the
rigid asciibetical sorting that zsh imposes is sometimes frustrating.
But I probably wouldn't want to hide the options entirely.
Bart Schaefer Brass Lantern Enterprises
Messages sorted by: