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

Re: Forgetting about compinit with manual alteration of _comps



Sebastian Gniazdowski wrote on Tue, Feb 09, 2016 at 11:28:10 +0100:
> The bottom line is: a software package providing trivial completions
> can do autoload/_comps alteration to make users happy. If they called
> compinit before – completions will work. If they call compinit after –
> completions will work also. Any nastiness in this?

As far as I know, $_comps is an implementation detail, meaning it may
change incompatibly without notice.  Instead of assigning to $_comps,
you should use 'compdef _mycmd mycmd', which is a stable API.

However, I'm not sure making a plugin loadable _either before or after_
compinit is a good idea.  It may be simpler for plugin authors to expect
to be loaded in one circumstance (say, after compinit) and ensure they
emit a clear error message in the other circumstance (say, before
compinit), than to eternally support two codepaths.

Cheers,

Daniel



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