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

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



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.

pws



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