From: Sebastian Gniazdowski <sgniazdowski@gmail.com>
To: Bart Schaefer <schaefer@brasslantern.com>
Cc: Zsh Users <zsh-users@zsh.org>
Subject: Re: Read file with escaped newlines into array
Date: Tue, 10 May 2016 20:10:32 +0200 [thread overview]
Message-ID: <CAKc7PVC6d+QYowmvu0K4vmu0ixtVhopn=87krpoVtu=fO0jMEQ@mail.gmail.com> (raw)
In-Reply-To: <CAH+w=7Zpf0GZ374X8Hppn6xD9jvmecP_MTa5vmM2PTEuNhwKLg@mail.gmail.com>
On 10 May 2016 at 18:15, Bart Schaefer <schaefer@brasslantern.com> wrote:
> On Tue, May 10, 2016 at 7:26 AM, Sebastian Gniazdowski
> <sgniazdowski@gmail.com> wrote:
>> On 19 November 2015 at 20:17, Bart Schaefer <schaefer@brasslantern.com> wrote:
>>>
>>> () { fc -ap -R the_given_file ; the_desired_array=( ${history} ) }
>>
>> This works, but I wonder, how it's possible that zsh/parameter
>> variables such as $historywords are made local?
>
> Special parameters can be made local simply by declaring them so. Or
> are you asking "how" in the sense of what is done internally to make
> it work?
>
> In the case of $history et al., internally they reference the history
> data structures directly, so "fc -p" implicitly makes $history refer
> to the new temporary history, and then switch back to the real history
> on "fc -P"; it isn't necessary to declare it local when using "fc
> -ap".
I use $history to refer to main history and also load a private
history by using the code you gave, and they don't interfere. You used
anonymous function suggesting $history is being localized and that's
how it in practice works. Read the manual (second time), it's -a that
makes the temporary structure switched to by fc -p to be automatically
dropped. Convenient.
Best regards,
Sebastian Gniazdowski
next prev parent reply other threads:[~2016-05-10 18:10 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-19 17:34 Sebastian Gniazdowski
2015-11-19 19:17 ` Bart Schaefer
2015-11-19 20:14 ` Sebastian Gniazdowski
2016-05-10 14:26 ` Sebastian Gniazdowski
2016-05-10 16:15 ` Bart Schaefer
2016-05-10 18:10 ` Sebastian Gniazdowski [this message]
2015-11-20 1:17 ` Mikael Magnusson
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='CAKc7PVC6d+QYowmvu0K4vmu0ixtVhopn=87krpoVtu=fO0jMEQ@mail.gmail.com' \
--to=sgniazdowski@gmail.com \
--cc=schaefer@brasslantern.com \
--cc=zsh-users@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).