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

Re: completion oddity



>>>>> On May 22, 2012 Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:

> On Tue, May 22, 2012 at 9:35 AM, Greg Klanderman <gak@xxxxxxxxxxxxxx> wrote:
>> 
>> Is there something I can put in matcher-list to effectively turn off
>> this default and globally get the behavior as when you added "-M ''"

> No.  The sneaky thing here is that generically, the matcher-list
> zstyle is for matching file names, not command options.

> Consequently _arguments doesn't use the matcher-list style itself;
> it's up to the individual context completion functions (like _k in the
> example) to look up the style (presumably in an option-specific style
> context) and pass it to _arguments -M.

OK, thanks for looking into this Bart.  So _main_complete is still
looping over zstyle matcher-list values in completing parameters but
it's not used?  I do see that _arguments uses _description which uses
_matcher if non-empty (as you noted earlier).  I have to confess I
cannot follow all this completion code though.

Greg


> Practically speaking, the assumption is that the completion function
> must "know" exactly what the command options "look like" for the
> command it is completing, so there's no reason to provide a way for
> the user to override it.  File names, on the other hand, could look
> like anything, so the user is given hooks to tell completion about
> those file names.

> I can't recall any discussion of leading to a conscious decision to
> have it work this way; it just fell out so from the incremental
> process of making the completion system handle common cases cleverly
> (without requiring the user to tweak everything).



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