zsh-workers
 help / color / mirror / code / Atom feed
From: Peter Stephenson <pws@csr.com>
To: zsh-workers@sunsite.dk (Zsh hackers list)
Subject: Local history
Date: Fri, 16 Nov 2001 17:27:21 +0000	[thread overview]
Message-ID: <1489.1005931641@csr.com> (raw)

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@csr.com>                  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.
**********************************************************************


             reply	other threads:[~2001-11-16 17:28 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-11-16 17:27 Peter Stephenson [this message]
2001-11-16 17:54 ` Oliver Kiddle
2001-11-16 18:01 ` Danek Duvall
2001-11-19  8:40   ` Wischnowsky, Sven
2001-11-19 16:48     ` Bart Schaefer
2001-11-19 17:36       ` Peter Stephenson
2001-11-19 17:58         ` Bart Schaefer
2001-11-21 18:57       ` history editing Danek Duvall
2001-11-21 22:21   ` Wayne Davison
2001-11-21 22:30     ` Danek Duvall

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1489.1005931641@csr.com \
    --to=pws@csr.com \
    --cc=zsh-workers@sunsite.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).