Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Amusing (?) behavior of zsh/parameter specials
- X-seq: zsh-workers 37785
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: Re: Amusing (?) behavior of zsh/parameter specials
- Date: Mon, 25 Jan 2016 21:11:40 -0800
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brasslantern-com.20150623.gappssmtp.com; s=20150623; h=from:message-id:date:in-reply-to:comments:references:to:subject :mime-version:content-type; bh=6NtiP29wKsMZENy5ZsG3bwevRdXRyQdwk+UrWd5iO2Y=; b=1Y6dL/EtNE6kdw0x0+QvgvLILDxekVwm2XvDJggS6kxcVtip55z+blVLGrJQzXbTRW 24x8esNNTC2Gju0hICYjN7ZJsGQy5oN3ToYTMK+1GgME6opyUWFV+C6+elMswJsV/vJt FYSn2OfvmCwgPT/p7G4lw+eRgTKInmjsC0iEW2wSNuQctRVW/dECL0HsPz3ElrP1AV/l 85R6mBg+HXh8RBqY4koUSAtYGgGOdGCv8oMz3IeCzQKTqJGX/XWDmLnTbsKl4PLSff4s w+mOjWT+uuVcRa90Y5B7qw1H6c0WZi3r2KsnaU84lvSwSSENluk5uonKcTK3Oyx1D5ik m4cA==
- In-reply-to: <20160124182611.710b0fba@ntlworld.com>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <160123090736.ZM14384@torch.brasslantern.com> <20160124182611.710b0fba@ntlworld.com>
On Jan 24, 6:26pm, Peter Stephenson wrote:
} Subject: Re: Amusing (?) behavior of zsh/parameter specials
}
} On Sat, 23 Jan 2016 09:07:36 -0800
} Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
} > Maybe autoloaded parameters should always be hidden until they load?
}
} That's definitely arguable, yes. -p and its features are there as a
} concession to POSIX-style order, in order to make it easy to restore
} parameters the user has defined, and autoloaded parameters, whether
} disappearing or not, don't fit that picture.
Two competing potential patches for this.
I lean a little bit toward this one:
diff --git a/Src/params.c b/Src/params.c
index b2e8897..a1f0292 100644
--- a/Src/params.c
+++ b/Src/params.c
@@ -5258,7 +5258,8 @@ printparamnode(HashNode hn, int printflags)
if (printflags & PRINT_TYPESET) {
if ((p->node.flags & (PM_READONLY|PM_SPECIAL)) ==
- (PM_READONLY|PM_SPECIAL)) {
+ (PM_READONLY|PM_SPECIAL) ||
+ (p->node.flags & PM_AUTOLOAD)) {
/*
* It's not possible to restore the state of
* these, so don't output.
But this one has its attractions as well:
diff --git a/Src/params.c b/Src/params.c
index b2e8897..0ec0042 100644
--- a/Src/params.c
+++ b/Src/params.c
@@ -5265,7 +5265,10 @@ printparamnode(HashNode hn, int printflags)
*/
return;
}
- printf("typeset ");
+ if (p->node.flags & PM_AUTOLOAD)
+ printf("unset ");
+ else
+ printf("typeset ");
}
/* Print the attributes of the parameter */
The main problem with the latter one is that, if the parameter really
is read-only after autoloading, "restoring" the unset will fail. I
guess the point is to restore the parameters that ARE set, so now that
I've written this all down I lean even more to the first variant.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author