This is part of The Pile, a partial archive of some open source mailing lists and newsgroups.
From: Georges Ko <gko@gko.net> Subject: Re: Open more than 1 shell in emacs Date: 19 Feb 2001 21:58:14 +0800 Chris Lee <clee@innocent.com> wrote: > I know that I can use M-x shell to open a shell in emacs. But if I would > like to open more than one shell in emacs, how I can do it? Here's a function that I use: (defun nshell () "Creating a new shell buffer." (interactive) (shell) (let ((i 0)) (while (get-buffer (format "%d<shell>" i)) (setq i (1+ i))) (rename-buffer (format "%d<shell>" i)))) -- Georges Ko (Taipei, Taiwan) 2001-02-19 gko@gko.net / ICQ: 8719684 Day 1 of week 8 of 2001 Path: nntp.stanford.edu!newsfeed.stanford.edu!newsfeed.berkeley.edu!ucberkeley!logbridge.uoregon.edu!server3.netnews.ja.net!server4.netnews.ja.net!server2.netnews.ja.net!hgmp.mrc.ac.uk!not-for-mail From: John Sturdy <jcgs@sanger.ac.uk> Newsgroups: comp.emacs Subject: Re: Open more than 1 shell in emacs Date: 01 Mar 2001 09:42:46 +0000 Organization: BIOSCI/MRC Human Genome Mapping Project Resource Centre Lines: 39 Message-ID: <rvur90hkep5.fsf@adnah.sanger.ac.uk> References: <3A8FF414.DC7394F1@innocent.com> NNTP-Posting-Host: adnah-e7.sanger.ac.uk X-Trace: niobium.hgmp.mrc.ac.uk 983439766 7165 193.62.207.28 (1 Mar 2001 09:42:46 GMT) X-Complaints-To: news@net.bio.net NNTP-Posting-Date: 1 Mar 2001 09:42:46 GMT X-Newsreader: Gnus v5.5/Emacs 20.3 Xref: nntp.stanford.edu comp.emacs:55666 Here's the code I use from my startup, it sets up a shell in each of several project directories, naming them appropriately, and one in my home directory for general use: (defun make-named-shell (name &optional directory) "Make a shell called NAME, optionally cd it to DIRECTORY." (interactive "sShell name: DDirectory to start %s in: ") (if (not (get-buffer name)) (progn (sleep-for 2) (let ((new-shell-buffer (shell))) (rename-buffer name) (if directory (let ((full-dir (expand-file-name directory))) (process-send-string (get-buffer-process new-shell-buffer) (format "cd %s\n" (filename-in-shell-format full-dir))) (cd full-dir)))))) (switch-to-buffer (get-buffer name))) (defun make-shell-for-directory-if-present (directory &optional name) "Make a shell for DIRECTORY, called NAME, if DIRECTORY exists." (if (file-directory-p directory) (make-named-shell (if name name (format "-%s-" (file-name-nondirectory directory))) directory))) (make-named-shell (format "=%s=" (system-short-name)) "~") (make-shell-for-directory-if-present "~/bioemacs") (make-shell-for-directory-if-present "~/www.acedb.org") (make-shell-for-directory-if-present "~/acedb") (make-shell-for-directory-if-present "~/aquila") -- Dr John Sturdy jcgs@sanger.ac.uk Informatics Division Sanger Centre