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

Re: completion



On Jan 8,  1:36pm, Vincent Lefevre wrote:
}
} I don't understand. I suppose that the real intent of
} 
}     zstyle ':completion:*:complete:*' matcher-list [...]
} 
} was to match the completer "complete", i.e. like
} 
}     zstyle ':completion:*:complete:*:*:*' matcher-list [...]
} 
} But what if the context is ":completion::foo:complete::" in some
} completion, i.e. with the completer "foo" and the command "complete"?

First of all, the completer "_foo" would have had to have been added
to the "completer" style (the default value of this style is _complete
and _ignored), and second, the _foo function would have to contain a
zstyle command that looks up the value of the matcher-list style.  If
either of those conditions does not hold, the context will never be
":completion::foo:complete::" and the question is not relevant.

The assumption, therefore, is that if the user has deliberately added
_foo to the completer style, then he is also aware that _foo may want
to look up match-list, and therefore he will have used the form with
more colons and/or fewer asterisks when defining the matcher-list for
each of the two completers that want a matcher-list.

} It would match, wouldn't it? But the intent was to match only the
} completer "complete", not "foo"!

The zstyle command can't psychically predict the user's intent.  It's
not up to zstyle to make it impossible for the user to mistakenly use
a pattern that's not specific enough.  It's also not up to zstyle to
force the user to make patterns more specific than necessary.  The
format is carefully documented and the user can be as paranoid as he
wishes to be in limiting the contexts that match.



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