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

Re: buggy configure completion - when both --enable-foo and --disable-foo are listed

On Sep 2, 11:02pm, m0viefreak wrote:
} Subject: Re: buggy configure completion - when both --enable-foo and --dis
} On 02.09.2016 03:27, Bart Schaefer wrote:
} > I have to update that to look for more than eight spaces for it to work
} > right for zsh's ./configure
} Oh, right, I'm missing one #. It should have been '[8spaces]##':
} zstyle ':completion:*:configure:*:options' command $'print -r -- "${$(COLUMNS=9999 ${~words[1]} --help)//\n        ##/ }"'
} > and even then it mysteriously fails to pick
} > out defaults [/usr/local] and [PREFIX] for --prefix and --exec-prefix
} This works fine for me:

My problem turns out to be _args_cache_${name} stashing away the long
options, which is problematic for things like "configure" that may be
rebuilt with different/new options in the middle of a shell session.
If I "unset -m _args_cache_\*" and then try again, it works.

} Also, slightly related:
} The _configure completion could benefit from my patch I sent back in march:
} http://www.zsh.org/mla/workers//2016/msg00674.html

In that message, you wrote:
>> After parsing the --help output, zsh internally stores that option as
>>   --foo:some option (useful with --bar=baz)
>> Later it filters the options using the following:
>>   tmp=("${(@M)lopts:##$~pattern(|:*)}")
>> The (|:*) part is supposed to be limiting the matching to the part
>> before the ':'. This does however not work at all.
>> It will simply use the empty variant and match anyways.

Your patch recommends changing (|:*) to just :* and always append an
extra ":" so that the empty variant is not needed.

I'll point out for the record that zsh tries alternative patterns in
left-to-right order and always uses the first one that succeeds, so it
might also work to change the pattern to (:*|) [and hope your email
reader doesn't interpret that as some sort of emoticon].

However, in workers/39135, Daniel points out that the pattern on lines
266/268 needs fixing, and your change with the appended colon might in
fact accomplish the necessary tweak.  So I'm going to apply/commit
workers/38153 and Vincent can tell us whether it helps him at all.

Barton E. Schaefer

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