Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Local history
- X-seq: zsh-workers 16260
- From: Peter Stephenson <pws@xxxxxxx>
- To: zsh-workers@xxxxxxxxxx (Zsh hackers list)
- Subject: Local history
- Date: Fri, 16 Nov 2001 17:27:21 +0000
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
I'm still thinking about a way of getting a local command history. My
particular use is so that zcalc and similar functions can keep their own
data, separate from the main command history.
The first thing I tried was manipulating HISTFILE inside the function and
using fc -R and fc -W. But this doesn't work too well because the history
list at the start contains lots of irrelevant bits. Maybe there's a way of
truncating the internal list after saving one list and before loading the
other, but at this point I start to wonder whether I should be doing
something different. In particular, incremental appending and history
sharing will make things well confused.
Does anyone have any experience of or feeling for this? I can see various
possible ways of proceeding, most (given my experience so far) involving
internal alterations. However, the fourth possibility is quite attractive.
- Tidy up the mechanism in hist.c to make it easier to swap histories.
Needs some way of doing this for both the internal history and external
files, since Wayne has gone to some lengths to make them consistent. This
sounds quite nasty to me.
- Abstract the interface in hist.c. Make it support both the current
file-based mechanism for accessing the history and a mechanism tied to
arrays. The alternative mechanism can be simpler, since the functions that
use it can do reading, writing or appending where necessary.
- Add an additional array-based system inside zle, so that we don't use
hist.c at all in this case. There are two parts to this: adapt
zle_history.c for the alternative system, and adapt bin_vared() to put
the text into this history. (`Array-based' could mean two things: we
input values as an array and export them to an array on entry or exit to
the function, or to vared itself, or we tie the entries in the array
directly to the history list seen inside zle.)
- Write a completely separate history mechanism based on zle widgets.
Rebind the keys when using vared. Hence `vared-up-line-or-history' would
temporarily replace `up-line-or-history' and look in the array for the
previous entry. If zle turns out not to be up to it, we can probably add
the necessary functions; they may be of more general use than just history.
We can supply this system in Functions/Zle. Unfortunately we have to
rewrite the various search functions from scratch, too.
- Or maybe I'm being faint-hearted and mainpulating the history parameters
and fc will do the trick after all.
--
Peter Stephenson <pws@xxxxxxx> Software Engineer
CSR Ltd., Science Park, Milton Road,
Cambridge, CB4 0WH, UK Tel: +44 (0)1223 392070
**********************************************************************
The information transmitted is intended only for the person or
entity to which it is addressed and may contain confidential
and/or privileged material.
Any review, retransmission, dissemination or other use of, or
taking of any action in reliance upon, this information by
persons or entities other than the intended recipient is
prohibited.
If you received this in error, please contact the sender and
delete the material from any computer.
**********************************************************************
Messages sorted by:
Reverse Date,
Date,
Thread,
Author