From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1011 invoked by alias); 15 Feb 2016 08:26:05 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 37980 Received: (qmail 530 invoked from network); 15 Feb 2016 08:26:04 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, T_DKIM_INVALID autolearn=ham autolearn_force=no version=3.4.1 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== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc:content-type; bh=OVSuYbg+9eQ4FEoA0UPXnCNjdZwuV5TtFqDVF7jMiuY=; b=jq63THfakY1LGORp2URHzkAzfbj+KI1Bc3M/mV0ZGUYM0sZytO+t7+I6e0xkP1DFhW fkK8VIeYLhgFdFpQgPz47SNW2bhikVOa+bWT5/NLJCzJSd3uHoWg9uHlvsWzUu6cSRIz MZSVXxsZLekj/IRezuS/KoNMMBbwvQQ7auF+uDS4n31QrgnXPNCH+hBZkoiW83j84AiZ wLkaSwxMJSFIM4ftHrtQ8R/db+O+5O0g9FQsP9RroyNRRD/4LuykOUer47x3tCc3a/Wz PthopZfddtSarjTFmyfYDY1u9ujnAd4/FfvBFvNzebRAaYFvQYCZnviEl8kULTdHEUPd Rw7A== X-Gm-Message-State: AG10YOSvsM/NbzFUOpKX3W5MFOZZdl8y8z3KF8bvSRtJQnsJhQI3AHw8kyJtrxwWJfhvxW03XJRPFks9hX9KDQ== X-Received: by 10.25.7.201 with SMTP id 192mr5024475lfh.107.1455524761277; Mon, 15 Feb 2016 00:26:01 -0800 (PST) MIME-Version: 1.0 In-Reply-To: <160214104428.ZM20624@torch.brasslantern.com> References: <160205091543.ZM29723@torch.brasslantern.com> <160214104428.ZM20624@torch.brasslantern.com> From: Sebastian Gniazdowski Date: Mon, 15 Feb 2016 09:25:41 +0100 Message-ID: Subject: Re: Should (t)path = array-unique-special work this way To: Bart Schaefer Cc: Zsh hackers list Content-Type: text/plain; charset=UTF-8 On 14 February 2016 at 19:44, Bart Schaefer 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