352 |
The buffer used for Eshell sessions is determined by the value of |
The buffer used for Eshell sessions is determined by the value of |
353 |
`eshell-buffer-name'. If there is already an Eshell session active in |
`eshell-buffer-name'. If there is already an Eshell session active in |
354 |
that buffer, Emacs will simply switch to it. Otherwise, a new session |
that buffer, Emacs will simply switch to it. Otherwise, a new session |
355 |
will begin. A new session is always created if the prefix |
will begin. A numeric prefix arg (as in `C-u 42 M-x eshell RET') |
356 |
argument ARG is specified. Returns the buffer selected (or created)." |
switches to the session with that number, creating it if necessary. A |
357 |
|
nonnumeric prefix arg means to create a new session. Returns the |
358 |
|
buffer selected (or created)." |
359 |
(interactive "P") |
(interactive "P") |
360 |
(assert eshell-buffer-name) |
(assert eshell-buffer-name) |
361 |
(let ((buf (if arg |
(let ((buf (cond ((numberp arg) |
362 |
(generate-new-buffer eshell-buffer-name) |
(get-buffer-create (format "%s<%d>" |
363 |
(get-buffer-create eshell-buffer-name)))) |
eshell-buffer-name |
364 |
|
arg))) |
365 |
|
(arg |
366 |
|
(generate-new-buffer eshell-buffer-name)) |
367 |
|
(t |
368 |
|
(get-buffer-create eshell-buffer-name))))) |
369 |
;; Simply calling `pop-to-buffer' will not mimic the way that |
;; Simply calling `pop-to-buffer' will not mimic the way that |
370 |
;; shell-mode buffers appear, since they always reuse the same |
;; shell-mode buffers appear, since they always reuse the same |
371 |
;; window that that command was invoked from. To achieve this, |
;; window that that command was invoked from. To achieve this, |