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

Re: [PATCH] local history support, take 2



Wayne Davison wrote:
> > Something else that occurs to me is that it would be useful to have the
> > history automatically popped when you leave the function scope.
> 
> That would certainly be nice.  It was the reason behind my original
> "setopt localoptions tmphist" idea (which wasn't very flexible).  I
> haven't tried to do this yet, though.

I might get a moment to look at this bit if you don't.

> I think it would be nice to both have a pop option and to have that
> option automatically get executed on leaving a function scope if the
> user didn't already run it.  The reason I'm thinking I want an explicit
> option is so I can push/pop the history interactively.

Fine, if you've got a use for it.  I had a vague feeling people using it
from the command line would expect something a bit more flexible, like
pushd/popd, which was beyond what I was thinking about.

> I reordered my suggested options to make them a little more flexible:
> 
>     history -p [[[HISTFILE] HISTSIZE] SAVEHIST]

I suspect you mean

    history -p [HISTFILE [HISTSIZE [SAVEHIST]]]

or it's a little bit tricky to work out.

> Here's my latest patch.

Looks fine.  Some comments on the details:

I get an error if the HISTFILE on the command line doesn't exist.
Presumably it should be silently created.  The file was created anyway,
but the error in the test function I used left me in the empty new
history; that problem will go away with the local proposal.

Probably there should be an error if there are too many arguments to
`history -p' or `history -P'.

-- 
Peter Stephenson <pws@xxxxxxx>                  Software Engineer
CSR Ltd., Science Park, Milton Road,
Cambridge, CB4 0WH, UK                          Tel: +44 (0)1223 692070


**********************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.

This footnote also confirms that this email message has been swept by
MIMEsweeper for the presence of computer viruses.

www.mimesweeper.com
**********************************************************************



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