-;;; eshell --- the Emacs command shell
+;;; eshell.el --- the Emacs command shell
;; Copyright (C) 1999, 2000 Free Software Foundation
;; Author: John Wiegley <johnw@gnu.org>
+;; Version: 2.4.2
;; Keywords: processes
-;; X-URL: http://www.emacs.org/~johnw/eshell.html
;; This file is part of GNU Emacs.
the tasks accomplished by such tools."
:tag "The Emacs shell"
:link '(info-link "(eshell)The Emacs shell")
+ :version "21.1"
:group 'applications)
;;; Commentary:
;; @ Command argument completion (tcsh, zsh)
;; @ Input history management (bash)
;; @ Intelligent output scrolling
-;; @ Psuedo-devices (such as "/dev/clip" for copying to the clipboard)
+;; @ Pseudo-devices (such as "/dev/clip" for copying to the clipboard)
;; @ Extended globbing (zsh)
;; @ Argument and globbing predication (zsh)
;; @ I/O redirection to buffers, files, symbols, processes, etc.
;; @ 4nt
;; @ csh
+;;;_* Speeding up load time
+;;
+;; If you find that Eshell loads too slowly, there is something you
+;; can do to speed it up.
+;;
+;; Create a file, named /tmp/elc, containing this filelist:
+;;
+;; esh-util.elc
+;; eshell.elc
+;; esh-module.elc
+;; esh-var.elc
+;; esh-proc.elc
+;; esh-arg.elc
+;; esh-io.elc
+;; esh-ext.elc
+;; esh-cmd.elc
+;; esh-mode.elc
+;; esh-opt.elc
+;; em-alias.elc
+;; em-banner.elc
+;; em-basic.elc
+;; em-cmpl.elc
+;; em-dirs.elc
+;; em-pred.elc
+;; em-glob.elc
+;; em-hist.elc
+;; em-ls.elc
+;; em-prompt.elc
+;; em-rebind.elc
+;; em-script.elc
+;; em-smart.elc
+;; em-term.elc
+;; em-unix.elc
+;; em-xtra.elc
+;;
+;; The order is very important. Remove from the filelist any features
+;; you don't use. These all begin with "em-". If you don't use
+;; Eshell's key rebinding module, you can remove "em-rebind.elc" from
+;; the filelist. The modules you are currently using are listed in
+;; `eshell-modules-list'.
+;;
+;; Now, concatenating all of the above mentioned .elc files, in that
+;; order, to another file. Here is how to do this on UNIX:
+;;
+;; cat `cat /tmp/elc` > tmp.elc ; mv tmp.elc eshell.elc
+;;
+;; Now your eshell.elc file contains all of the .elc files that make
+;; up Eshell, in the right load order. When you next load Eshell, it
+;; will only have to read in this one file, which will greatly speed
+;; things up.
+
;;;_* User Options
;;
;; The following user options modify the behavior of Eshell overall.
-(load "esh-util" nil t)
+(unless (featurep 'esh-util)
+ (load "esh-util" nil t))
(defsubst eshell-add-to-window-buffer-names ()
"Add `eshell-buffer-name' to `same-window-buffer-names'."
The buffer used for Eshell sessions is determined by the value of
`eshell-buffer-name'. If there is already an Eshell session active in
that buffer, Emacs will simply switch to it. Otherwise, a new session
-will begin. A new session is always created if the the prefix
-argument ARG is specified. Returns the buffer selected (or created)."
+will begin. A numeric prefix arg (as in `C-u 42 M-x eshell RET')
+switches to the session with that number, creating it if necessary. A
+nonnumeric prefix arg means to create a new session. Returns the
+buffer selected (or created)."
(interactive "P")
(assert eshell-buffer-name)
- (let ((buf (if arg
- (generate-new-buffer eshell-buffer-name)
- (get-buffer-create eshell-buffer-name))))
+ (let ((buf (cond ((numberp arg)
+ (get-buffer-create (format "%s<%d>"
+ eshell-buffer-name
+ arg)))
+ (arg
+ (generate-new-buffer eshell-buffer-name))
+ (t
+ (get-buffer-create eshell-buffer-name)))))
;; Simply calling `pop-to-buffer' will not mimic the way that
;; shell-mode buffers appear, since they always reuse the same
;; window that that command was invoked from. To achieve this,
(define-key eshell-mode-map [(meta return)] 'exit-minibuffer)
(define-key eshell-mode-map [(meta control ?m)] 'exit-minibuffer))
+(defvar eshell-non-interactive-p nil
+ "A variable which is non-nil when Eshell is not running interactively.
+Modules should use this variable so that they don't clutter
+non-interactive sessions, such as when using `eshell-command'.")
+
;;;###autoload
(defun eshell-command (&optional command arg)
"Execute the Eshell command string COMMAND.
With prefix ARG, insert output into the current buffer at point."
(interactive)
(require 'esh-cmd)
- (setq arg current-prefix-arg)
+ (unless arg
+ (setq arg current-prefix-arg))
(unwind-protect
(let ((eshell-non-interactive-p t))
(add-hook 'minibuffer-setup-hook 'eshell-mode)
+ (add-hook 'minibuffer-exit-hook 'eshell-add-command-to-history)
(add-hook 'eshell-mode-hook 'eshell-return-exits-minibuffer)
- (setq command (read-from-minibuffer "Emacs shell command: ")))
+ (unless command
+ (setq command (read-from-minibuffer "Emacs shell command: "))))
(remove-hook 'eshell-mode-hook 'eshell-return-exits-minibuffer)
+ (remove-hook 'minibuffer-exit-hook 'eshell-add-command-to-history)
(remove-hook 'minibuffer-setup-hook 'eshell-mode))
(unless command
(error "No command specified!"))
(message "(There was no command output)")
(kill-buffer buf))
((= len 1)
- (message (buffer-string))
+ (message "%s" (buffer-string))
(kill-buffer buf))
(t
(save-selected-window
(run-hooks 'eshell-load-hook)
+;;; arch-tag: 9d4d5214-0e4e-4e02-b349-39add640d63f
;;; eshell.el ends here