Eshell: Ignore all duplicates in history
parent
8b1748e985
commit
49f92790c8
|
@ -193,12 +193,13 @@
|
|||
|
||||
;;; History
|
||||
;;; Filter out space-beginning commands from history.
|
||||
;;; TODO: history/command hook: trim surrounding space. Check `eshell-rewrite-command-hook'.
|
||||
;;; TODO: history: do not save failed commands to file.
|
||||
;;; TODO: history: do not store duplicates. Push unique command to front of the list.
|
||||
;;; TODO: history/command hook: trim spaces. Check `eshell-rewrite-command-hook'.
|
||||
;;; TODO: history: do not save failed Eshell commands (See `eshell-last-command-status')
|
||||
;;; Eshell commands always return 0.
|
||||
(setq eshell-input-filter
|
||||
(lambda (str)
|
||||
(not (or (string= "" str)
|
||||
(not (or (/= eshell-last-command-status 0)
|
||||
(string= "" str)
|
||||
(string-prefix-p " " str)))))
|
||||
|
||||
;;; Shared history.
|
||||
|
|
|
@ -214,4 +214,19 @@ See `eshell-prompt-regexp'."
|
|||
(when face
|
||||
(put-text-property beg end 'face face))))
|
||||
|
||||
;;; REVIEW: Ignore dups in the entire ring, not just the last entry.
|
||||
;;; Reported upstream, see #30466.
|
||||
(defun eshell-add-input-to-history (input)
|
||||
"Add the string INPUT to the history ring.
|
||||
Input is entered into the input history ring, if the value of
|
||||
variable `eshell-input-filter' returns non-nil when called on the
|
||||
input."
|
||||
(when (funcall eshell-input-filter input)
|
||||
(when eshell-hist-ignoredups
|
||||
(ring-remove eshell-history-ring
|
||||
(ring-member eshell-history-ring input)))
|
||||
(eshell-put-history input))
|
||||
(setq eshell-save-history-index eshell-history-index)
|
||||
(setq eshell-history-index nil))
|
||||
|
||||
(provide 'patch-eshell)
|
||||
|
|
Loading…
Reference in New Issue