Eshell: Fix trimming of trailing whitespaces
parent
756522f427
commit
f8a5ab0330
|
@ -210,14 +210,6 @@
|
|||
;; Filter out space-beginning commands from history.
|
||||
(string-prefix-p " " str)))))
|
||||
|
||||
(defun ambrevar/eshell-delete-trailing-whitespace (last-output-end point)
|
||||
"Delete trailing whitespace in Eshell command.
|
||||
This is useful to avoid dumb duplicates in history."
|
||||
(save-mark-and-excursion
|
||||
(goto-char (point-max))
|
||||
(delete-trailing-whitespace)))
|
||||
(add-hook 'eshell-expand-input-functions 'ambrevar/eshell-delete-trailing-whitespace)
|
||||
|
||||
;;; Shared history.
|
||||
(defvar ambrevar/eshell-history-global-ring nil
|
||||
"The history ring shared across Eshell sessions.")
|
||||
|
|
|
@ -5,6 +5,11 @@
|
|||
Input is entered into the input history ring, if the value of
|
||||
variable `eshell-input-filter' returns non-nil when called on the
|
||||
input."
|
||||
(require 'subr-x)
|
||||
;; TODO: Report this trick, so that "ls" and "ls " don't both get added to the
|
||||
;; history. Doing this from eshell-expand-input-functions breaks Eshell
|
||||
;; because the input is not expected to be modified.
|
||||
(setq input (string-trim-right input))
|
||||
(when (funcall eshell-input-filter input)
|
||||
(when eshell-hist-ignoredups
|
||||
(ring-remove eshell-history-ring
|
||||
|
|
Loading…
Reference in New Issue