changeset 46705:9f4f7bee7b8d

(eshell): Numeric prefix arg means to switch to the session with that number. Old behavior still available with nonumeric prefix args.
author Kai Großjohann <kgrossjo@eu.uu.net>
date Fri, 26 Jul 2002 20:40:53 +0000
parents 1e725474da67
children 160bfc160855
files lisp/ChangeLog lisp/eshell/eshell.el
diffstat 2 files changed, 18 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Fri Jul 26 15:39:12 2002 +0000
+++ b/lisp/ChangeLog	Fri Jul 26 20:40:53 2002 +0000
@@ -1,3 +1,9 @@
+2002-07-26  Kai Gro,b_(Bjohann  <Kai.Grossjohann@CS.Uni-Dortmund.DE>
+
+	* eshell/eshell.el (eshell): Numeric prefix arg means to switch
+	to the session with that number.  Old behavior still available
+	with nonumeric prefix args.
+
 2002-07-08  Simon Josefsson  <jas@extundo.com>
 
 	* mail/mail-extr.el (mail-extr-all-top-level-domains): Update names.
--- a/lisp/eshell/eshell.el	Fri Jul 26 15:39:12 2002 +0000
+++ b/lisp/eshell/eshell.el	Fri Jul 26 20:40:53 2002 +0000
@@ -352,13 +352,20 @@
 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,