Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Should (t)path = array-unique-special work this way
- X-seq: zsh-workers 37980
- From: Sebastian Gniazdowski <sgniazdowski@xxxxxxxxx>
- To: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- Subject: Re: Should (t)path = array-unique-special work this way
- Date: Mon, 15 Feb 2016 09:25:41 +0100
- Cc: Zsh hackers list <zsh-workers@xxxxxxx>
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; bh=OVSuYbg+9eQ4FEoA0UPXnCNjdZwuV5TtFqDVF7jMiuY=; b=FnuQIl6ROdYMcxONcKB7+8xwHcku53MHDHiusAZSkblVT1OG+G2XlvpDSw26QSP7EL GkD4KDscv5ORzNDGX78f+UMTW9KJ7bRNSBXf/asD6qhAM5DOA9TOjL9XOfQs31az3D+O WSsfpMTDGVEsqNeE0mDYec7v5QqXmndg6N0wIGclGVYM4BXZqWFnjACOShOdvIi8ppGf GqSwY4RlLIb+MHaDtEh8kc3j2pCYDn087eMSBYsXQRkKWnxZh3W0G+RarXjQhsgqHjKZ 06/fRUFbCcLhEmB6bD0ayHG3R7pyJtQtPrpFoeERKq72T461srAOq4NPoLPVkFXiI+gH cLMg==
- In-reply-to: <160214104428.ZM20624@torch.brasslantern.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: <CAKc7PVCDHQDc=sby5wGNEtWCA6omFhmP8uPWbsPXwTQv9tDqFw@mail.gmail.com> <160205091543.ZM29723@torch.brasslantern.com> <CAKc7PVBrDBe-QQ5=3uC_G_eQSmg1MvSaG8QBdQN3Zn_htHkZmw@mail.gmail.com> <160214104428.ZM20624@torch.brasslantern.com>
On 14 February 2016 at 19:44, Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
> On Feb 14, 11:04am, Sebastian Gniazdowski wrote:
> }
> } Wanted to write a snapshot feature, basically declare -p > snapshot;
> } setopt typesetsilent; source ./snapshot, but the omission of -U is
> } quite a blocker.
>
> This doesn't work in the general case anyway, because the output of
> "typeset -p" (aka "declare -p") doesn't properly reflect local scopes.
> That is, if you're in a local scope, sourcing the "declare -p" output
> will create all the variables at that local scope, not at the scopes
> where they were originally defined.
>
> In fact it's impossible to correctly reconstruct the local and global
> scopes because of the runtime dynamic scoping rules.
Assuming the feature is for interactive use, what can be the issues
with scopes? I started a new project, worked around limitations of
declare -p with $parameters:
https://github.com/psprint/zsnapshot
It is called in current scope via alias zsnapshot="source snapshot >
snap", the user is informed that he should source output file at
prompt. Are there any possible issues?
(Started this project to face dirt that e.g. a theme can introduce
into session. Before trying a theme that messes up with precmd() and
PS1, one calls snapshot so that he can revert)
Best regards,
Sebastian Gniazdowski
Messages sorted by:
Reverse Date,
Date,
Thread,
Author