;;; esh-var.el --- handling of variables
-;; Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004,
-;; 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2011 Free Software Foundation, Inc.
;; Author: John Wiegley <johnw@gnu.org>
;; This file is part of GNU Emacs.
-;; GNU Emacs is free software; you can redistribute it and/or modify
+;; GNU Emacs is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
-;; the Free Software Foundation; either version 3, or (at your option)
-;; any later version.
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
;; GNU Emacs is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
-;; along with GNU Emacs; see the file COPYING. If not, write to the
-;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-;; Boston, MA 02110-1301, USA.
+;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
;;; Commentary:
;;
;; $ALSO-VAR
;;
-;; "-" is a legal part of a variable name.
+;; "-" is a valid part of a variable name.
;;
;; $<MYVAR>-TOO
;;
;; contains the exit code of the last command (0 or 1 for Lisp
;; functions, based on successful completion).
+;;; Code:
+
(provide 'esh-var)
(eval-when-compile
(require 'pcomplete)
- (require 'esh-test)
(require 'esh-util)
(require 'esh-opt)
(require 'esh-mode))
;;; User Variables:
-(defcustom eshell-var-load-hook '(eshell-var-initialize)
- "*A list of functions to call when loading `eshell-var'."
+(defcustom eshell-var-load-hook nil
+ "A list of functions to call when loading `eshell-var'."
+ :version "24.1" ; removed eshell-var-initialize
:type 'hook
:group 'eshell-var)
(defcustom eshell-prefer-lisp-variables nil
- "*If non-nil, prefer Lisp variables to environment variables."
+ "If non-nil, prefer Lisp variables to environment variables."
:type 'boolean
:group 'eshell-var)
(defcustom eshell-complete-export-definition t
- "*If non-nil, completing names for `export' shows current definition."
+ "If non-nil, completing names for `export' shows current definition."
:type 'boolean
:group 'eshell-var)
(defcustom eshell-modify-global-environment nil
- "*If non-nil, using `export' changes Emacs's global environment."
+ "If non-nil, using `export' changes Emacs's global environment."
:type 'boolean
:group 'eshell-var)
(defcustom eshell-variable-name-regexp "[A-Za-z0-9_-]+"
- "*A regexp identifying what constitutes a variable name reference.
+ "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."
eshell-command-arguments
(eshell-apply-indices eshell-command-arguments
indices)))))
- "*This list provides aliasing for variable references.
+ "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
'((?h "help" nil nil "show this usage screen")
:external "env"
:usage "<no arguments>")
- (eshell-for setting (sort (eshell-environment-variables)
- 'string-lessp)
+ (dolist (setting (sort (eshell-environment-variables) 'string-lessp))
(eshell-buffered-print setting "\n"))
(eshell-flush)))
This involves setting any variable aliases which affect the
environment, as specified in `eshell-variable-aliases-list'."
(let ((process-environment (eshell-copy-environment)))
- (eshell-for var-alias eshell-variable-aliases-list
+ (dolist (var-alias eshell-variable-aliases-list)
(if (nth 2 var-alias)
(setenv (car var-alias)
(eshell-stringify
(t
(error "Invalid variable reference")))))
-(eshell-deftest var interp-cmd
- "Interpolate command result"
- (eshell-command-result-p "+ ${+ 1 2} 3" "6\n"))
-
-(eshell-deftest var interp-lisp
- "Interpolate Lisp form evalution"
- (eshell-command-result-p "+ $(+ 1 2) 3" "6\n"))
-
-(eshell-deftest var interp-concat
- "Interpolate and concat command"
- (eshell-command-result-p "+ ${+ 1 2}3 3" "36\n"))
-
-(eshell-deftest var interp-concat-lisp
- "Interpolate and concat Lisp form"
- (eshell-command-result-p "+ $(+ 1 2)3 3" "36\n"))
-
-(eshell-deftest var interp-concat2
- "Interpolate and concat two commands"
- (eshell-command-result-p "+ ${+ 1 2}${+ 1 2} 3" "36\n"))
-
-(eshell-deftest var interp-concat-lisp2
- "Interpolate and concat two Lisp forms"
- (eshell-command-result-p "+ $(+ 1 2)$(+ 1 2) 3" "36\n"))
-
(defun eshell-parse-indices ()
"Parse and return a list of list of indices."
(let (indices)
"Generate list of applicable variables."
(let ((argname pcomplete-stub)
completions)
- (eshell-for alias eshell-variable-aliases-list
+ (dolist (alias eshell-variable-aliases-list)
(if (string-match (concat "^" argname) (car alias))
(setq completions (cons (car alias) completions))))
(sort
(setq pcomplete-stub (substring arg pos))
(throw 'pcomplete-completions (pcomplete-entries)))))
-;;; Code:
-
-;;; arch-tag: 393654fe-bdad-4f27-9a10-b1472ded14cf
;;; esh-var.el ends here