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

Re: make completion on OpenBSD

On Sun, 26 May 2002, Jukka Lehti wrote:

> Anyway, I've made some silly mistake, now it seems
> that following works on Linuxes too, after all:
> compctl -s "$(awk '/^[a-zA-Z0-9][^\/ \t]+:/ {print
> $1}' FS=: [Mm]akefile)" -x 'c[-1,-f]' -f --
> {,g,gnu,p,v}make
> (So backslashes not needed before $'s. Why backslashes
> do not work with BSD awk is a mystery.)
> Sorry for wasting everyones time here.

On Sun, 26 May 2002, Jukka Lehti wrote:

> Argh.. This seems to be hopeless. If backslashes are
> not used, on Linux root gets an error:
> /root/.zshrc:613: no match

That's what I was trying to tell you.  If you remove
the backslashes, then the $(awk ...) runs at the time
that you *define* the compctl, rather than at the time
that you attempt a completion.  That's the effect of
having it inside double quotes.  So without the
backslashes, it only "works" if you run the compctl
command in the same directory that holds the Makefile.

Furthermore, with the backslashes present, they should
be getting removed by zsh at the time it parses the
double quoted string, long before awk gets anywhere
near it.  The whole thing with the backslashed dollar
signs is a wild goose chase; the problem is somewhere
else, and it's almost certainly something to do with

> > In any event, since you're using zsh-4.0.4, why
> > not abandon your compctl entirely and enable the
> > newer completion system?  It includes a very
> > detailed "make" completion.
> I would love to do that, but I have about 50 compctl
> rules for which I've spent countless hours and some of
> those behave different than the newer completion
> system defaults. I haven't found a way to use the
> newer system and override some of those rules with my
> own compctl rules.

After loading the new system with `compinit', unset
the elements of the _comps assoc corresponding to the
compctls that you prefer to use.  E.g.

 unset '_comps[foo]' '_comps[bar]' '_comps[etc]'

or (shorthand)

 noglob unset _comps[{foo,bar,etc}]

> Maybe I should "port" my compctl rules to compsys
> rules (I presume they can be override system
> defaults?), but it takes time if it cannot be
> automated.

There isn't any automated way, but it's possible that
there are zstyle commands you could use to get the
behavior that you want -- many of the new completions
are very configurable.  Ask on the list about a few
that are most important to you.  Even if zstyles are
not available it's possible that your different
behaviors are generally useful enough to get folded
into the distribution.

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