mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-01-30 12:21:25 -08:00
Make eshell-for obsolete (replaced by dolist)
* 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.
This commit is contained in:
parent
85a55d3871
commit
a9eeff78d5
15 changed files with 59 additions and 35 deletions
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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))
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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)))))
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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))
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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))
|
||||
|
|
|
|||
|
|
@ -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))
|
||||
|
|
|
|||
|
|
@ -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))
|
||||
|
||||
|
|
|
|||
|
|
@ -166,9 +166,9 @@
|
|||
(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)))
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue