diff --git a/.emacs.d/lisp/init-eshell.el b/.emacs.d/lisp/init-eshell.el index 00832c7f..f2ab7489 100644 --- a/.emacs.d/lisp/init-eshell.el +++ b/.emacs.d/lisp/init-eshell.el @@ -235,6 +235,10 @@ This should be faster then `seq-uniq'." (index 1)) (while (<= index (1- (ring-length eshell-history-ring))) (if (string= first (ring-ref eshell-history-ring index)) + ;; REVIEW: We could stop at the first match, it would be faster and it + ;; would eliminate duplicates if we started from a fresh history. + ;; From an existing history that would not clean up existing + ;; duplicates beyond the first one. (ring-remove eshell-history-ring index) (setq index (1+ index)))))) (add-hook 'eshell-pre-command-hook 'ambrevar/eshell-history-remove-duplicates)