diff options
author | Mark Oteiza <mvoteiza@udel.edu> | 2016-10-18 18:05:51 -0400 |
---|---|---|
committer | Mark Oteiza <mvoteiza@udel.edu> | 2016-10-18 18:05:51 -0400 |
commit | 224443922ce169ab0e21ad8495d32b269972c028 (patch) | |
tree | 4340e51a607b61f66c98f9ad79527138c44989f3 /lisp/eshell | |
parent | 2ce01c494dd013a47f3b98860538cba4a1ef6a2c (diff) | |
download | emacs-224443922ce169ab0e21ad8495d32b269972c028.tar.gz |
Add an option for eshell-input-filter
* etc/NEWS: Document changes.
* lisp/eshell/em-hist.el (eshell-input-filter): Set value to function
symbol. Change type to a radio for choosing functions. Refer to both
new functions.
(eshell-input-filter-default): New function. Same body as the previous
value of eshell-input-filter.
(eshell-input-filter-initial-space): New function.
Diffstat (limited to 'lisp/eshell')
-rw-r--r-- | lisp/eshell/em-hist.el | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/lisp/eshell/em-hist.el b/lisp/eshell/em-hist.el index 198b1d017c4..067c5ea7ff2 100644 --- a/lisp/eshell/em-hist.el +++ b/lisp/eshell/em-hist.el @@ -119,15 +119,14 @@ If set to t, history will always be saved, silently." (const :tag "Always save" t)) :group 'eshell-hist) -(defcustom eshell-input-filter - (function - (lambda (str) - (not (string-match "\\`\\s-*\\'" str)))) +(defcustom eshell-input-filter 'eshell-input-filter-default "Predicate for filtering additions to input history. Takes one argument, the input. If non-nil, the input may be saved on the input history list. Default is to save anything that isn't all whitespace." - :type 'function + :type '(radio (function-item eshell-input-filter-default) + (function-item eshell-input-filter-initial-space) + (function :tag "Other function")) :group 'eshell-hist) (put 'eshell-input-filter 'risky-local-variable t) @@ -206,6 +205,16 @@ element, regardless of any text on the command line. In that case, ;;; Functions: +(defun eshell-input-filter-default (input) + "Do not add blank input to input history. +Returns non-nil if INPUT is blank." + (not (string-match "\\`\\s-*\\'" input))) + +(defun eshell-input-filter-initial-space (input) + "Do not add input beginning with empty space to history. +Returns nil if INPUT is prepended by blank space, otherwise non-nil." + (not (string-match-p "\\`\\s-+" input))) + (defun eshell-hist-initialize () "Initialize the history management code for one Eshell buffer." (add-hook 'eshell-expand-input-functions |