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

Local readonly specials (was: Can't mark unset variables as read-only)



On Wed, 29 Apr 2015 12:57:29 +0200
Mikael Magnusson <mikachu@xxxxxxxxx> wrote:
> I wanted the opposite thing the other day, sort of. I have a ZLE
> widget that looks at $WIDGET, and I wanted to reuse it by calling it
> from another widget, setting WIDGET to another value first. However,
> ZLE makes $WIDGET readonly special, and I couldn't find any
> combination of flags that let me make a non-readonly local WIDGET. Is
> that possible?

Not sure what's going on here, since this usually works:

% typeset -r PATH
% PATH=foo
zsh: read-only variable: PATH
% fn() { typeset -h PATH=foo; print $PATH; }
% fn
foo
% typeset +r PATH
typeset: PATH: can't change type of a special parameter

See if you can make the existing WIDGET hidden (typeset -gh WIDGET?) before
you create a local variable?

pws



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