From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5162 invoked by alias); 24 Sep 2010 15:26:38 -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: 28293 Received: (qmail 12453 invoked from network); 24 Sep 2010 15:26:36 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received-SPF: pass (ns1.primenet.com.au: SPF record at _spf.google.com designates 209.85.212.171 as permitted sender) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:in-reply-to :references:date:message-id:subject:from:to:content-type; bh=Z2ZchJQshzJEs03d5DUijJl6wkM+2oqncSucqlCaQ+E=; b=TYaP40cogNdYTy9ktQQIR7sKT7SJGrNEH9flZ+0/JSFfulisEDlIuIxJ4BRC5vZu0S ZhGO7JjT7YVQ+jfcWYrHHGtdfqkf1mbxzQckmjFLJzvtjjUKDENARvhLBGR2EHNS3TjQ EyoWjNgvjdHqw7RzHLq52mTT6BmJyfHV1JbI0= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; b=DUe7pn52hf5PLN7IXnK7cp7h8hFTKlDe13i5ZNbSZCA0CGGQszBe8/yyR4Z1IFCVLy oqfKES8Slx+WE4cATbSliXA5qXLaZkZ6p7rLlAGEoLwZQL0KP4Z27717PMzngKeFqL9e OgvtCds2GdYioujmcXRJSLVCjgQEPOXNr6/3c= MIME-Version: 1.0 In-Reply-To: <100924081042.ZM4496@torch.brasslantern.com> References: <20100924133936.245765b2@pwslap01u.europe.root.pri> <100924081042.ZM4496@torch.brasslantern.com> Date: Fri, 24 Sep 2010 17:20:38 +0200 Message-ID: Subject: Re: !!$ unitialized at first prompt From: Mikael Magnusson To: Zsh Workers Content-Type: text/plain; charset=UTF-8 On 24 September 2010 17:10, Bart Schaefer wrote: > On Sep 24, 1:39pm, Peter Stephenson wrote: > } > } The shell doesn't split words in the same way when importing history. > } In normal operation it relies on the lines having been passed through > } the lexical analyser to generate the words, which doesn't happen when > } history is read from a file. Instead it just blindly splits on > } whitespace. > > ... and at the time this was designed, it would make history import an > agonizingly slow process if the entire history file had to be passed > through the lexical analyzer. > > Nowadays that's probably not so much a concern for most people. There's > probably an argument to be made that SHARE_HISTORY should force use of > the lexical analyzer, because (although no one has ever complained) the > current implementation means that history words referenced from shared > history behave differently than those from the local history. > > You can load your own history something like this provided that you > *don't* use shared or extended history: > > readhistfile() { > emulate -LR zsh > local histline > local -a histwords > while read -r histline > do > if [[ $histline = *\\ ]] > then > histline[-1]='' > histwords+=( ${(z)histline}$'\n' ) > else > histwords+=( ${(z)histline} ) > print -s $histwords > histwords=() > fi > done > } > > That's not perfect, as it does things like insert a space at the front > of every continuation line in a multi-line command, but it's passable. > Note the function as written expects the history to be standard input. Unless I'm missing something, it's also not unmetafying anything. Which is not a problem if you're american/english :). -- Mikael Magnusson