Subject: bug#66700: 30.0.50; Some history is missing with multiple eshell buffers

From: Liu Hui <[email-masked]>
Date: Tue, 14 Nov 2023 12:40:00 +0800

Hi Jim,

> Eshell saves history by default when quitting the buffer or emacs, but
> some history is missing when there are multiple eshell buffers. For
> example,
>
> 1. emacs -Q
> 2. M-x eshell, and type foo
> 3. C-u M-x eshell, and type bar
> 4. quit emacs
>
> I would expect both commands are saved, but in fact only one command
> is saved in the file eshell-history-file-name. I think the reason is
> the history file is always overwritten when an eshell buffer tries to
> save the history, so maybe eshell should save commands by appending
> to the file?

Since Eshell can append new history now, I think it makes sense to
change the default behavior from overwriting to appending, i.e., using
'(eshell-write-history nil t)' in eshell-exit-hook and
eshell-save-some-history. WDYT?