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

Re: issues with saving history to file



On Fri, Mar 15, 2024 at 5:47 AM Vincent Lefevre <vincent@xxxxxxxxxx> wrote:
>
> On 2024-03-13 21:52:44 -0700, Bart Schaefer wrote:
> > On Wed, Mar 13, 2024 at 8:05 AM Vincent Lefevre <vincent@xxxxxxxxxx> wrote:
> > > IMHO, HISTFILE should just be unset by default; but if the user sets
> > > this parameter, I suppose that the goal is to save the history.
> >
> > The goal might be to read the history, not to write it.
>
> To read the history?  The zshparam(1) man page just says "to save":
>
>   HISTFILE
>       The file to save the history in when an interactive shell exits.

See also the part about "when exits" which is clearly also incorrect.
This entry is outdated.  The shell also initializes the history from
this file at startup.

I was differentiating
  zsh -f
  % setopt RCS
from
  zsh
  % setopt no_RCS

In the former case, the history is not read, but it is written.  In
the latter case it is read, but not written.  The point being that
merely setting HISTFILE does not imply that the goal is to save to it.
Further, setting SAVEHIST=0 will truncate the file in the former case
and leave it alone in the latter case.  There's no single setting that
covers all cases, which is part of the reason we've so far had trouble
agreeing on default behavior.

If anyone wants to have a go at cleaning up all these documentation
inaccuracies, please do.




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