Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Multiple shell windows

12 views
Skip to first unread message

Somnath Mitra

unread,
May 15, 2001, 1:24:15 PM5/15/01
to
Greetings,

Can someone show me how to have multiple shell buffers in one emacs
session?

Thanks,

Somnath.

Raphaėl Berbain

unread,
May 15, 2001, 1:35:49 PM5/15/01
to
Somnath Mitra <somnat...@computer.org> writes:

> Greetings,
>
> Can someone show me how to have multiple shell buffers in one emacs
> session?

M-x shell RET
M-x rename-buffer RET some_name RET
M-x shell RET

HTH.

--
Raphaël

A.L. Souza

unread,
May 14, 2001, 8:46:04 AM5/14/01
to


Or

M-x shell RET
M-x rename-uniquely RET
M-x shell RET

Michael A. Koerber

unread,
May 16, 2001, 7:27:06 AM5/16/01
to
Somnath Mitra wrote:
>
> Greetings,
>
> Can someone show me how to have multiple shell buffers in one emacs
> session?
Try:
1. "M-x shell"
2. Then "M-x rename-buffer" to something else, say "Shell-1"
3. Then "M-x shell" should open another default "*shell*"
4. etc...

mike

--
-------------------------------------------------------------------
Dr Michael A. Koerber "Men occasionally stumble over the
MIT/Lincoln Laboratory truth, but most of them pick themselves
m...@ll.mit.edu up and hurry off as if nothing had
happened.", Winston Churchill

pi...@cs.uu.nl

unread,
May 16, 2001, 8:46:51 AM5/16/01
to
>>>>> Somnath Mitra <somnat...@computer.org> (SM) writes:

SM> Greetings,
SM> Can someone show me how to have multiple shell buffers in one emacs
SM> session?

I have a particular solution for this that I use all the time:
I like to have the shell buffer tied to the working directory, so I have a
command (sh) that creates one for the working directory, unless that
already exists, in which case it is reused. So I don't have to think if I
already have a shell for that directory:

;sh.el
(require 'shell)
(defun sh (dir)
"Run an inferior shell.
The shell runs in and the buffer name reflects DIRECTORY (default current
working directory). Prompts for directory name if interactively called
with prefix arg.
The buffer is put in cmushell-mode, giving commands for sending input
and controlling the subjobs of the shell. See cmushell-mode.
See also variable comint-prompt-regexp.
Note that many people's .cshrc files unconditionally clear the prompt.
If yours does, you will probably want to change it."
(interactive (list
(if current-prefix-arg
(read-file-name "sh in dir: " nil default-directory t))))
(setq dir (file-name-as-directory
(expand-file-name (or dir default-directory))))
(let* ((prog (or explicit-shell-file-name
(getenv "ESHELL")
(getenv "SHELL")
"/bin/sh"))
(name (file-name-nondirectory prog))
(bufname (concat name "-" dir))
(bufname1 (concat "*" bufname "*"))
(startfile (concat "~/.emacs_" name))
(xargs-name (intern-soft (concat "explicit-" name "-args")))
(buffer (get-buffer bufname1)))
(if buffer
(switch-to-buffer buffer)
(switch-to-buffer (get-buffer-create bufname1))
(setq default-directory dir)
(apply 'make-comint bufname
name
(if (file-exists-p startfile) startfile)
(if (and xargs-name (boundp xargs-name))
(symbol-value xargs-name)
'("-i")))
(shell-mode))
(goto-char (point-max))))
--
Piet van Oostrum <pi...@cs.uu.nl>
URL: http://www.cs.uu.nl/~piet [PGP]
Private email: P.van....@hccnet.nl

Kevin Rodgers

unread,
May 16, 2001, 1:55:46 PM5/16/01
to
Somnath Mitra wrote:
> Can someone show me how to have multiple shell buffers in one emacs
> session?

You might like

http://www.cis.ohio-state.edu/archive/archive/defshell.el

--
Kevin Rodgers <kev...@ihs.com> Lead Software Engineer
Information Handling Services Electronic Systems Development
15 Inverness Way East, M/S A114 GO BUFFS!
Englewood CO 80112-5776 USA 1+ (303) 397-2807[voice]/705-4258[fax]

Galen Boyer

unread,
May 16, 2001, 10:04:05 PM5/16/01
to
On 16 May 2001, pi...@cs.uu.nl wrote:

> I have a command (sh) that creates one for the working
> directory, unless that already exists, in which case it is
> reused. So I don't have to think if I already have a shell for
> that directory:

This is nice.

Thanks.
--
Galen
I don't want to be the rock. Yeah, okay, what do you want to be?
I want to be the piece of glass.

0 new messages