]> git.eshelyaron.com Git - emacs.git/commitdiff
Make eshell-for obsolete (replaced by dolist)
authorGlenn Morris <rgm@gnu.org>
Sat, 5 Mar 2011 03:53:41 +0000 (19:53 -0800)
committerGlenn Morris <rgm@gnu.org>
Sat, 5 Mar 2011 03:53:41 +0000 (19:53 -0800)
* 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.

15 files changed:
lisp/ChangeLog
lisp/eshell/em-alias.el
lisp/eshell/em-dirs.el
lisp/eshell/em-hist.el
lisp/eshell/em-ls.el
lisp/eshell/em-unix.el
lisp/eshell/esh-cmd.el
lisp/eshell/esh-ext.el
lisp/eshell/esh-mode.el
lisp/eshell/esh-module.el
lisp/eshell/esh-proc.el
lisp/eshell/esh-test.el
lisp/eshell/esh-util.el
lisp/eshell/esh-var.el
lisp/eshell/eshell.el

index 2fca345992d5f1344d7d2253f05c44710f46a63d..9d4743107cf94d5dcaaf3adfd017b84b51ef0fb4 100644 (file)
@@ -1,3 +1,26 @@
+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)
index aa138cb4dcbae2f87dc58f50ba848efd6ec262d3..9efa95fc9ab6a2f60903261852e40a6c8843eccb 100644 (file)
@@ -156,7 +156,7 @@ command, which will automatically write them to the file named by
 (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
@@ -238,7 +238,7 @@ command, which will automatically write them to the file named by
   "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))
index 64555ab15efa7f783337dc215aeb34f5ecae81ef..9165f69d0b189efb33fbd548bd70efc5dc596c12 100644 (file)
@@ -233,7 +233,7 @@ Thus, this does not include the current directory.")
 
 (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
index 5ec529f4b8f17ea49770f74d85d48d222c8a5f04..f9ddf3b679f69a04fad49a3b63e717a4481606f2 100644 (file)
@@ -292,7 +292,7 @@ element, regardless of any text on the command line.  In that case,
 
 (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
@@ -730,7 +730,7 @@ matched."
          (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)))))
index 7714629f2fa95e2be5efc469bee9594caac5b98a..4ef259dee4b98733fb7c4d69d14d08a67f0efafb 100644 (file)
@@ -561,7 +561,7 @@ relative to that directory."
          (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
@@ -651,7 +651,7 @@ Each member of FILES is either a string or a cons cell of the form
               (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)
@@ -676,7 +676,7 @@ Each member of FILES is either a string or a cons cell of the form
              (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)
@@ -696,7 +696,7 @@ Each member of FILES is either a string or a cons cell of the form
             (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
@@ -731,7 +731,7 @@ ROOT-DIR, if non-nil, specifies the root directory of the listing, to
 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)
@@ -757,7 +757,7 @@ need to be printed."
       (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
index dc5650d240e9aeccd16ddaa8a2d1f28f8d93f972..3bb623c4c4e5a3a2206eb214887c8ca4d8611d1c 100644 (file)
@@ -587,7 +587,7 @@ symlink, then revert to the system's definition of cat."
   (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) ?-))
@@ -610,12 +610,12 @@ symlink, then revert to the system's definition of cat."
        :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))
@@ -851,7 +851,7 @@ external command."
   (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))))))
@@ -1055,7 +1055,7 @@ Become another USER during a login session.")
                            "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))
index 0567beb9a539716594dbb476406a90c440edff29..0a00300d19cab8ca91fb4a060857c3faf84ef39d 100644 (file)
@@ -987,7 +987,7 @@ at the moment are:
         (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)))
@@ -1165,7 +1165,7 @@ be finished later after the completion of an asynchronous subprocess."
        (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
@@ -1241,7 +1241,7 @@ be finished later after the completion of an asynchronous subprocess."
 
 (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)
index 7128d7e4749709a43e1379d0913f7a62a6a266a4..ebd20b90dd6858659978f4d0744b23507d91911c 100644 (file)
@@ -263,7 +263,7 @@ line of the form #!<interp>."
   (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)
index 3735ee35fd5325a685ac36a68f347c196e86a4a4..3b566ead0e5e91e9c69c08499fa841716e6af166 100644 (file)
@@ -389,7 +389,7 @@ This is used by `eshell-watch-for-password-prompt'."
   ;; 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)
@@ -404,12 +404,12 @@ This is used by `eshell-watch-for-password-prompt'."
     (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))
index 5a62c71355c9a7a64ae3802197720490593ad937..41f9e662a958b82d71287f04f150cc7b2c1afebf 100644 (file)
@@ -92,7 +92,7 @@ customization group.  Example: `eshell-cmpl' for that module."
 
 (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))
index f697a40055694b02f37086d54e0020c95f627845..8757f5d56a0b5bcdd5947b659fcf74bb06b8a4a7 100644 (file)
@@ -398,7 +398,7 @@ PROC is the process that's exiting.  STRING is the exit message."
 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
@@ -412,7 +412,7 @@ If QUERY is non-nil, query the user with QUERY before calling FUNC."
     ;; 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))
 
index f5c55dd8ae79c6b7c37101819e17279e2dd34ee0..73ba16116c04dc0589d80fb794f930a864aeb79e 100644 (file)
       (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)))
index 2de147acb0029f69638596e12ba6bafd8f3f67ee..6b04b0e727be782d51170abe2dc0798e20bf387b 100644 (file)
@@ -296,10 +296,12 @@ Prepend remote identification of `default-directory', if any."
 
 (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))
@@ -405,7 +407,7 @@ list."
     (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
index 4c42b305ec2bf632580c5a1881fe069ba6599dd9..8fb089631929e5f1870fb8babae75e56db25deba 100644 (file)
@@ -351,8 +351,7 @@ This function is explicit for adding to `eshell-parse-argument-hook'."
    '((?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)))
 
@@ -374,7 +373,7 @@ This function is explicit for adding to `eshell-parse-argument-hook'."
 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
@@ -623,7 +622,7 @@ For example, to retrieve the second element of a user's record in
   "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
index 7690a102a9b053788812f29e9716c4497b3f9d10..cda1eea2c5522884a18f7553c3834ce5649f86d0 100644 (file)
@@ -474,7 +474,7 @@ Emacs."
   ;; 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