Function: eshell-goto-history
eshell-goto-history is a byte-compiled function defined in
em-hist.el.gz.
Signature
(eshell-goto-history POS)
Documentation
Replace command line with the element at POS of history ring.
Also update eshell-history-index. As a special case, if POS is nil
and eshell--stored-incomplete-input is a non-empty string, restore the
saved input.
Source Code
;; Defined in /usr/src/emacs/lisp/eshell/em-hist.el.gz
(defun eshell-goto-history (pos)
"Replace command line with the element at POS of history ring.
Also update `eshell-history-index'. As a special case, if POS is nil
and `eshell--stored-incomplete-input' is a non-empty string, restore the
saved input."
(when (null eshell-history-index)
(setq eshell--stored-incomplete-input
(buffer-substring-no-properties eshell-last-output-end
(point-max))))
(setq eshell-history-index pos)
;; Can't use kill-region as it sets this-command
(delete-region eshell-last-output-end (point-max))
(if (and pos (not (ring-empty-p eshell-history-ring)))
(insert-and-inherit (eshell-get-history pos))
(when (> (length eshell--stored-incomplete-input) 0)
(insert-and-inherit eshell--stored-incomplete-input))))