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

Re: [PATCH 0/6] Update coreutils command completions



On 9 Aug, "Jun. T" wrote:
> The second hunks in the patches for _env and _watch below are (possible)
> fix for a problem that existed before his patch.
> _env and _watch call _normal to complete a command and args, but since
> they are passed to execve() or 'sh -c', it would make no sense to complete
> zsh bultins or functions etc. I replaced
>    _normal
> by
>    _normal -p env/watch
> so that only external commands are offered. Is this a correct use of the
> option -p?

This breaks env completion. It was relying on _normal to complete
environment variables which is fairly fundamental to the use of env.

This use of _normal is fairly new. There probably is a need for a
simple way to get _normal without builtins, aliases, functions etc.
This mechanism with -p seems to have resulted from quite a number of
separate patches, each of which seemed very reasonable when taken alone
but the end effect doesn't really seem ideal. Tracking precommands
could be useful for things like noglob but isn't really for things like
env and watch. So it is being used for things that aren't conventional
precommands to get the effect of external commands only. Every use of
-p is passed $service - if that will always be the case, why require
it. I think I'd prefer a more explicit option to _normal - -e perhaps
for external commands (as for _command_names) and perhaps -E to allow
variable assignments.

In many cases, we're actually relying on later fallbacks to _default for
completing values. _default only does this for magicequalsubst so if you
unset that option, variable value completion for commands like env is
broken. _normal (or _command_names) should be doing this explicitly.

Oliver




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