[comp.emacs] Multiple shells

drw@cullvax.UUCP (Dale Worley) (05/20/87)

To get another shell, use "M-X another-shell".  It renames the old
shell buffer to be "*Shell<n>*" (for some suitable n), and starts a
new shell.

--------------------
; function for making another shell
(defun another-shell ()
  (interactive)
  (save-excursion
    (let ((i 1) 
	  (buffer (get-buffer "*shell*"))
	  name)
      (if (not buffer)
	  (ding)
	(while
	    (progn
	      (setq name (concat "*Shell<" (int-to-string i) ">*"))
	      (get-buffer name))
	  (setq i (1+ i)))
	(set-buffer buffer)
	(rename-buffer name)
	(message (concat "Old shell renamed " name)))))
  (shell))
--------------------

Dale
-- 
Dale Worley		Cullinet Software
UUCP: ...!seismo!harvard!mit-eddie!cullvax!drw
ARPA: cullvax!drw@eddie.mit.edu
Un*x (a generic name for a class of OS's) != Unix (AT&T's brand of such)

lius@nucsrl.UUCP (Sying-Syang Liu) (05/25/87)

To get a new shell (with an arbitrary buffer name) 
or switch to an old buffer (shell) if it exists.

;----------------------- C u t   H e r e -----------------------------
(defun mshell (buffer-name)
  (interactive "sBuffer name for this shell: ") 
  (cond ((get-buffer buffer-name) (switch-to-buffer buffer-name))
        (t (shell) (rename-buffer buffer-name))))

;----------------------------------------------------------------------
Sying-Syang Liu, Northwestern University, Computer Science Research Lab
UUCP:  {gargoyle,ihnp4,chinet}!nucsrl!lius