From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Kevin Rodgers Newsgroups: gmane.emacs.help Subject: Re: How to run DOS shell & Cygwin at the same time? Date: Wed, 30 Apr 2003 11:51:38 -0600 Sender: help-gnu-emacs-bounces+gnu-help-gnu-emacs=m.gmane.org@gnu.org Message-ID: <3EB00D2A.7070802@yahoo.com> References: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------070702030406000105080202" X-Trace: main.gmane.org 1051725490 15770 80.91.224.249 (30 Apr 2003 17:58:10 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Wed, 30 Apr 2003 17:58:10 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+gnu-help-gnu-emacs=m.gmane.org@gnu.org Wed Apr 30 19:58:08 2003 Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 19Avnc-0003vM-00 for ; Wed, 30 Apr 2003 19:55:20 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 19Avnv-00042H-00 for gnu-help-gnu-emacs@m.gmane.org; Wed, 30 Apr 2003 13:55:39 -0400 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!fu-berlin.de!uni-berlin.de!170.207.51.80!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 129 Original-NNTP-Posting-Host: 170.207.51.80 Original-X-Trace: fu-berlin.de 1051725091 12980275 170.207.51.80 (16 [82742]) User-Agent: Mozilla/5.0 (X11; U; SunOS i86pc; en-US; rv:0.9.4.1) Gecko/20020406 Netscape6/6.2.2 X-Accept-Language: en-us Original-Xref: shelby.stanford.edu gnu.emacs.help:112584 Original-To: help-gnu-emacs@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1b5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Help: List-Post: List-Subscribe: , List-Archive: List-Unsubscribe: , Errors-To: help-gnu-emacs-bounces+gnu-help-gnu-emacs=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.help:9080 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:9080 This is a multi-part message in MIME format. --------------070702030406000105080202 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit szhu@SonicWALL.com wrote: > Hi, I'm using emacs on the windows platform, I'd like to use both the > bash shell (cygwin), and the DOS shell (because most of my colleagues > use the .bat scripts). I know how to set "M-x shell" to either one of > them, how can I add a function to invoke the other one? Try defshell.el (attached). -- Kevin Rodgers --------------070702030406000105080202 Content-Type: text/plain; name="defshell.el" Content-Transfer-Encoding: 8bit Content-Disposition: inline; filename="defshell.el" ;;; -*-unibyte: t;-*- ;;; defshell.el -- Define inferior shells. ;;; RCS $Id: defshell.el,v 1.3 2001/05/21 16:17:46 kevinr Exp $ ;;; Description: ;;; defshell.el makes it easy to run different inferior shells at the ;;; same time, by defining new commands for the Bourne (M-x sh), C (M-x ;;; csh), Korn (M-x ksh), and Bourne Again (M-x bash) shells. And ;;; whereas the `M-x shell' command defined in Emacs' shell.el always ;;; reuses the *shell* buffer, defshell.el can be customized via the ;;; defshell-reuse-buffer and defshell-rename-buffer-uniquely options ;;; (e.g. for `M-x sh') to reuse the *sh* buffer or create a *sh*<2> (or ;;; *sh*) buffer. ;;; ;;; defshell.el also provides the `defshell' macro to define additional ;;; shell commands. E.g. to define the Foo shell (M-x fsh): ;;; (defshell "/bin/fsh" "Foo") ;;; or to define a DNS lookup shell (M-x nslookup): ;;; (defshell "/usr/sbin/nslookup" "DNS lookup") ;;; and since `nslookup` doesn't accept the -i option: ;;; (setq explicit-nslookup-args '()) ;;; Copyright: ;;; ;;; Copyright © 2000 Kevin Rodgers ;;; ;;; This program is free software; you can redistribute it and/or modify ;;; it under the terms of the GNU General Public License as published by ;;; the Free Software Foundation; either version 2 of the License, or ;;; at your option) any later version. ;;; ;;; This program is distributed in the hope that it will be useful, ;;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;;; GNU General Public License for more details. ;;; ;;; You should have received a copy of the GNU General Public License ;;; along with this program; if not, write to the Free Software ;;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ;;; ;;; My employer (Information Handling Services) has not disclaimed any ;;; copyright interest in minibuffer-complete-cycle.el. ;;; ;;; Kevin Rodgers 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] ;;; Emacs Lisp Archive Entry: ;;; Filename: defshell.el ;;; Author: Kevin Rodgers ;;; Version: $Revision: 1.3 $ ;;; Description: Define inferior shells. ;;; Keywords: shell ;;; Last-Updated: $Date: 2001/05/21 16:17:46 $ (provide 'defshell) (require 'comint) ; comint-check-proc (require 'shell) ; shell (defvar defshell-reuse-buffer t "*If non-nil, reuse `defshell-shell' buffers.") ; i.e. pop-to-buffer (defvar defshell-rename-buffer-uniquely nil "*If non-nil, rename `defshell-shell' buffers uniquely.") (defun defshell-shell (defshell-file-name) "*Run an inferior DEFSHELL-FILE-NAME shell." (interactive "sShell: ") (let* ((explicit-shell-file-name defshell-file-name) (defshell-buffer-name (concat "*" (file-name-sans-extension (file-name-nondirectory explicit-shell-file-name)) "*"))) (if (and defshell-reuse-buffer (comint-check-proc defshell-buffer-name)) ; see shell.el (pop-to-buffer (get-buffer defshell-buffer-name)) (progn (shell) (rename-buffer defshell-buffer-name (or defshell-rename-buffer-uniquely (comint-check-proc defshell-buffer-name))))))) (defmacro defshell (shell-file-name &optional shell-name) (let ((command (intern (file-name-sans-extension (file-name-nondirectory shell-file-name))))) `(defun ,command () ,(format "*Run an inferior %s shell." (or shell-name shell-file-name)) (interactive) (defshell-shell ,shell-file-name)))) (defshell "/bin/sh" "Bourne") (defshell "/bin/csh" "C") (defshell "/bin/ksh" "Korn") (defshell "/usr/local/bin/bash" "Bourne Again") ;;; defshell.el ends here --------------070702030406000105080202 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit _______________________________________________ Help-gnu-emacs mailing list Help-gnu-emacs@gnu.org http://mail.gnu.org/mailman/listinfo/help-gnu-emacs --------------070702030406000105080202--