zsh-workers
 help / color / mirror / code / Atom feed
From: Sebastian Gniazdowski <sgniazdowski@gmail.com>
To: Bart Schaefer <schaefer@brasslantern.com>
Cc: Zsh hackers list <zsh-workers@zsh.org>
Subject: Re: Should (t)path = array-unique-special work this way
Date: Mon, 15 Feb 2016 09:25:41 +0100	[thread overview]
Message-ID: <CAKc7PVAbMNc7aQYgR_maqqJj=0F9-821wY2MZ9pB-7ijWogpHQ@mail.gmail.com> (raw)
In-Reply-To: <160214104428.ZM20624@torch.brasslantern.com>

On 14 February 2016 at 19:44, Bart Schaefer <schaefer@brasslantern.com> 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


      reply	other threads:[~2016-02-15  8:26 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-05 13:45 Sebastian Gniazdowski
2016-02-05 17:15 ` Bart Schaefer
2016-02-05 17:34   ` Sebastian Gniazdowski
2016-02-05 17:46     ` Peter Stephenson
2016-02-05 18:19       ` Peter Stephenson
2016-02-14 10:04   ` Sebastian Gniazdowski
2016-02-14 10:19     ` Sebastian Gniazdowski
2016-02-14 14:34     ` Daniel Shahaf
2016-02-14 18:44     ` Bart Schaefer
2016-02-15  8:25       ` Sebastian Gniazdowski [this message]

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='CAKc7PVAbMNc7aQYgR_maqqJj=0F9-821wY2MZ9pB-7ijWogpHQ@mail.gmail.com' \
    --to=sgniazdowski@gmail.com \
    --cc=schaefer@brasslantern.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).