Eshell: Add comment on history uniqueness algorithm

master
Pierre Neidhardt 2019-02-11 19:40:23 +01:00
parent 91f8d8b8f0
commit 45575ad88d
1 changed files with 4 additions and 0 deletions

View File

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