Function: eshell-parse-local-variables
eshell-parse-local-variables is a byte-compiled function defined in
esh-var.el.gz.
Signature
(eshell-parse-local-variables ARGS)
Documentation
Parse a list of ARGS, looking for variable assignments.
Variable assignments are of the form "VAR=value". If ARGS
begins with any such assignments, throw eshell-replace-command
with a form that will temporarily set those variables.
Otherwise, return nil.
Source Code
;; Defined in /usr/src/emacs/lisp/eshell/esh-var.el.gz
(defun eshell-parse-local-variables (args)
"Parse a list of ARGS, looking for variable assignments.
Variable assignments are of the form \"VAR=value\". If ARGS
begins with any such assignments, throw `eshell-replace-command'
with a form that will temporarily set those variables.
Otherwise, return nil."
;; Handle local variable settings by let-binding the entries in
;; `eshell-local-variable-bindings' and calling `eshell-set-variable'
;; for each variable before the command is invoked.
(let ((setvar "\\`\\([A-Za-z_][A-Za-z0-9_]*\\)=\\(.*\\)\\'")
(head (car args))
(rest (cdr args)))
(when (and (stringp head) (string-match setvar head))
(throw 'eshell-replace-command
`(let ,eshell-local-variable-bindings
,@(let (locals)
(while (and (stringp head)
(string-match setvar head))
(push `(eshell-set-variable
,(match-string 1 head)
,(match-string 2 head))
locals)
(setq head (pop rest)))
(nreverse locals))
(eshell-named-command ,head ',rest))))))