zsh-workers
 help / color / mirror / code / Atom feed
From: Vincent Lefevre <vincent@vinc17.net>
To: zsh-workers@zsh.org
Subject: issues with saving history to file
Date: Wed, 13 Mar 2024 16:05:11 +0100	[thread overview]
Message-ID: <20240313150511.GA3498572@cventin.lip.ens-lyon.fr> (raw)

With zsh 5.9:

cventin:~> zsh -f
cventin% HISTFILE=~/.histfile
cventin% HISTSIZE=1000
cventin% SAVEHIST=1000
cventin% setopt APPEND_HISTORY
cventin% true
cventin% exit
cventin:~> ls ~/.histfile
ls: cannot access '/home/vlefevre/.histfile': No such file or directory

However, if I use INC_APPEND_HISTORY instead of APPEND_HISTORY, the
history is saved.

According to the zsh(1) man page:

  Note also that the RCS option affects the saving of history files,
  i.e. if RCS is unset when the shell exits, no history file will be
  saved.

But the difference between INC_APPEND_HISTORY and APPEND_HISTORY is
not documented concerning this point.

Also, I do not see the point of not saving the history when RCS is set.
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.

Without INC_APPEND_HISTORY, the man page doesn't document when
precisely the history is saved. For instance, what happens if one
has a "print -s ..." in the .zlogout file?

Moreover, with INC_APPEND_HISTORY, "print -s" does not put the entry
in the history file immediately, only after the next accept-line.

-- 
Vincent Lefèvre <vincent@vinc17.net> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)


             reply	other threads:[~2024-03-13 15:05 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-13 15:05 Vincent Lefevre [this message]
2024-03-14  4:52 ` Bart Schaefer
2024-03-15 12:47   ` Vincent Lefevre
2024-03-16 15:41     ` Bart Schaefer

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=20240313150511.GA3498572@cventin.lip.ens-lyon.fr \
    --to=vincent@vinc17.net \
    --cc=zsh-workers@zsh.org \
    /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).