From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24040 invoked by alias); 10 May 2016 18:10:54 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 21544 Received: (qmail 24827 invoked from network); 10 May 2016 18:10:53 -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; bh=RCoauQr1MSpBLT/PuiNtHEZ+QTjNsBR/Xs12uZvcWWk=; b=q+DPG1PnKZR3Mp3fgR+SxDpVzn1dvqPhDAekdTThttZGKgJzEr/gFE0jNxgg3oqozt oQEoeljv/j+Rk1o3LIklOgcnDoGXrNUV5H2U3BXKqWewkKHC6k2mBZPsKpOaXffaHvkZ CIpqIzaHZN4QIWv30nKcuGtcLhq5cknSf/1j4nt67aNricG1Pn6A16SOyKMqLJH0Z9vE UsSyntovgiBdY9v1qI6TBVaXm7NdGpH+TC+dfKaT8xU2MEVnfukOu8sOwWjELgU8DnyS d4rRmwa0XXomSEGGW0W0FQA1Q2Z7Lu4FhcmTCatw59y4GsTRhjW41OP1+O21UndCmPbH v/4Q== 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; bh=RCoauQr1MSpBLT/PuiNtHEZ+QTjNsBR/Xs12uZvcWWk=; b=gwchUZsjuk/GLMVTCFOwlvZXic/M9dKCbYyL9oz2TylaViyIi2RnDyPiU14IKGrCmf r7TW6T94uLUPqs/SaeyCWew0A8vWYs8JODZ1SSCsIYpnts4F770ntLPwVR1XecyksTyP 6qMcZHaiqY9FssJkg0HIfmMajqarnd4XunWZ1p2MiEzi/v+LR6T1TO6w/uxuNdqmxrhW RPOOhYb7OvRs/WzrssXq/94zJPJmQqDJ6N6aAAoFk8YKBo0KSpS00gojuQwxAnAo6Poe SHuRRvMQy2x1xiUGK8A1Jp6vlse05WdBWUkPPVypOqyuA7NLqR1PDZGYZ85d33HZpR9m 3ULg== X-Gm-Message-State: AOPr4FU+JnonMyYTjf1jCluyaWAZGILMMd/YtXDLjABdxFSs3B6GUCeXFDBTvGWLIcfj9ml5JbeSiHK9AMOFNA== X-Received: by 10.25.160.77 with SMTP id j74mr7279096lfe.72.1462903851621; Tue, 10 May 2016 11:10:51 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: References: <151119111749.ZM8874@torch.brasslantern.com> From: Sebastian Gniazdowski Date: Tue, 10 May 2016 20:10:32 +0200 Message-ID: Subject: Re: Read file with escaped newlines into array To: Bart Schaefer Cc: Zsh Users Content-Type: text/plain; charset=UTF-8 On 10 May 2016 at 18:15, Bart Schaefer wrote: > On Tue, May 10, 2016 at 7:26 AM, Sebastian Gniazdowski > wrote: >> On 19 November 2015 at 20:17, Bart Schaefer 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