Function: eshell

eshell is an autoloaded, interactive and byte-compiled function defined in eshell.el.gz.

Signature

(eshell &optional ARG)

Documentation

Create an interactive Eshell buffer.

Start a new Eshell session, or switch to an already active session. Return the buffer selected (or created).

With a nonnumeric prefix arg, create a new session.

With a numeric prefix arg (as in C-u (universal-argument) 42 M-x eshell (eshell)), switch to the session with that number, or create it if it doesn't already exist.

The buffer name used for Eshell sessions is determined by the value of eshell-buffer-name, which see.

Eshell is a shell-like command interpreter. For more information on Eshell, see Info node (eshell)Top.

Probably introduced at or before Emacs version 21.1.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/eshell/eshell.el.gz
;;;_* Running Eshell
;;
;; There are only three commands used to invoke Eshell.  The first two
;; are intended for interactive use, while the third is meant for
;; programmers.  They are:

;;;###autoload
(defun eshell (&optional arg)
  "Create an interactive Eshell buffer.
Start a new Eshell session, or switch to an already active
session.  Return the buffer selected (or created).

With a nonnumeric prefix arg, create a new session.

With a numeric prefix arg (as in `\\[universal-argument] 42 \\[eshell]'), switch
to the session with that number, or create it if it doesn't
already exist.

The buffer name used for Eshell sessions is determined by the
value of `eshell-buffer-name', which see.

Eshell is a shell-like command interpreter.  For more
information on Eshell, see Info node `(eshell)Top'."
  (interactive "P")
  (cl-assert 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)))))
    (cl-assert (and buf (buffer-live-p buf)))
    (pop-to-buffer buf (append display-buffer--same-window-action
                               '((category . comint))))
    (unless (derived-mode-p 'eshell-mode)
      (eshell-mode))
    buf))