all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* How to run DOS shell & Cygwin at the same time?
@ 2003-04-29 18:03 szhu
  0 siblings, 0 replies; 4+ messages in thread
From: szhu @ 2003-04-29 18:03 UTC (permalink / raw)


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? 

Thanks.

Shunhui Zhu

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: How to run DOS shell & Cygwin at the same time?
       [not found] <mailman.5368.1051639436.21513.help-gnu-emacs@gnu.org>
@ 2003-04-30  1:35 ` Galen Boyer
  2003-04-30 17:51 ` Kevin Rodgers
  1 sibling, 0 replies; 4+ messages in thread
From: Galen Boyer @ 2003-04-30  1:35 UTC (permalink / raw)


On Tue, 29 Apr 2003, 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?

I use these two functions to change between the two.

(defun set-shell-bash()
  (interactive)
  ;; (setq binary-process-input t)
  (setq shell-file-name "bash")
  (setq shell-command-switch "-c")
  (setq explicit-shell-file-name "bash")
  (setenv "SHELL" explicit-shell-file-name)
  (setq explicit-sh-args '("-login" "-i"))
  (setq w32-quote-process-args ?\")
  (setq mswindows-quote-process-args t)
  )

(defun set-shell-cmdproxy()
  (interactive)
  (setq shell-file-name "cmdproxy")
  (setq explicit-shell-file-name "cmdproxy")
  (setenv "SHELL" explicit-shell-file-name)
  (setq explicit-sh-args nil)
  (setq w32-quote-process-args nil)
  )

What you might do is something like:

M-x set-shell-bash
M-x shell
M-x rename-buffer "*BASH*"

M-x set-shell-cmdproxy
M-x shell
M-x rename-buffer "*CMD*"

-- 
Galen deForest Boyer
Sweet dreams and flying machines in pieces on the ground.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: How to run DOS shell & Cygwin at the same time?
       [not found] <mailman.5368.1051639436.21513.help-gnu-emacs@gnu.org>
  2003-04-30  1:35 ` Galen Boyer
@ 2003-04-30 17:51 ` Kevin Rodgers
  2003-04-30 22:15   ` Jason Dufair
  1 sibling, 1 reply; 4+ messages in thread
From: Kevin Rodgers @ 2003-04-30 17:51 UTC (permalink / raw)


[-- Attachment #1: Type: text/plain, Size: 405 bytes --]

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).


-- 
<a href="mailto:&lt;kevin.rodgers&#64;ihs.com&gt;">Kevin Rodgers</a>

[-- Attachment #2: defshell.el --]
[-- Type: text/plain, Size: 3877 bytes --]

;;; -*-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*<N>) 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 <kevinr@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]

;;; Emacs Lisp Archive Entry:
;;; Filename: defshell.el
;;; Author: Kevin Rodgers <kevinr@ihs.com>
;;; 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

[-- Attachment #3: Type: text/plain, Size: 151 bytes --]

_______________________________________________
Help-gnu-emacs mailing list
Help-gnu-emacs@gnu.org
http://mail.gnu.org/mailman/listinfo/help-gnu-emacs

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: How to run DOS shell & Cygwin at the same time?
  2003-04-30 17:51 ` Kevin Rodgers
@ 2003-04-30 22:15   ` Jason Dufair
  0 siblings, 0 replies; 4+ messages in thread
From: Jason Dufair @ 2003-04-30 22:15 UTC (permalink / raw)


>> 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?

You can run .bat files from Cygwin bash.  You can also (on NT variants
of Windows) run "cmd.exe" which puts you in a Windows "DOS" prompt.


-- 
Jason Dufair - jase@dufair.org
http://www.dufair.org/
"Wish I was a headlight on a northbound train
I'd shine my light through the cool Colorado rain"
-- The Grateful Dead

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2003-04-30 22:15 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-04-29 18:03 How to run DOS shell & Cygwin at the same time? szhu
     [not found] <mailman.5368.1051639436.21513.help-gnu-emacs@gnu.org>
2003-04-30  1:35 ` Galen Boyer
2003-04-30 17:51 ` Kevin Rodgers
2003-04-30 22:15   ` Jason Dufair

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.