Function: eshell-hist-initialize
eshell-hist-initialize is a byte-compiled function defined in
em-hist.el.gz.
Signature
(eshell-hist-initialize)
Documentation
Initialize the history management code for one Eshell buffer.
Source Code
;; Defined in /usr/src/emacs/lisp/eshell/em-hist.el.gz
(defun eshell-hist-initialize () ;Called from `eshell-mode' via intern-soft!
"Initialize the history management code for one Eshell buffer."
(when (eshell-using-module 'eshell-cmpl)
(add-hook 'pcomplete-try-first-hook
#'eshell-complete-history-reference nil t))
(if (and (eshell-using-module 'eshell-rebind)
(not eshell-non-interactive-p))
(let ((rebind-alist eshell-rebind-keys-alist))
(setq-local eshell-rebind-keys-alist
(append rebind-alist eshell-hist-rebind-keys-alist))
(setq-local search-invisible t)
(setq-local search-exit-option t)
(add-hook 'isearch-mode-hook
(lambda ()
(if (>= (point) eshell-last-output-end)
(setq overriding-terminal-local-map
eshell-isearch-map)))
nil t)
(add-hook 'isearch-mode-end-hook
(lambda ()
(setq overriding-terminal-local-map nil))
nil t))
(eshell-hist-mode))
(make-local-variable 'eshell-history-size)
(or eshell-history-size
(let ((hsize (getenv "HISTSIZE")))
(setq eshell-history-size
(if (and (stringp hsize)
(integerp (setq hsize (string-to-number hsize)))
(> hsize 0))
hsize
128))))
(make-local-variable 'eshell-history-file-name)
(or eshell-history-file-name
(setq eshell-history-file-name (getenv "HISTFILE")))
(make-local-variable 'eshell-history-index)
(make-local-variable 'eshell-save-history-index)
(if (minibuffer-window-active-p (selected-window))
(setq-local eshell-save-history-on-exit nil)
(setq-local eshell-history-ring nil)
(if eshell-history-file-name
(eshell-read-history nil t))
(add-hook 'eshell-exit-hook #'eshell-write-history nil t))
(unless eshell-history-ring
(setq eshell-history-ring (make-ring eshell-history-size)))
(add-hook 'eshell-exit-hook #'eshell-write-history nil t)
(add-hook 'kill-emacs-query-functions #'eshell-save-some-history)
(add-hook 'eshell-input-filter-functions #'eshell-add-to-history nil t))