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

Re: Finer control over what gets written to the history file



On Wed, 16 Oct 2013 09:55:24 +0100
Peter Stephenson <p.stephenson@xxxxxxxxxxx> wrote:
> On Tue, 15 Oct 2013 17:34:53 -0700
> Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
> > On Oct 15,  5:58pm, Peter Stephenson wrote:
> > } Subject: Re: Finer control over what gets written to the history file
> >
> > } You know about the zshaddhistory hook?  Excluding by pattern is a
> > } fairly easy instance of this, and it should be readily extensible for
> > } various different ways of checking.
> > 
> > Yes, but it happens at the wrong time.  I don't want to prevent stuff
> > from going into the history as I type it, I want to filter it out of
> > the runtime history just before saving it.
> > 
> > I.e., I want to realize 30 commands later that I really don't need the
> > last 30 iterations of "Src/zsh -ec '{ /bin/cp } 2>>(sleep 1; cat -n)'"
> > to be written to the history file.  By that time zshaddhistory is long
> > out of the picture.
> 
> We could unify the approaches and add a flag for this to histent (we've
> got plenty of spare bits at the moment).  So e.g. zshaddhistory could
> return 2 to say "keep this internally but don't save it".  I haven't
> looked, but it shouldn't be too hard to combine with the HIST_FOREIGN
> and HIST_TMPSTORE logic.

Oh, wait, you're saying you didn't even realise at the time you wanted
to omit the lines.  You want something you can activate at the point
you're about to run fc -W or exit the shell.   So that would have to be
a different hook, which isn't really appropriate for running on every
line of a potentially huge file.  So probably your way is as good as it
gets.

pws



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