Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: !!$ unitialized at first prompt
- X-seq: zsh-workers 28293
- From: Mikael Magnusson <mikachu@xxxxxxxxx>
- To: Zsh Workers <zsh-workers@xxxxxxx>
- Subject: Re: !!$ unitialized at first prompt
- Date: Fri, 24 Sep 2010 17:20:38 +0200
- 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=
- In-reply-to: <100924081042.ZM4496@xxxxxxxxxxxxxxxxxxxxxx>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <alpine.LNX.2.01.1009232317460.4754@hp>	<alpine.LNX.2.01.1009240037470.4754@hp>	<AANLkTikvXfMnkWiZ0kay=s67X=UFhiSvhJGdU120=-6R@xxxxxxxxxxxxxx>	<20100924133936.245765b2@xxxxxxxxxxxxxxxxxxxxxxxxx>	<100924081042.ZM4496@xxxxxxxxxxxxxxxxxxxxxx>
On 24 September 2010 17:10, Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> 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
Messages sorted by:
Reverse Date,
Date,
Thread,
Author