Function: eshell-index-value
eshell-index-value is a byte-compiled function defined in
esh-var.el.gz.
Signature
(eshell-index-value VALUE INDEX)
Documentation
Reference VALUE using the given INDEX.
Source Code
;; Defined in /usr/src/emacs/lisp/eshell/esh-var.el.gz
(defun eshell-index-value (value index)
"Reference VALUE using the given INDEX."
(when (and (stringp index) (get-text-property 0 'number index))
(setq index (string-to-number index)))
(if (stringp index)
(cdr (assoc index value))
(cond
((ring-p value)
(if (> index (ring-length value))
(error "Index exceeds length of ring")
(ring-ref value index)))
((listp value)
(if (> index (length value))
(error "Index exceeds length of list")
(nth index value)))
((vectorp value)
(if (> index (length value))
(error "Index exceeds length of vector")
(aref value index)))
(t
(error "Invalid data type for indexing")))))