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)))
(eshell-hist-mode))
(add-hook 'isearch-mode-hook #'eshell--isearch-setup nil t)
(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)
(setq-local eshell-hist--new-items 0)
(setq-local eshell-history-ring nil)
(when eshell-history-file-name
(eshell-read-history nil t))
(unless eshell-history-ring
(setq eshell-history-ring (make-ring eshell-history-size)))
(add-hook 'eshell-exit-hook #'eshell--save-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))