Function: eshell-list-history
eshell-list-history is an interactive and byte-compiled function
defined in em-hist.el.gz.
Signature
(eshell-list-history)
Documentation
List in help buffer the buffer's input history.
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/eshell/em-hist.el.gz
(defun eshell-list-history ()
"List in help buffer the buffer's input history."
(interactive)
(let (prefix prelen)
(save-excursion
(if (re-search-backward "!\\(.+\\)" (line-beginning-position) t)
(setq prefix (match-string 1)
prelen (length prefix))))
(if (or (not (ring-p eshell-history-ring))
(ring-empty-p eshell-history-ring))
(message "No history")
(let ((history nil)
(history-buffer " *Input History*")
(index (1- (ring-length eshell-history-ring)))
(conf (current-window-configuration)))
;; We have to build up a list ourselves from the ring vector.
(while (>= index 0)
(let ((hist (eshell-get-history index)))
(if (or (not prefix)
(and (>= (length hist) prelen)
(string= (substring hist 0 prelen) prefix)))
(setq history (cons hist history))))
(setq index (1- index)))
;; Change "completion" to "history reference"
;; to make the display accurate.
(with-output-to-temp-buffer history-buffer
(display-completion-list
(completion-hilit-commonality history (length prefix)))
(set-buffer history-buffer)
(forward-line 3)
(while (search-backward "completion" nil 'move)
(replace-match "history reference")))
(eshell-redisplay)
(message "Hit space to flush")
(let ((ch (read-event)))
(if (eq ch ?\ )
(set-window-configuration conf)
(push ch unread-command-events)))))))