Function: eshell-parse-variable

eshell-parse-variable is a byte-compiled function defined in esh-var.el.gz.

Signature

(eshell-parse-variable)

Documentation

Parse the next variable reference at point.

The variable name could refer to either an environment variable, or a Lisp variable. The priority order depends on the setting of eshell-prefer-lisp-variables.

Its purpose is to call eshell-parse-variable-ref, and then to process any indices that come after the variable reference.

Source Code

;; Defined in /usr/src/emacs/lisp/eshell/esh-var.el.gz
(defun eshell-parse-variable ()
  "Parse the next variable reference at point.
The variable name could refer to either an environment variable, or a
Lisp variable.  The priority order depends on the setting of
`eshell-prefer-lisp-variables'.

Its purpose is to call `eshell-parse-variable-ref', and then to
process any indices that come after the variable reference."
  (let* ((get-len (when (eq (char-after) ?#)
		    (forward-char) t))
	 value indices)
    (setq value (eshell-parse-variable-ref get-len)
	  indices (and (not (eobp))
		       (eq (char-after) ?\[)
		       (eshell-parse-indices))
          ;; This is an expression that will be evaluated by `eshell-do-eval',
          ;; which only support let-binding of dynamically-scoped vars
	  value `(let ((indices (eshell-eval-indices ',indices))) ,value))
    (when get-len
      (setq value `(length ,value)))
    (when eshell-current-quoted
      (setq value `(eshell-stringify ,value)))
    value))