Function: eshell-history-reference
eshell-history-reference is a byte-compiled function defined in
em-hist.el.gz.
Signature
(eshell-history-reference REFERENCE)
Documentation
Expand directory stack REFERENCE.
The syntax used here was taken from the Bash info manual. Returns the resultant reference, or the same string REFERENCE if none matched.
Source Code
;; Defined in /usr/src/emacs/lisp/eshell/em-hist.el.gz
(defun eshell-history-reference (reference)
"Expand directory stack REFERENCE.
The syntax used here was taken from the Bash info manual.
Returns the resultant reference, or the same string REFERENCE if none
matched."
;; `!'
;; Start a history substitution, except when followed by a
;; space, tab, the end of the line, = or (.
(if (not (string-match "^![^ \t\n=(]" reference))
reference
(setq eshell-history-index nil)
(let ((event (eshell-hist-parse-event-designator reference)))
(unless event
(error "Could not find history event `%s'" reference))
(setq eshell-history-index (car event)
reference (substring reference (cdr event))
event (eshell-get-history eshell-history-index))
(if (not (string-match "^[:^$*%]" reference))
event
(let ((word (eshell-hist-parse-word-designator
event reference)))
(unless word
(error "Unable to honor word designator `%s'" reference))
(unless (string-match "^[:^$*%][[$^*%0-9-]" reference)
(setcdr word 0))
(setq event (car word)
reference (substring reference (cdr word)))
(if (not (and (eshell-using-module 'eshell-pred)
(string-match "^:" reference)))
event
(eshell-hist-parse-modifier event reference)))))))