Subject: bug#77082: [PATCH] Add some more Eshell history tests

From: Jim Porter <[email-masked]>
Date: Mon, 17 Mar 2025 16:15:43 -0700

On 3/17/2025 12:52 PM, Morgan Smith wrote:
> This patch just adds some tests so I don't think that should be too
> controversial

Thanks for the contribution to the tests. I'll take a look at the tests 
themselves when I have a bit more time. In the meantime though, I can 
comment on, well... your comments.

> While writing this email I discovered Bug#66700 which seemed to come to
> the conclusion that we should set `eshell-history-append' to true in the
> next version of Emacs.  However, this would effectively make
> `eshell-hist-ignoredups' useless.

I don't think that's true. 'eshell-hist-ignoredups' is mainly useful so 
that if you run the same command several times (e.g. "make"), it only 
shows up in the history once. It can *also* help with storing history 
from multiple Eshell sessions, but it's probably not the best way to do 
that.

(For multiple Eshell sessions, I'd personally prefer a *global* history 
that updates immediately across all sessions, with the ability to use 
that global history *or* the session's local history. That's how I have 
Zsh configured, and I think it's the easiest way to handle history by 
quite a bit.)

> +  ;; It might be nice to warn the user in this case!  That would have
> +  ;; saved me time debugging my init file.

I find the 'nil' behavior for 'eshell-history-file-name' odd, but 
perhaps for a different reason: I'd expect 'nil' to mean "never store 
history", which you might possibly set for ephemeral Eshell sessions. 
Some value like 'use-histfile' for the current meaning of 'nil' would 
have been clearer, in my opinion. That would be an incompatible change 
though, so I've just left it as-is.

> +  ;; Is this really the behavior we want?  This is how eshell comes out
> +  ;; of the box with zero configuration.  Users using multiple eshells
> +  ;; are going to be missing history in a way that is going to be hard
> +  ;; for them to track down as it depends on when shells are opened and
> +  ;; closed relative to each other.

It's not. I think 'eshell-history-append' should be the default, but we 
wanted users to opt in first so that we'd have time to get feedback 
about the feature before it became the default.