* eshell/esh-util.el (eshell-for): Make it obsolete.
* eshell/em-alias.el (eshell/alias, eshell-alias-completions):
* eshell/em-dirs.el (eshell-save-some-last-dir):
* eshell/em-hist.el (eshell-save-some-history, eshell-hist-parse-modifier):
* eshell/em-ls.el (eshell-ls-dir, eshell-ls-files, eshell-ls-entries):
* eshell/em-unix.el (eshell/cat, eshell/du, eshell/su):
* eshell/esh-cmd.el (eshell-invoke-directly, eshell-do-eval, eshell/which):
* eshell/esh-ext.el (eshell-find-interpreter):
* eshell/esh-mode.el (eshell-mode):
* eshell/esh-module.el (eshell-unload-extension-modules):
* eshell/esh-proc.el (eshell-process-interact):
* eshell/esh-test.el (eshell-test):
* eshell/esh-util.el (eshell-flatten-list, eshell-winnow-list):
* eshell/esh-var.el (eshell/env, eshell-environment-variables)
(eshell-variables-list):
* eshell/eshell.el (eshell-unload-all-modules):
Replace eshell-for with dolist.
+2011-03-05 Glenn Morris <rgm@gnu.org>
+
+ * eshell/esh-util.el (eshell-for): Make it obsolete.
+ * eshell/em-alias.el (eshell/alias, eshell-alias-completions):
+ * eshell/em-dirs.el (eshell-save-some-last-dir):
+ * eshell/em-hist.el (eshell-save-some-history)
+ (eshell-hist-parse-modifier):
+ * eshell/em-ls.el (eshell-ls-dir, eshell-ls-files)
+ (eshell-ls-entries):
+ * eshell/em-unix.el (eshell/cat, eshell/du, eshell/su):
+ * eshell/esh-cmd.el (eshell-invoke-directly, eshell-do-eval)
+ (eshell/which):
+ * eshell/esh-ext.el (eshell-find-interpreter):
+ * eshell/esh-mode.el (eshell-mode):
+ * eshell/esh-module.el (eshell-unload-extension-modules):
+ * eshell/esh-proc.el (eshell-process-interact):
+ * eshell/esh-test.el (eshell-test):
+ * eshell/esh-util.el (eshell-flatten-list, eshell-winnow-list):
+ * eshell/esh-var.el (eshell/env, eshell-environment-variables)
+ (eshell-variables-list):
+ * eshell/eshell.el (eshell-unload-all-modules):
+ Replace eshell-for with dolist.
+
2011-03-04 Glenn Morris <rgm@gnu.org>
* vc/vc-bzr.el (vc-bzr-after-dir-status): Handle bzr 2.3.0. (Bug#8170)
(defun eshell/alias (&optional alias &rest definition)
"Define an ALIAS in the user's alias list using DEFINITION."
(if (not alias)
- (eshell-for alias eshell-command-aliases-list
+ (dolist (alias eshell-command-aliases-list)
(eshell-print (apply 'format "alias %s %s\n" alias)))
(if (not definition)
(setq eshell-command-aliases-list
"Find all possible completions for NAME.
These are all the command aliases which begin with NAME."
(let (completions)
- (eshell-for alias eshell-command-aliases-list
+ (dolist (alias eshell-command-aliases-list)
(if (string-match (concat "^" name) (car alias))
(setq completions (cons (car alias) completions))))
completions))
(defun eshell-save-some-last-dir ()
"Save the list-dir-ring for any open Eshell buffers."
- (eshell-for buf (buffer-list)
+ (dolist (buf (buffer-list))
(if (buffer-live-p buf)
(with-current-buffer buf
(if (and eshell-mode
(defun eshell-save-some-history ()
"Save the history for any open Eshell buffers."
- (eshell-for buf (buffer-list)
+ (dolist (buf (buffer-list))
(if (buffer-live-p buf)
(with-current-buffer buf
(if (and eshell-mode
(narrow-to-region here (point))
(goto-char (point-min))
(let ((modifiers (cdr (eshell-parse-modifiers))))
- (eshell-for mod modifiers
+ (dolist (mod modifiers)
(setq hist (funcall mod hist)))
hist))
(delete-region here (point)))))
(when (or (eq listing-style 'long-listing) show-size)
(let ((total 0.0))
(setq size-width 0)
- (eshell-for e entries
+ (dolist (e entries)
(if (nth 7 (cdr e))
(setq total (+ total (nth 7 (cdr e)))
size-width
(not (eq eshell-in-pipeline-p 'last))
(not (eq listing-style 'by-lines)))
(memq listing-style '(long-listing single-column)))
- (eshell-for file files
+ (dolist (file files)
(if file
(eshell-ls-file file size-width copy-fileinfo)))
(let ((f files)
(setcdr f (cddr f))))))
(if (not show-size)
(setq display-files (mapcar 'eshell-ls-annotate files))
- (eshell-for file files
+ (dolist (file files)
(let* ((str (eshell-ls-printable-size (nth 7 (cdr file)) t))
(len (length str)))
(if (< len size-width)
(columns (length col-widths))
(col-index 1)
need-return)
- (eshell-for file display-files
+ (dolist (file display-files)
(let ((name
(if (car file)
(if show-size
which non-absolute directory names will be made relative if ever they
need to be printed."
(let (dirs files show-names need-return (size-width 0))
- (eshell-for entry entries
+ (dolist (entry entries)
(if (and (not dir-literal)
(or (eshell-ls-filetype-p (cdr entry) ?d)
(and (eshell-ls-filetype-p (cdr entry) ?l)
(setq need-return t))
(setq show-names (or show-recursive
(> (+ (length files) (length dirs)) 1)))
- (eshell-for dir (eshell-ls-sort-entries dirs)
+ (dolist (dir (eshell-ls-sort-entries dirs))
(if (and need-return (not dir-literal))
(funcall insert-func "\n"))
(eshell-ls-dir dir show-names
(setq args (eshell-stringify-list (eshell-flatten-list args)))
(if (or eshell-in-pipeline-p
(catch 'special
- (eshell-for arg args
+ (dolist (arg args)
(unless (or (and (stringp arg)
(> (length arg) 0)
(eq (aref arg 0) ?-))
:show-usage
:usage "[OPTION] FILE...
Concatenate FILE(s), or standard input, to standard output.")
- (eshell-for file args
+ (dolist (file args)
(if (string= file "-")
(throw 'eshell-external
(eshell-external-command "cat" args))))
(let ((curbuf (current-buffer)))
- (eshell-for file args
+ (dolist (file args)
(with-temp-buffer
(insert-file-contents file)
(goto-char (point-min))
(let ((ext-du (eshell-search-path "du")))
(if (and ext-du
(not (catch 'have-ange-path
- (eshell-for arg args
+ (dolist (arg args)
(if (string-equal
(file-remote-p (expand-file-name arg) 'method) "ftp")
(throw 'have-ange-path t))))))
"localhost"))
(dir (or (file-remote-p default-directory 'localname)
(expand-file-name default-directory))))
- (eshell-for arg args
+ (dolist (arg args)
(if (string-equal arg "-") (setq login t) (setq user arg)))
;; `eshell-eval-using-options' does not handle "-".
(if (member "-" orig-args) (setq login t))
(not (member name eshell-complex-commands))
(catch 'simple
(progn
- (eshell-for pred eshell-complex-commands
+ (dolist (pred eshell-complex-commands)
(if (and (functionp pred)
(funcall pred name))
(throw 'simple nil)))
(if (and (eq (car form) 'let)
(not (eq (car (cadr args)) 'eshell-do-eval)))
(eshell-manipulate "evaluating let args"
- (eshell-for letarg (car args)
+ (dolist (letarg (car args))
(if (and (listp letarg)
(not (eq (cadr letarg) 'quote)))
(setcdr letarg
(defun eshell/which (command &rest names)
"Identify the COMMAND, and where it is located."
- (eshell-for name (cons command names)
+ (dolist (name (cons command names))
(let (program alias direct)
(if (eq (aref name 0) eshell-explicit-command-char)
(setq name (substring name 1)
(let ((finterp
(catch 'found
(ignore
- (eshell-for possible eshell-interpreter-alist
+ (dolist (possible eshell-interpreter-alist)
(cond
((functionp (car possible))
(and (funcall (car possible) file)
;; load extension modules into memory. This will cause any global
;; variables they define to be visible, since some of the core
;; modules sometimes take advantage of their functionality if used.
- (eshell-for module eshell-modules-list
+ (dolist (module eshell-modules-list)
(let ((module-fullname (symbol-name module))
module-shortname)
(if (string-match "^eshell-\\(.*\\)" module-fullname)
(eshell-make-private-directory eshell-directory-name t))
;; load core Eshell modules for this session
- (eshell-for module (eshell-subgroups 'eshell)
+ (dolist (module (eshell-subgroups 'eshell))
(run-hooks (intern-soft (concat (symbol-name module)
"-load-hook"))))
;; load extension modules for this session
- (eshell-for module eshell-modules-list
+ (dolist (module eshell-modules-list)
(let ((load-hook (intern-soft (concat (symbol-name module)
"-load-hook"))))
(if (and load-hook (boundp load-hook))
(defun eshell-unload-extension-modules ()
"Unload any memory resident extension modules."
- (eshell-for module (eshell-subgroups 'eshell-module)
+ (dolist (module (eshell-subgroups 'eshell-module))
(if (featurep module)
(ignore-errors
(message "Unloading %s..." (symbol-name module))
If ALL is non-nil, background processes will be interacted with as well.
If QUERY is non-nil, query the user with QUERY before calling FUNC."
(let (defunct result)
- (eshell-for entry eshell-process-list
+ (dolist (entry eshell-process-list)
(if (and (memq (process-status (car entry))
'(run stop open closed))
(or all
;; clean up the process list; this can get dirty if an error
;; occurred that brought the user into the debugger, and then they
;; quit, so that the sentinel was never called.
- (eshell-for d defunct
+ (dolist (d defunct)
(eshell-remove-process-entry d))
result))
(insert "Testing Eshell under " (emacs-version))
(switch-to-buffer test-buffer)
(delete-other-windows))
- (eshell-for funcname (sort (all-completions "eshell-test--"
+ (dolist (funcname (sort (all-completions "eshell-test--"
obarray 'functionp)
- 'string-lessp)
+ 'string-lessp))
(with-current-buffer test-buffer
(insert "\n"))
(funcall (intern-soft funcname)))
(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
'((?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
"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
;; if the user set `eshell-prefer-to-shell' to t, but never loaded
;; Eshell, then `eshell-subgroups' will be unbound
(when (fboundp 'eshell-subgroups)
- (eshell-for module (eshell-subgroups 'eshell)
+ (dolist (module (eshell-subgroups 'eshell))
;; this really only unloads as many modules as possible,
;; since other `require' references (such as by customizing
;; `eshell-prefer-to-shell' to a non-nil value) might make it