zsh-workers
 help / color / mirror / code / Atom feed
* issues with saving history to file
@ 2024-03-13 15:05 Vincent Lefevre
  2024-03-14  4:52 ` Bart Schaefer
  0 siblings, 1 reply; 4+ messages in thread
From: Vincent Lefevre @ 2024-03-13 15:05 UTC (permalink / raw)
  To: zsh-workers

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)


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-03-16 15:41 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-13 15:05 issues with saving history to file Vincent Lefevre
2024-03-14  4:52 ` Bart Schaefer
2024-03-15 12:47   ` Vincent Lefevre
2024-03-16 15:41     ` Bart Schaefer

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).