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))
         (splice (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))
          value `(let ((indices ,(eshell-prepare-indices indices))) ,value))
    (when get-len
      (setq value `(length ,value)))
    (when eshell-current-quoted
      (if splice
          (setq value `(eshell-list-to-string ,value)
                splice nil)
        (setq value `(eshell-stringify ,value t))))
    (when splice
      (setq value `(eshell-splice-args ,value)))
    value))