Thursday, January 2, 2003

Multiple Emacs Shell Buffers

I don’t use Emacs that often anymore, but it’s occasionally quite useful. One thing I like is its shell buffers. Unfortunately, I’m always forgetting how to open more than one shell buffer at a time. Normally you can type M-x shell to open a new shell buffer, but if you already have one open that will just switch to the existing one. The solution is to use M-x rename-buffer to change the name of the first shell buffer before creating another one. The next time I forget, I’ll just search for this page.

4 Comments RSS · Twitter


you might like to try

(defun start-another-shell ()
"start a new instance of shell;
if buffer \"*shell*\" already exists, rename it and start a new instance.
The older shell will be marked \"\", counter-intuitively...."
(interactive)
(setq shell-name "*shell*")
(if (get-buffer shell-name)
(progn
(switch-to-buffer shell-name)
(rename-buffer (generate-new-buffer-name shell-name))))
(shell))


or, duh: ShellMode @ EmacsWiki has an even better version; why didn't I look there _first_ ?!


[...] to Mjtsai for the tip. Tags: bash, emacs, linux, shell, unix Comment (RSS) [...]


you can try “Ctrl+u Alt+x shell” as mentioned in http://xahlee.org/emacs/emacs_unix.html

(this page turned up when i searched, so hope it'll be helpful to someone else also)

Leave a Comment