Subject: bug#25838: 25.1; Eshell history polluted by eshell/clear

From: Thomas Ferreira <[email-masked]>
Date: Wed, 22 Feb 2017 06:03:13 -0500

In eshell:

~ $ history
1 history
~ $ eshell/clear
[...]
~ $
[...]
~ $ history
1 history
2 eshell/clear
3
[...]
4 history

An easy (dirty?) way to fix it could be override eshell-input-filter (from em-hist.el):

(defcustom eshell-input-filter
(function
(lambda (str)
(not (string-match "\\`\\s-*\\'" str))))
"Predicate for filtering additions to input history.
Takes one argument, the input. If non-nil, the input may be saved on
the input history list. Default is to save anything that isn't all
whitespace."
:type 'function
:group 'eshell-hist)

to:

(defcustom eshell-input-filter
(function
(lambda (str)
(not (string-match "\\`\\s-*\\'" (string-trim-left str)))))
"Predicate for filtering additions to input history.
Takes one argument, the input. If non-nil, the input may be saved on
the input history list. Default is to save anything that isn't all
whitespace."
:type 'function
:group 'eshell-hist)