;ELC   
;;; Compiled by pot@pot.cnuce.cnr.it on Tue Mar 18 15:41:15 2003
;;; from file /home/pot/gnu/emacs-pretest.new/lisp/eshell/esh-var.el
;;; in Emacs version 21.3
;;; with bytecomp version 2.85.4.1
;;; with all optimizations.

;;; This file uses dynamic docstrings, first added in Emacs 19.29.
(if (and (boundp 'emacs-version)
	 (< (aref emacs-version (1- (length emacs-version))) ?A)
	 (or (and (boundp 'epoch::version) epoch::version)
	     (string-lessp emacs-version "19.29")))
    (error "`esh-var.el' was compiled for Emacs 19.29 or later"))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;


(byte-code "\300\301!\210\302\303\304\305\306\307\310\311&\210\312\313!\210\312\314!\207" [provide esh-var custom-declare-group eshell-var nil "Variable interpolation is introduced whenever the '$' character\nappears unquoted in any argument (except when that argument is\nsurrounded by single quotes) .  It may be used to interpolate a\nvariable value, a subcommand, or even the result of a Lisp form." :tag "Variable handling" :group eshell require env ring] 8)
#@57 *A list of functions to call when loading `eshell-var'.
(custom-declare-variable 'eshell-var-load-hook ''(eshell-var-initialize) '(#$ . -1088) :type 'hook :group 'eshell-var)
#@62 *If non-nil, prefer Lisp variables to environment variables.
(custom-declare-variable 'eshell-prefer-lisp-variables 'nil '(#$ . -1269) :type 'boolean :group 'eshell-var)
#@70 *If non-nil, completing names for `export' shows current definition.
(custom-declare-variable 'eshell-complete-export-definition 't '(#$ . -1445) :type 'boolean :group 'eshell-var)
#@242 *A regexp identifying what constitutes a variable name reference.
Note that this only applies for '$NAME'.  If the syntax '$<NAME>' is
used, then NAME can contain any character, including angle brackets,
if they are quoted with a backslash.
(custom-declare-variable 'eshell-variable-name-regexp '"[A-Za-z0-9_-]+" '(#$ . -1633) :type 'regexp :group 'eshell-var)
#@718 *This list provides aliasing for variable references.
It is very similar in concept to what `eshell-user-aliases-list' does
for commands.  Each member of this defines defines the name of a
command, and the Lisp value to return for that variable if it is
accessed via the syntax '$NAME'.

If the value is a function, that function will be called with two
arguments: the list of the indices that was used in the reference, and
whether the user is requesting the length of the ultimate element.
For example, a reference of '$NAME[10][20]' would result in the
function for alias `NAME' being called (assuming it were aliased to a
function), and the arguments passed to this function would be the list
'(10 20)', and nil.
(custom-declare-variable 'eshell-variable-aliases-list ''(("COLUMNS" (lambda (indices) (window-width)) t) ("LINES" (lambda (indices) (window-height)) t) ("_" (lambda (indices) (if (not indices) (car (last eshell-last-arguments)) (eshell-apply-indices eshell-last-arguments indices)))) ("?" eshell-last-command-status) ("$" eshell-last-command-result) ("0" eshell-command-name) ("1" (lambda (indices) (nth 0 eshell-command-arguments))) ("2" (lambda (indices) (nth 1 eshell-command-arguments))) ("3" (lambda (indices) (nth 2 eshell-command-arguments))) ("4" (lambda (indices) (nth 3 eshell-command-arguments))) ("5" (lambda (indices) (nth 4 eshell-command-arguments))) ("6" (lambda (indices) (nth 5 eshell-command-arguments))) ("7" (lambda (indices) (nth 6 eshell-command-arguments))) ("8" (lambda (indices) (nth 7 eshell-command-arguments))) ("9" (lambda (indices) (nth 8 eshell-command-arguments))) ("*" (lambda (indices) (if (not indices) eshell-command-arguments (eshell-apply-indices eshell-command-arguments indices))))) '(#$ . -2001) :type '(repeat (list string sexp (choice (const :tag "Copy to environment" t) (const :tag "Use only in Eshell" nil)))) :group 'eshell-var)
(put 'eshell-variable-aliases-list 'risky-local-variable t)
#@38 Initialize the variable handle code.
(defalias 'eshell-var-initialize #[nil "\306\300!\307\310\"L\210\311	\312\313#\210\306\302!\314\n\315\"L\210\306\303!\314\316\"L\210\317\320!\210\321\320\322\323\211$\210\317\324!\210\321\324\325\326\323$\210\327\327>)\205Q \317\330!\210\321\330\331\326\323$\210\321\330\332\326\323$\207" [process-environment eshell-command-map eshell-special-chars-inside-quoting eshell-special-chars-outside-quoting module eshell-modules-list make-local-variable mapcar concat define-key [(meta 118)] eshell-insert-envvar append (36) (36) make-local-hook eshell-parse-argument-hook add-hook eshell-interpolate-variable t eshell-prepare-command-hook eshell-handle-local-variables nil eshell-cmpl pcomplete-try-first-hook eshell-complete-variable-reference eshell-complete-variable-assignment] 5 (#$ . 3962)])
#@50 Allow for the syntax 'VAR=val <command> <args>'.
(defalias 'eshell-handle-local-variables #[nil "\204 	\203 	@	A\202  \306\307!	\205a \310\f\"\205a \311\312\313\314\315C\316C\310\f\"\203T \317\320\321\"\320\322\"\320\322\"G\323UFC\244\210\307\n@!\nA\202- A)\324\325\nDEC#D\"+\207" [eshell-last-command-name eshell-last-arguments args command setvar l "\\`\\([A-Za-z_][A-Za-z0-9_]*\\)=\\(.*\\)\\'" eshell-stringify string-match throw eshell-replace-command eshell-as-subcommand append progn t setenv match-string 1 2 0 eshell-named-command quote] 12 (#$ . 4803)])
#@103 Parse a variable interpolation.
This function is explicit for adding to `eshell-parse-argument-hook'.
(defalias 'eshell-interpolate-variable #[nil "\300f\301=\205 `TdU?\205 \300u\210\302\303 D\207" [nil 36 eshell-escape-arg eshell-parse-variable] 2 (#$ . 5394)])
#@38 Define a VAR-ALIAS using DEFINITION.
(defalias 'eshell/define #[(var-alias definition) "\204 \305\306	\n\"\n\"\2027 \306	\n\"	\307G\310U\203! @\202\" DD\211\2032 \305\306	\n\"\n\"\nB*\311\207" [definition var-alias eshell-variable-aliases-list alias-def def delq assoc quote 1 nil] 6 (#$ . 5665)])
#@69 This alias allows the 'export' command to act as bash users expect.
(defalias 'eshell/export #[(&rest sets) "\205' @;\203 \301\302@\"\203 \303\304\305@\"\304\306@\"\"\210A\211\204 \307\207" [sets string-match "^\\([^=]+\\)=\\(.*\\)" setenv match-string 1 2 nil] 6 (#$ . 5980)])
#@44 Completion function for Eshell's `export'.
(defalias 'pcomplete/eshell-mode/export #[nil "\300\301\302\211\211$\205\f \202  \207" [pcomplete--here (if eshell-complete-export-definition process-environment (eshell-envvar-names)) nil] 5 (#$ . 6274)])
#@32 Unset an environment variable.
(defalias 'eshell/unset #[(&rest args) "\205 @;\203 \301@\302\303#\210A\211\204 \302\207" [args setenv nil t] 5 (#$ . 6529)])
#@43 Completion function for Eshell's `unset'.
(defalias 'pcomplete/eshell-mode/unset #[nil "\300\301\302\211\211$\205\f \202  \207" [pcomplete--here (eshell-envvar-names) nil] 5 (#$ . 6700)])
#@34 Allow command-ish use of `setq'.
(defalias 'eshell/setq #[(&rest args) "\305	\203! \306	@!	\211A@)\211L	\211AA)*\202 )\207" [last-value args x val sym nil intern] 3 (#$ . 6894)])
#@42 Completion function for Eshell's `setq'.
(defalias 'pcomplete/eshell-mode/setq #[nil "\300\301\302\211\211$\205 \300\302\211\211\211$\205 \202  \207" [pcomplete--here (all-completions pcomplete-stub obarray 'boundp) nil] 5 (#$ . 7089)])
#@32 Implemention of `env' in Lisp.
(defalias 'eshell/env #[(&rest args) "\306 \210\307!\310\311\")\312\211\211\211\211\211\211\211\211\313\314\315\316#.\n\207" [args temp-args ext-command last-value usage-msg eshell-option-stub eshell-init-print-buffer eshell-flatten-list mapcar eshell-stringify nil eshell-do-opt "env" ((104 "help" nil nil "show this usage screen") :external "env" :usage "<no arguments>") ((eshell-for setting (sort (eshell-environment-variables) 'string-lessp) (eshell-buffered-print setting "\n")) (eshell-flush))] 9 (#$ . 7334)])
#@54 Insert ENVVAR-NAME into the current buffer at point.
(defalias 'eshell-insert-envvar #[(envvar-name) "\301\302\"\207" [envvar-name insert-and-inherit "$"] 3 (#$ . 7902) (list (read-envvar-name "Name of environment variable: " t))])
#@64 Return a list of currently visible environment variable names.
(defalias 'eshell-envvar-names #[(&optional environment) "\302\303\206 	\"\207" [environment process-environment mapcar #[(x) "\301\302\303\"O\207" [x 0 string-match "="] 5]] 3 (#$ . 8141)])
#@169 Return a `process-environment', fully updated.
This involves setting any variable aliases which affect the
environment, as specified in `eshell-variable-aliases-list'.
(defalias 'eshell-environment-variables #[nil "\304\305\"	\211\203+ \n@\3068\203# \307@\310\311@!\206  \312!\"\210)\nA\211\204 ))\207" [process-environment eshell-variable-aliases-list list-iter var-alias mapcar concat 2 setenv eshell-stringify eshell-get-variable ""] 6 (#$ . 8406)])
#@333 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.
(defalias 'eshell-parse-variable #[nil "\303f\304=\205 \303u\210\305\303\303\306 m?\205! \303f\307=\205! \310 \311\302\312\nDDC	E\2036 \313	D\2027 	+\207" [get-len value indices nil 35 t eshell-parse-variable-ref 91 eshell-parse-indices let quote length] 4 (#$ . 8876)])
#@349 Eval a variable reference.
Returns a Lisp form which, if evaluated, will return the value of the
variable.

Possible options are:

  NAME          an environment or Lisp variable value
  <LONG-NAME>   disambiguates the length of the name
  {COMMAND}     result of command is variable's value
  (LISP-FORM)   result of Lisp form is variable's value
(defalias 'eshell-parse-variable-ref #[nil "\306\306f\307=\203- \310\307\311\"\211\204 \312\313\307\"\202) \314\315\316\317`TB!DDDTb\210)\202\336 \306f\320>\203Q \306f\321=\203@ \322 \202B \323 \211\205M \324\325	!\326E)\202\336 \306f\327=\203\241 \310\327\330\"\211\204h \312\313\327\"\202\235 \331\n!`T{\332Q\333\334\335\336\337DEDC\340\316\317\f!D\341\342\343\344\345\346\306\347DEDDED\336DFETb\210*)\202\336 \306f\350=\203\257 \351\352\353\217\202\336 \354\355\306f!\"\203\307 \306u\210\324\355`Sf!\326E\202\336 \3563!\203\333 \324\357\360!\326E\360\225b\210\202\336 \361\362!)\207" [end name temporary-file-directory temp cmd eshell-variable-aliases-list nil 123 eshell-find-delimiter 125 throw eshell-incomplete eshell-convert eshell-command-to-value eshell-as-subcommand eshell-parse-command (39 34) 39 eshell-parse-literal-quote eshell-parse-double-quote eshell-get-variable eval indices 60 62 make-temp-name " > " let eshell-current-handles eshell-create-handles quote overwrite progn ignore nconc eshell-this-command-hook list function lambda delete-file 40 err (byte-code "\300\301\302\303p!DDD\207" [eshell-command-to-value eshell-lisp-command quote read] 5) ((end-of-file (byte-code "\300\301\302\"\207" [throw eshell-incomplete 40] 3))) assoc char-to-string looking-at match-string 0 error "Invalid variable reference" eshell-variable-name-regexp] 14 (#$ . 9494)])
#@45 Parse and return a list of list of indices.
(defalias 'eshell-parse-indices #[nil "\303\303f\304=\203/ \305\304\306\"\211\204 \307\310\304\"\210\202+ \303u\210\303\311`	\"B)	Tb\210)\202 \237)\207" [indices end eshell-glob-function nil 91 eshell-find-delimiter 93 throw eshell-incomplete eshell-parse-arguments] 4 (#$ . 11244)])
#@38 Get the value for the variable NAME.
(defalias 'eshell-get-variable #[(name &optional indices) "\306	\"\211\203 \n\211A@)\202 \n\203$ \307\f!\203$ \f!\202d \310\f;\203R \311\f!\211\203K \312!\203K \204E \313\f!\204K J\202N \313\f!)\202b \f9\203\\ \fJ\202b \314\315\316\f!\"\"*\207" [name eshell-variable-aliases-list alias x var indices assoc functionp eshell-apply-indices intern-soft boundp getenv error "Unknown variable `%s'" eshell-stringify sym eshell-prefer-lisp-variables] 6 (#$ . 11586)])
#@728 Apply to VALUE all of the given INDICES, returning the sub-result.
The format of INDICES is:

  ((INT-OR-NAME-OR-OTHER INT-OR-NAME INT-OR-NAME ...)
   ...)

Each member of INDICES represents a level of nesting.  If the first
member of a sublist is not an integer or name, and the value it's
reference is a string, that will be used as the regexp with which is
to divide the string into sub-parts.  The default is whitespace.
Otherwise, each INT-OR-NAME refers to an element of the list value.
Integers imply a direct index, and names, an associate lookup using
`assoc'.

For example, to retrieve the second element of a user's record in
'/etc/passwd', the variable reference would look like:

  ${egrep johnw /etc/passwd}[: 2]
(defalias 'eshell-apply-indices #[(value indices) "\203\201 @\n;\203: \306\211@@);\2031 \307\310\311Q\211@@)\"\2041 \211@@)	A\312\313\314\n\"\")	G\315W\203K \316\317\320	!\"\210\202y 	G\321U\203[ \322\n	@\"\202y \323C	\203t \322\n	@\"C\244\210	A\211\204c A))A\211\204 \n\207" [indices refs value separator x eshell-variable-name-regexp nil string-match "^" "$" mapcar eshell-convert split-string 0 error "Illegal array variable index: %s" eshell-stringify 1 eshell-index-value t new-value] 6 (#$ . 12108)])
#@40 Reference VALUE using the given INDEX.
(defalias 'eshell-index-value #[(value index) ";\203 \302	\"A\207\303	!\203\" \304	!V\203 \305\306!\207\307	\"\207	<\2036 	GV\2032 \305\310!\207	8\207\311	!\203K 	GV\203G \305\312!\207	H\207\305\313!\207" [index value assoc ring-p ring-length error "Index exceeds length of ring" ring-ref "Index exceeds length of list" vectorp "Index exceeds length of vector" "Invalid data type for indexing"] 3 (#$ . 13375)])
#@48 If there is a variable reference, complete it.
(defalias 'eshell-complete-variable-reference #[nil "\305\211\306	\"`{*\305\307\310\311Q\n\"\211\205% \n	T\305O\312\313\314 \"*\207" [offset index arg eshell-variable-name-regexp pcomplete-stub nil pcomplete-begin string-match "\\$\\(" "\\)?\\'" throw pcomplete-completions eshell-variables-list] 4 (#$ . 13842)])
#@40 Generate list of applicable variables.
(defalias 'eshell-variables-list #[nil "\306\211\203$ \f@\307\310\nP@\"\203 @	B)\fA\211\204\n )\311\312\313\314\315\316 !\"\317\n\320#	#\321\"*\207" [pcomplete-stub completions argname eshell-variable-aliases-list list-iter alias nil string-match "^" sort append mapcar #[(varname) "\303!\211\203 	;\203 \304	!\203 \305\n!P\202 )\207" [varname value directory-sep-char eshell-get-variable file-directory-p char-to-string] 4] eshell-envvar-names eshell-environment-variables all-completions boundp string-lessp obarray] 8 (#$ . 14217)])
#@65 If there is a variable assignment, allow completion of entries.
(defalias 'eshell-complete-variable-assignment #[nil "\306\211\307	\"`{*\306\310\311\f\312Q\"\205/ \313\225\310\314\"\203% \315\225\n\306O\316\317\320 \"*\207" [offset index pos arg eshell-variable-name-regexp pcomplete-stub nil pcomplete-begin string-match "\\`" "=" 0 "\\(:\\)[^:]*\\'" 1 throw pcomplete-completions pcomplete-entries] 4 (#$ . 14819)])
