Can someone show me how to have multiple shell buffers in one emacs
session?
Thanks,
Somnath.
> 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
Or
M-x shell RET
M-x rename-uniquely RET
M-x shell RET
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
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
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]
> 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.