Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: !!$ unitialized at first prompt



On Fri, 24 Sep 2010 10:18:23 -0400 (EDT)
"Benjamin R. Haskell" <zsh@xxxxxxxxxx> wrote:
> On Fri, 24 Sep 2010, 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.
> 
> Interesting.
> 
> I'm surprised it splits the history when it's read in.  (I would've 
> expected it to read in whole command lines and only split into words 
> when necessary.)

There isn't a "when necessary", exactly: what's recorded in the history
list are the word pointers, which is what you get for free (well, OK, for
me spending a few hours a few years ago improving the mechanism, which used
to record words in a slightly messier way) when they've come from "live"
history.  So, without adding additional complexity, doing it on reading in
is the only sensible place in the other case (what it happens to do at that
point is a different matter but if you've seen the completion system you'll
realise interfacing to the lexical analyser just to split up words isn't
much fun with our current implementation).

-- 
Peter Stephenson <pws@xxxxxxx>            Software Engineer
Tel: +44 (0)1223 692070                   Cambridge Silicon Radio Limited
Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, UK


Member of the CSR plc group of companies. CSR plc registered in England and Wales, registered number 4187346, registered office Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, United Kingdom



Messages sorted by: Reverse Date, Date, Thread, Author