summaryrefslogtreecommitdiff
path: root/lisp/eshell/eshell.el
diff options
context:
space:
mode:
authorKai Großjohann <kgrossjo@eu.uu.net>2002-07-26 20:40:53 +0000
committerKai Großjohann <kgrossjo@eu.uu.net>2002-07-26 20:40:53 +0000
commit818001cc232d6800b41aa6804330351601af7acc (patch)
tree1e5867d1393655339b3ae01a8317fcb31fae8eff /lisp/eshell/eshell.el
parentfb4792ed1b95d574a105c241c6744dbc8f1545ee (diff)
downloademacs-818001cc232d6800b41aa6804330351601af7acc.tar.gz
(eshell): Numeric prefix arg means to switch
to the session with that number. Old behavior still available with nonumeric prefix args.
Diffstat (limited to 'lisp/eshell/eshell.el')
-rw-r--r--lisp/eshell/eshell.el17
1 files changed, 12 insertions, 5 deletions
diff --git a/lisp/eshell/eshell.el b/lisp/eshell/eshell.el
index 106a161f8fb..4f5b54294c6 100644
--- a/lisp/eshell/eshell.el
+++ b/lisp/eshell/eshell.el
@@ -352,13 +352,20 @@ the tasks accomplished by such tools."
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 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,