Eshell: Fix trimming of trailing whitespaces

master
Pierre Neidhardt 2019-03-06 11:26:35 +01:00
parent 756522f427
commit f8a5ab0330
2 changed files with 5 additions and 8 deletions

View File

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

View File

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