zsh-workers
 help / color / mirror / code / Atom feed
From: Peter Stephenson <p.stephenson@samsung.com>
To: zsh workers <zsh-workers@zsh.org>
Subject: Local readonly specials  (was: Can't mark unset variables as read-only)
Date: Wed, 29 Apr 2015 12:09:04 +0100	[thread overview]
Message-ID: <20150429120904.03d21689@pwslap01u.europe.root.pri> (raw)
In-Reply-To: <CAHYJk3SPLgAQpzquwxypVbg2MsPu_39XHYZhYuJ-7obX5jSSNA@mail.gmail.com>

On Wed, 29 Apr 2015 12:57:29 +0200
Mikael Magnusson <mikachu@gmail.com> 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


  parent reply	other threads:[~2015-04-29 11:09 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-29  6:35 [BUG] Can't mark unset variables as read-only Martijn Dekker
2015-04-29 10:36 ` Peter Stephenson
2015-04-29 10:57   ` Mikael Magnusson
2015-04-29 11:01     ` Mikael Magnusson
2015-04-30  0:08       ` PATCH: Don't define internal params directly in hook function scope Mikael Magnusson
2015-04-30  4:01         ` Bart Schaefer
2015-04-30  8:44           ` Peter Stephenson
2015-04-30 11:18             ` Peter Stephenson
2015-04-29 11:09     ` Peter Stephenson [this message]
2015-04-29 13:46   ` [BUG] Can't mark unset variables as read-only Martijn Dekker
2015-04-29 13:55   ` Bart Schaefer
2015-04-29 14:41     ` Peter Stephenson
2015-04-29 15:33       ` Chet Ramey
2015-04-29 19:09         ` Stephane Chazelas
2015-04-29 23:22           ` Chet Ramey
2015-04-30  3:57         ` Bart Schaefer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150429120904.03d21689@pwslap01u.europe.root.pri \
    --to=p.stephenson@samsung.com \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).