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

Re: PATCH: expl not always local



Bart wrote:
> Careful with these.  They may be expecting to be called in a context
> where the caller has declared expl as a local.
>
> In general, if a function file starts with #autload then it's a
> utility and should NOT declare completion system variables as locals,
> but if it starts with #compdef then it should declare them local.
> There are probably some exceptions, of course.

I disagree. The only way we should be passing stuff to #autoload (Type/)
functions is with the positional parameters.

These various type functions should do stuff like the following:

  local expl
  _wanted things expl 'thing' compadd -a "$@" - things

Note the single `-' after the "$@". That ensures that any passed
explanation takes precendence over the one defined here ("thing"). Many
of the functions don't do that however. In part because the single dash
feature wasn't there originally.

If the function is using compset to chop stuff into separate words then
it's own descriptions should be taking precendence.

The only variable I can think of where care needs to be taken is
curcontext, hence the use of:
	local curcontext="$curcontext"

Oliver


This e-mail and any attachment is for authorised use by the intended recipient(s) only. It may contain proprietary material, confidential information and/or be subject to legal privilege. It should not be copied, disclosed to, retained or used by, any other party. If you are not an intended recipient then please promptly delete this e-mail and any attachment and all copies and inform the sender. Thank you.



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