;;; esh-util.el --- general utilities
-;; Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
-;; 2008, 2009, 2010 Free Software Foundation, Inc.
+;; Copyright (C) 1999-2012 Free Software Foundation, Inc.
;; Author: John Wiegley <johnw@gnu.org>
Numeric form is tested using the regular expression
`eshell-number-regexp'.
-NOTE: If you find that numeric conversions are intefering with the
+NOTE: If you find that numeric conversions are interfering with the
specification of filenames (for example, in calling `find-file', or
some other Lisp function that deals with files, not numbers), add the
following in your .emacs file:
(memq system-type '(ms-dos windows-nt)))
(defmacro eshell-condition-case (tag form &rest handlers)
- "Like `condition-case', but only if `eshell-pass-through-errors' is nil."
+ "If `eshell-handle-errors' is non-nil, this is `condition-case'.
+Otherwise, evaluates FORM with no error handling."
+ (declare (indent 2))
(if eshell-handle-errors
`(condition-case ,tag
,form
,@handlers)
form))
-(put 'eshell-condition-case 'lisp-indent-function 2)
-
-(defmacro eshell-deftest (module name label &rest forms)
- (if (and (fboundp 'cl-compiling-file) (cl-compiling-file))
- nil
- (let ((fsym (intern (concat "eshell-test--" (symbol-name name)))))
- `(eval-when-compile
- (ignore
- (defun ,fsym () ,label
- (eshell-run-test (quote ,module) (quote ,fsym) ,label
- (quote (progn ,@forms)))))))))
-
-(put 'eshell-deftest 'lisp-indent-function 2)
-
(defun eshell-find-delimiter
(open close &optional bound reverse-p backslash-p)
"From point, find the CLOSE delimiter corresponding to OPEN.
(setq text (replace-match " " t t text)))
text))
-;; FIXME this is just dolist.
(defmacro eshell-for (for-var for-list &rest forms)
- "Iterate through a list"
+ "Iterate through a list."
+ (declare (indent 2))
`(let ((list-iter ,for-list))
(while list-iter
(let ((,for-var (car list-iter)))
,@forms)
(setq list-iter (cdr list-iter)))))
-(put 'eshell-for 'lisp-indent-function 2)
+
+(make-obsolete 'eshell-for 'dolist "24.1")
(defun eshell-flatten-list (args)
"Flatten any lists within ARGS, so that there are no sublists."
(let ((new-list (list t)))
- (eshell-for a args
+ (dolist (a args)
(if (and (listp a)
(listp (cdr a)))
(nconc new-list (eshell-flatten-list a))
(unless (listp entries)
(setq entries (list entries)
listified t))
- (eshell-for entry entries
+ (dolist (entry entries)
(unless (and exclude (string-match exclude entry))
(setq p predicates valid (null p))
(while p